﻿
// -------------------------------------------------------
// Comando de vinculação do arquivo flash.js
// <script id="flash" src="flash.js"></script>
//
// -------------------------------------------------------
// Exemplo de chamada da função : 
// <script> open_flash('arquivo.swf','468','60')</script>
//
// -------------------------------------------------------
// Para definição de WMODE acrescente : 
// document.write('<param name="wmode" value="transparent">')
//
// -------------------------------------------------------

function open_flash(nome,largura,altura) {

	document.writeln('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="'+largura+'" height="'+altura+'" style="z-index:0" >')
	document.write('<param name=movie value="'+nome+'">')
	document.write('<param name=quality value=high>')
	document.write('<param name="wmode" value="transparent">')
	document.write('<embed src="'+nome+'" wmode="transparent" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="'+largura+'" height="'+altura+'">')
	document.write('</embed></object>')
}
function open_flash2(nome,largura,altura) {

	document.writeln('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="'+largura+'" height="'+altura+'" style="z-index:0" >')
	document.write('<param name=movie value="'+nome+'">')
	document.write('<param name=quality value=high>')
	document.write('<embed src="'+nome+'" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="'+largura+'" height="'+altura+'">')
	document.write('</embed></object>')
}

function open_flashHome(nome,largura,altura) {
	document.writeln('<object id="flashHome" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="'+largura+'" height="'+altura+'" style="z-index:0" >');
	document.write('<param name=movie value="'+nome+'">');
	document.write('<param name=quality value=high>');
	document.write('<embed src="'+nome+'" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="'+largura+'" height="'+altura+'">');
	document.write('</embed></object>');
}
function close_flashHome(){
    document.getElementById("divFlashHome").style.display="none";
}
function show_flashHome(){
	var obj = document.getElementById("divFlashHome");
	obj.style.width = document.body.clientWidth+"px";
	obj.style.height = (document.body.clientHeight-50)+"px";
	obj.style.verticalAlign = "middle";
    obj.style.display="";
}
function close_flash2(){
    document.getElementById("divFlashHome").style.display="none";
}
function show_flash2(){
	var obj = document.getElementById("divFlashHome");
	obj.style.width = document.body.clientWidth+"px";
	obj.style.height = (document.body.clientHeight-50)+"px";
	obj.style.verticalAlign = "middle";
    obj.style.display="";
}

