// Funcoes
		function MascaraMoeda(objTextBox, SeparadorMilesimo, SeparadorDecimal, e, valor){
			 if (valor.length > 9){
				return false;
			 }
			 var sep = 0;
			 var key = '';
			 var i = j = 0;
			 var len = len2 = 0;
			 var strCheck = '0123456789';
			 var aux = aux2 = '';
			 var whichCode = (window.Event) ? e.which : e.keyCode;
			 if (whichCode == 13) return true;
			 key = String.fromCharCode(whichCode); // Valor para o código da Chave
			 if (strCheck.indexOf(key) == -1) return false; // Chave inválida
			 len = objTextBox.value.length;
			 for(i = 0; i < len; i++)
				  if ((objTextBox.value.charAt(i) != '0') && (objTextBox.value.charAt(i) != SeparadorDecimal)) break;
			 aux = '';
			 for(; i < len; i++)
				  if (strCheck.indexOf(objTextBox.value.charAt(i))!=-1) aux += objTextBox.value.charAt(i);
			 aux += key;
			 len = aux.length;
			 if (len == 0) objTextBox.value = '';
			 if (len == 1) objTextBox.value = '0'+ SeparadorDecimal + '0' + aux;
			 if (len == 2) objTextBox.value = '0'+ SeparadorDecimal + aux;
			 if (len > 2) {
				  aux2 = '';
				  for (j = 0, i = len - 3; i >= 0; i--) {
						if (j == 3) {
							 aux2 += SeparadorMilesimo;
							 j = 0;
						}
						aux2 += aux.charAt(i);
						j++;
				  }
				  objTextBox.value = '';
				  len2 = aux2.length;
				  for (i = len2 - 1; i >= 0; i--)
				  objTextBox.value += aux2.charAt(i);
				  objTextBox.value += SeparadorDecimal + aux.substr(len - 2, len);
			 }
			 return false;
		}
	//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
	//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
	function bloquearCTRL(){
		var ctrl=window.event.ctrlKey;
		var tecla=window.event.keyCode;
		if (ctrl && tecla==67) {event.keyCode=0; event.returnValue=false;}
		if (ctrl && tecla==86) {event.keyCode=0; event.returnValue=false;}
	}
function login(){

var usuario = document.getElementById('usuario');

var senha = document.getElementById('senha');
if(usuario.value!=''){
	if(senha.value!=''){
		document.login.submit();
		document.login.reset();
	}else{
		alert('Por favor, entre com uma senha         \n\n\n');
		senha.focus();
	}	
}else{
	alert('Por favor, entre com usuário         \n\n\n');
	usuario.focus();
}



}

function hidetrail(){ 
document.getElementById('banners').style.display= "none";
}

function swf($arquivo,$largura,$altura,$title)
{
	document.writeln('<object type="application/x-shockwave-flash" data="' + $arquivo + '" width="' + $largura + '" height="' + $altura + '" title="' + $title + '">');
	document.writeln('<param name="movie" value="flash/' + $arquivo + '">');
	document.writeln('<param name="wmode" value="transparent">');
	document.writeln('<param name="menu" value="false">');
	document.writeln('<param name="quality" value="high">');
	document.writeln('</object>');
}

function open_popup(pagina) {
 window.open(pagina, 'open_popup', 'width=600, height=500, top=100, left=100'); 
} 
function trSetColor(linha,cor)
{
	if ( cor == '' || typeof(linha.style) == 'undefined') {
        return false;
    }
    if (typeof(document.getElementsByTagName) != 'undefined') {
        var celulas = linha.getElementsByTagName('td');
    }
    else if (typeof(linha.cells) != 'undefined') {
        var celulas = linha.cells;
    }
    else {
        return false;
    }

    var celulas_count  = celulas.length;
    for (var c = 0; c < celulas_count; c++) {
        celulas[c].style.backgroundColor = cor;
    }
    return true;
}


function indique() {
 var top_indique = "/imagens/recomende_topo.jpg"
 window.open('/js/indicar/indique.php?url='+document.location.href+'&topo='+top_indique+'', 'Indicar', 'width=340, height=312, top=100, left=100'); 
} 



