﻿//*******************************************************************************************************
function confirmarAlteracao(valor,codprof)
{
    if(confirm('Deseja confirmar a alteração?'))
    {
        document.getElementById("ctl00_ContentPlaceHolder1_frameSMS").src =  'smsAtualiza.aspx?sms=' + valor +'&codprof='+ codprof;
        return;
    }
    else
    {
        return false ;
    }
}
//Function gerar boleto
function gerarBoleto(cpf,nome,codprof,ano)
{
    document.getElementById("gerarBoleto").src =  '../processaBoletoAnuidade.asp?cpf='+ cpf + '&nome='+ nome +'&codprof='+ codprof +'&ano='+ ano; 
}
//Envia URL para o Itaú
function enviar(vDC,vAction){
    vJanela = window.open(vAction+'?DC='+vDC, 'SHOPLINE', 'toolbar=yes,menubar=yes,resizable=yes,status=no,scrollbars=yes,width=675,height=485');
    return false;
}
//Só aceita valores numéricos
function Valor(e)//Só aceita numero e virgulas
			{
				if (document.all) // Internet Explorer
					var tecla = event.keyCode;
				else if(document.layers) // Nestcape
					var tecla = e.which;
					if (tecla > 47 && tecla < 58) // numeros de 0 a 9
						return true;
					else
						{
							if (tecla != 8) // backspace e Virgula e Enter
								event.keyCode = 0;
								//return false;
							else
								return true;
						}
		}
//Função para abrir uma nova janela
function abreJanela(a,w,h,s)
{
	wnd=window.open(a,"wnd","toolbar=no,location=no,status=no,menubar=no,scrollbars=" + s + ",resizable=no,width=" + w + ",height=" + h + ",top=" + ((screen.height / 2) - (h / 2)) + ",left=" + ((screen.width / 2) - (w / 2)));
	wnd.focus();
}

//Função para abrir uma nova janela
function abreJanelaAdesao(a,w,h,s,i)
{
	wnd=window.open(a,"wnd","toolbar=no,location=no,status=no,menubar=no,scrollbars=" + s + ",resizable=" + i + ",width=" + w + ",height=" + h + ",top=" + ((screen.height / 2) - (h / 2)) + ",left=" + ((screen.width / 2) - (w / 2)));
	wnd.focus();
}

//Função para fechar a janela sem pergunta
function closeWindow() {
	var ie7 = (document.all && !window.opera && window.XMLHttpRequest) ? true : false;
	if (ie7) {
		window.open('','_parent','');
		window.close();
	} else {
		this.focus();
		self.opener = this;
		self.close();
	}
}

//Função para criar um objeto do FLASH
function criaFlash(a, w, h) {
	document.writeln('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ');
	document.write	(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" ');
	document.write	(' width="'+w+'" height="'+h+'">');
	document.writeln('<param name="movie" value="'+a+'">');
	document.writeln('<param name="quality" value="high">');
	document.writeln('<embed src="'+a+'" quality="high" ');
	document.write	(' pluginspage="http://www.macromedia.com/go/getflashplayer" ');
	document.write	(' type="application/x-shockwave-flash" ');
	document.write	(' width="'+w+'" height="'+h+'"></embed>');
	document.writeln('</object>');
}

//*******************************************************************************************************
//Funções para a gridview
var bgGVCor;

//Funções para mudar a cor das linhas das gridViews
function selecionaGrid(e)
{
	bgGVCor = e.style.backgroundColor;
	e.style.backgroundColor = "#EEF5FB";
}

//Função para mudar a linha ao de-selecionar
function deSelecionaGrid(e)
{
	e.style.backgroundColor = bgGVCor;
}

//Seleciona todos os checkboxes da gridview
function selecionaTodos(cTodos)
{
    //var cItem=cTodos.children;
    var cBox=(cTodos.type=="checkbox") ? cTodos : cTodos.children.item[0];
        
    cEstado=cBox.checked;
    cElem=cBox.form.elements;

    for(i=0;i<cElem.length;i++)
        if(cElem[i].type=="checkbox" && cElem[i].id!=cBox.id)
        {
            if(cElem[i].checked!=cEstado)
                cElem[i].click();
        }
}


//Muda cor da linha selecionada
function corLinhaSelecionada(chkCor, tipoLinha)
{ 
    if (chkCor.checked)
        chkCor.parentElement.parentElement.style.backgroundColor='#EEF5FB';
    else
    {
        if (tipoLinha=='0')
            chkCor.parentElement.parentElement.style.backgroundColor='#FFFFFF'; 
        else 
            chkCor.parentElement.parentElement.style.backgroundColor='#EAEAEA'; 
    }
}
//*******************************************************************************************************


function pergunta(strQ)
{
    return confirm(strQ);
}

//*******************************************************************************************************
//Envia URL para o Itaú
function enviar(vDC,vAction){
    vJanela = window.open(vAction+'?DC='+vDC, 'SHOPLINE', 'toolbar=yes,menubar=yes,resizable=yes,status=no,scrollbars=yes,width=675,height=485');
    return false;
}

//*******************************************************************************************************
//Não permite colar o clipboard no campo
function disPaste(obj) {
   if (clipboardData.getData('Text').length > 0) {
      alert('Este campo deve ser digitado.');
      event.returnValue = false;
   }
}

//*******************************************************************************************************
//Funções para chamada de AJAX
function iniAJAX(a) {
	//Acrescenta a url base com http
	url = "/inc/ajax/" + a;

	//Cria um novo elemento JS
	var jsel = document.createElement('SCRIPT');
	jsel.type = 'text/javascript';
	jsel.src = url;
	
	//Adiciona o elemento JS (portanto executando a chamada "AJAX)
	document.body.appendChild(jsel);
}
//*******************************************************************************************************


//*******************************************************************************************************
//Seleciona todos os radios da gridview
function selecionaRadios(frm)
{
    cElem=frm.elements;
    for(i=0;i<cElem.length;i++)
        if(cElem[i].type=="radio")
        {
            if(cElem[i].id.indexOf('_0') > 0) cElem[i].click();
        }
}

function ocultarDiv(a) {
    document.getElementById(a).style.visibility = "hidden";
}
        
function exibirDiv(a) {
    document.getElementById(a).style.visibility = "visible";
}