var selBtn,btnSrc;
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapimagesRestore(skip) { //v3.0
    if(selBtn==undefined || skip=='1'){
        var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
    }else{
        var btn_ltI = document.getElementById('ltI');
        var btn_ltII = document.getElementById('ltII');
        var btn_ltIII = document.getElementById('ltIII');
        btn_ltI.src='image/box/boxBotI.gif';
        btn_ltII.src='image/box/boxBotII.gif';
        btn_ltIII.src='image/box/boxBotIII.gif';
        document.getElementById(selBtn).src=btnSrc;
    }
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function showTab(tabName,btnName,src){

    selBtn=btnName;
    btnSrc=src;
    var btn = document.getElementById(btnName);
    var btn_ltI = document.getElementById('ltI');
    var btn_ltII = document.getElementById('ltII');
    var btn_ltIII = document.getElementById('ltIII');
    btn_ltI.src='image/box/boxBotI.gif';
    btn_ltII.src='image/box/boxBotII.gif';
    btn_ltIII.src='image/box/boxBotIII.gif';
    btn.src=src;

    var tab = document.getElementById(tabName);
    var tab_ltI = document.getElementById('tab_ltI');
    var tab_ltII = document.getElementById('tab_ltII');
    var tab_ltIII = document.getElementById('tab_ltIII');
    tab_ltI.style.display='none';
    tab_ltII.style.display='none';
    tab_ltIII.style.display='none';
    tab.style.display='';
}
function verifyCheckCadastro(nao){
    if(nao==''){
        nao=false;
    }
    var checks = document.getElementsByTagName('input')
    for(i=0;i<checks.length;i++){
        if(checks[i].type=='checkbox'){
            if(checks[i].name.indexOf('cur5')<=0){;
                if(nao){
                    checks[i].checked='';
                }
            }else{
                if(!nao){
                    checks[i].checked='';
                }
            }
        }
    }
}
function setData(v){
    document.getElementById('ctl00_ContentPlaceHolder1_hfData').value=v;
}
function setLogin(v){
    document.getElementById('ctl00_topo1_hfLogin').value=v;
}
function Mostratr(param)
{
	if(param.style.display=='')
		param.style.display='none';
	else
		param.style.display='';
}
function setPage(hf,pg){
    document.getElementById(hf).value=pg;
}
function View(){
    var txtDe = document.getElementById("ctl00_ContentPlaceHolder1_hfDe").value;
    var txtImg = document.getElementById("ctl00_ContentPlaceHolder1_hfImg").value;
    var txtMsg = document.getElementById("ctl00_ContentPlaceHolder1_txtMsg").value;
    var txtPara = document.getElementById("ctl00_ContentPlaceHolder1_txtPeixinhos_ctl00");
    txtPara = txtPara.value;
    var W = openPopUp("PeixinhosVer.aspx?img="+txtImg+"&from="+txtDe+"&to="+txtPara+"&msg="+txtMsg, "VIEW", "width=740, height=560, top=10, left=10")
}
function ViewCard(){
    var txtDe = document.getElementById("ctl00_ContentPlaceHolder1_hfDe").value;
    var txtImg = document.getElementById("ctl00_ContentPlaceHolder1_hfImg").value;
    var txtMsg = document.getElementById("ctl00_ContentPlaceHolder1_txtMsg").value;
    var txtPara = document.getElementById("ctl00_ContentPlaceHolder1_txtName").value;
    var W = openPopUp("EcardVer.aspx?img="+txtImg+"&from="+txtDe+"&to="+txtPara+"&msg="+txtMsg, "VIEW", "width=740, height=560, top=10, left=10")
}
function _View(page){
    var W = openPopUp(page, "VIEW", "width=740, height=560, top=10, left=10")
}
function _ViewVoucher(page){
    var W = openPopUp(page, "VIEW", "width=740, height=560, top=10, left=10, scrollbars=1")
}
function doClick(url){
    window.setTimeout(function(){window.location = url}, 10000);
}
function redir(url){
    window.location = url;
}
/*function trocaAmpli(imgG,image){
    $(imgG).fadeOut("normal", function(){ $(imgG).attr("src", x); });
    $(imgG).fadeIn();
}*/
function trocaAmpli(imgG,image){
    document.getElementById(imgG).src=image;
}

function openPop(url,name,parm){
    var w = openPopUp(url,name,parm);
}
var lState;
function setWindow(){
    var timer = setInterval(checkReadyState, 10);
}
//function setWindowOk(){
//    var img = document.getElementById('img');
//    var w = img.offsetWidth;
//    var h = img.offsetHeight;
//    document.getElementById('tblContainer').width = w;
//    window.resizeTo(width=w+26,height=h+60);
//}
//Validações
function checkSelect(sender, args){
    if(args.Value == "Selecione" || args.Value == ""){
        args.IsValid = false;
    }else{
        args.IsValid = true;
    }
}

function verifyDDDR(sender, args){
    if(document.getElementById('ctl00_ContentPlaceHolder1_txtDDDR').value=='' && args.Value!=''){
        args.IsValid = false;
    }else{
        args.IsValid = true;
    }
}
function verifyDDDC(sender, args){
    if(document.getElementById('ctl00_ContentPlaceHolder1_txtDDDC').value=='' && args.Value!=''){
        args.IsValid = false;
    }else{
        args.IsValid = true;
    }
}
function verifyDDDCel(sender, args){
    if(document.getElementById('ctl00_ContentPlaceHolder1_txtDDDCel').value=='' && args.Value!=''){
        args.IsValid = false;
    }else{
        args.IsValid = true;
    }
}

function validateImg(sender,args){
    /*alert(getCookie('sort'));
    if(sender.value == getCookie('sort')){
        args.IsValid = true;
    }else{
        args.IsValid = false;
    }*/
    args.IsValid = true;
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1; 
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return "";
}