function changeColor(objDiv,css1,css2){
	if(objDiv.className == css1){	
	
		objDiv.className=css2;
	
	}else{
		objDiv.className=css1;
	}
}

function changeColor_not(objDiv){
	if(objDiv.className == 'fontMenuOver_not'){	
		objDiv.className='fontMenu_not';
	}else{
		objDiv.className='fontMenuOver_not';
	}
}

function changeColor_menu(objDiv){
	if(objDiv.className == 'fontMenuOver_menu'){	
		objDiv.className='fontMenu_menu';
	}else{
		objDiv.className='fontMenuOver_menu';
	}
}



function printer(div){

 conte=document.getElementById(div).innerHTML;

 

 pop=window.open("","print","width=670,height=500,scrollbars=1");
pop.document.write('<script language="javascript" src="../ajax.js"></script>');
 pop.document.write('<link href="css/estrutura.css" rel="stylesheet"/>');


 pop.document.write('<body leftmargin=0 topmargin=0 rightmargin=0 bottommargin=0>');

 pop.document.write('<center><table bgcolor=#ffffff><tr><td><img src=imagens/print_topo.jpg></td></tr><tr><td>');

 pop.document.write('<div style="width:100%">');

 pop.document.write('<div>');



pop.document.write('<table style="WIDTH: 100%; HEIGHT: 40px" height="40" cellspacing="0" cellpadding="0" width="100%" border="0"><tbody><tr><td class="titulo_padrao" valign="center" align="left" background="imagens/estrutura/print_titulo.jpg" height="40" >');




 pop.document.write('</td></tr></table>');

 pop.document.write('</div>');
 pop.document.write('<div class="texto_padrao" >');
 pop.document.write(conte);
pop.document.write('</div>');

 pop.document.write('</div>');

 pop.document.write('</td></tr><tr><td><span style="cursor:pointer" onclick="window.print();"><font size=1 face=verdana>&nbsp;&nbsp;&nbsp;&nbsp;<br><div align="right"><img src="imagens/estrutura/bt_imprimir.gif"></div></font></span><br></td></tr></table></center></body>');

pop.document.close();

}


function switchMenu(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != "none" ) {
		el.style.display = 'none';
	}
	else {
		el.style.display = '';
	}
}

function abrefoto(imagem,nome)
{
	fotog.innerHTML = '<img src="'+imagem+'"  width=250 >';
}



function addSWF (URL, WIDTH, HEIGHT, TRANSPARENT)
{
document.write (' <object classid="clsid:27CDB6E-AE6D-11cf-96B8-444553540000" ');
document.write (' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" ');
document.write (' width="'+ WIDTH +'" height="'+ HEIGHT +'">');
document.write (' <param name="movie" value="'+ URL +'" />');
document.write (' <param name="quality" value="high" />');

if ( TRANSPARENT ) {
  document.write (' <param name="Wmode" value="Transparent" />'); 
}

document.write (' <embed src="'+ URL +'" quality="high" ');

if ( TRANSPARENT ) {
document.write (' Wmode = "transparent" ');
}

document.write (' pluginspage="http://www.macromedia.com/go/getflashplayer" ');
document.write (' type="application/x-shockwave-flash" width="'+ WIDTH +'" height="'+ HEIGHT +'"></embed> ');
document.write (' </object>');

}


function validar_grava() {
	if (document.forms.grava.usuario.value.length < 2){ 
	alert("Indique o nº do Cartão"); 
	document.forms.grava.usuario.focus(); 
	return false; 
	}   	
	

}

 function getsegmento(){
	var cid = document.getElementById("cidade").value;
    ajaxHTML("idsegmento","http://www.bonuscred.com.br/v2/scripts/getsegmento.php?cid=" + cid);
 }
 
function lista_seg() {
 var cid = document.getElementById("cidade").value;
 var id = document.getElementById("segmento").value;
 ajaxHTML("listaseg","http://www.bonuscred.com.br/v2/scripts/listasegmento.php?cid=" + cid + "&id="+ id);	
}

var newwindow;
function poptastic(url)
{
	windet=window.open(url,'BOTAO1','scrollbars=yes,height=464,width=657,top=270,left=100');
	if (window.focus) {newwindow.focus()}
}