function padrao()
{
	alert('Site em desenvolvimento.');	
}
function MM_preloadImages() {
  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 mnAltera(id,img)
{
	document.getElementById(id).src = img;
}

function servicos(id)
{
	cont=0
	divs=document.getElementsByTagName('div');
	contDivs=[];
	for(var i=0;i<divs.length;i++){
		if(divs[i].className != id)
		{
			if(divs[i].className != "")
			{
				divs[i].style.display = 'none';	
			}
		}
		else
		{
			divs[i].style.display = '';	
		}	
	}
}
function camposBusca(valor)
{
	if(valor == 'cpf')
	{
		document.getElementById('escreveBusca').innerHTML = '<input name="busca" type="text" maxlength="11" size="15" style="border:1px solid #666666;" onkeypress="return SomenteNumero(event);" />';
	}
	if(valor == 'nome')
	{
		document.getElementById('escreveBusca').innerHTML = '<input name="busca" type="text" maxlength="150" size="15" style="border:1px solid #666666;" />';
	}
}

function SomenteNumero(e){
    var tecla=(window.event)?event.keyCode:e.which;
    if((tecla > 47 && tecla < 58)) return true;
    else{
    if (tecla != 8) return false;
    else return true;
    }
}
function menuOver(valor){
	document.getElementById(valor).src = 'imgs/mn_'+valor+'_on.gif';
}
function menuOut(valor){
	document.getElementById(valor).src = 'imgs/mn_'+valor+'.gif';
}
function carregaFlash2(caminho,largura,altura)
{
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+largura+'" height="'+altura+'">');
	document.write('<param name="movie" value="'+caminho+'">');
	document.write('<param name="quality" value="high">');
	document.write('<param name="wmode" value="transparent">');
	document.write('<param name="menu" value="false">');
	document.write('<embed src="'+caminho+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" menu="false"  width="'+largura+'" height="'+altura+'"></embed>');
	document.write('</object>');
}
function carregaFlash(caminho,largura,altura,bgcolor)
{
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+largura+'" height="'+altura+'" align="middle"><param name="menu" value="false" /><param name="allowScriptAccess" value="always" /><param name="wmode" value="transparent" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+caminho+'" /><param name="quality" value="high" /><param name="bgcolor" value="'+bgcolor+'" /><embed src="'+caminho+'" quality="high" bgcolor="'+bgcolor+'" width="'+largura+'" height="'+altura+'" align="middle" allowScriptAccess="always" allowFullScreen="false" wmode="transparent" menu="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');
}


// VALIDAÇÕES DE FORMS
function validaremail(mail){
    var er = new RegExp(/^[A-Za-z0-9_\-\.]+@[A-Za-z0-9_\-\.]{2,}\.[A-Za-z0-9]{2,}(\.[A-Za-z0-9])?/);
    if(typeof(mail) == "string"){
        if(er.test(mail)){ return true; }
    }else if(typeof(mail) == "object"){
        if(er.test(mail.value)){
                    return true;
                }
    }else{
        return false;
        }
}


function valLogin(form){
	if(form.LGemail.value==''){
		alert('Preencha o campo E-MAIL.');
		form.LGemail.focus();
		return false;
	}
	else if(!validaremail(form.LGemail.value))
	{
		alert('E-MAIL inválido.');
		form.LGemail.focus();
		return false;
	}
	else if(form.LGsenha.value==''){
		alert('Preencha o campo SENHA.');
		form.LGsenha.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function formata(objeto, sMask, evtKeyPress) {  
	var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla;  
	if(document.all) { // Internet Explorer  
		nTecla = evtKeyPress.keyCode; 
	}else if(document.layers) { // Nestcape  
		nTecla = evtKeyPress.which;  
	}  
	sValue = objeto.value;  
   // Limpa todos os caracteres de formatação que  
   // já estiverem no campo.  
   sValue = sValue.toString().replace( "-", "" );  
   sValue = sValue.toString().replace( "-", "" );  
   sValue = sValue.toString().replace( ".", "" );  
   sValue = sValue.toString().replace( ".", "" );  
   sValue = sValue.toString().replace( "/", "" );  
   sValue = sValue.toString().replace( "/", "" );  
   sValue = sValue.toString().replace( ":", "" );  
   sValue = sValue.toString().replace( ":", "" );  
   sValue = sValue.toString().replace( "(", "" );  
   sValue = sValue.toString().replace( "(", "" );  
   sValue = sValue.toString().replace( ")", "" );  
   sValue = sValue.toString().replace( ")", "" );  
   sValue = sValue.toString().replace( " ", "" );  
   sValue = sValue.toString().replace( " ", "" );  
   fldLen = sValue.length;  
   mskLen = sMask.length;  
   i = 0;  
   nCount = 0;  
   sCod = "";  
   mskLen = fldLen;  
   while (i <= mskLen) {  
		bolMask = ((sMask.charAt(i) == "-") || (sMask.charAt(i) == ".") || (sMask.charAt(i) == "/") || (sMask.charAt(i) == ":"))  
		bolMask = bolMask || ((sMask.charAt(i) == "(") || (sMask.charAt(i) == ")") || (sMask.charAt(i) == " "))  
		if (bolMask) {  
		   sCod += sMask.charAt(i);  
		   mskLen++; 
		} else {  
		   sCod += sValue.charAt(nCount);  
		   nCount++;  
		}  
		i++;  
  }  
	objeto.value = sCod;  
	if (nTecla != 8) { // backspace  
		if (sMask.charAt(i-1) == "9") { // apenas números...  
			return ((nTecla > 47) && (nTecla < 58)); } // números de 0 a 9  
		else { // qualquer caracter...  
			return true;  
		}
	} else { return true;}  
} 
function vai()
{
	if(document.getElementById('senha1').value == 'Senha'){
		document.getElementById('senha1').value = '';
		document.getElementById('senha1').style.display = 'none';
		document.getElementById('senha').style.display = '';
		document.frmCliente.senha.focus();
	}
	else if(document.getElementById('senha1').value == '')
	{
		document.getElementById('senha1').style.display = '';
		document.getElementById('senha').style.display = 'none';
		document.getElementById('senha').value = '';
		document.getElementById('senha1').value = 'Senha';
	}
}

//CENTRALIZAR DIV POPUP
function centerVertically(objectID) 
{

	var thisObj = document.getElementById(objectID);
	var height = (window.innerHeight) ? window.innerHeight: document.documentElement.clientHeight;
	var objectHeight = parseInt(thisObj.style.height);
	var newLocation = (height - objectHeight) / 2;
	//thisObj.style.top = newLocation+'px';
	var vertical = (height-objectHeight)/2;
}
function centerHorizontally(objectID) 
{
	var thisObj = document.getElementById(objectID);
	var width = (window.innerWidth) ? window.innerWidth :   document.body.clientWidth;
	var objectWidth = parseInt(thisObj.style.width);
	var newLocation = (width - objectWidth) / 2;
	//thisObj.style.left = newLocation +'px';
	var horizontal = (width - objectWidth) / 2;
}
function MakeCenter()
{     
	centerHorizontally('trgtDiv');
	centerVertically('trgtDiv');
}
// FIM DIV POPUP