function linke(url){
myAjax = new parent.Ajax.Updater('cont','inc.'+url+'.php',{onLoading:fcarregando,onComplete:fcarrega});
}

function linke2(odiv, url){
myAjax = new Ajax.Updater(odiv,url);
}

function buscasel(acol, col, val){
linke2('col'+col, '/inc.bbp.'+col+'.php?'+acol+'='+val);
}

function AL(id){
tot=18;
for(i=1; i<=tot; i++){
parent.document.getElementById('l'+i).style.textDecoration='none';
}
parent.document.getElementById(id).style.textDecoration='underline';
for(i=1; i<=tot; i++){
pli=id.split('l');
pli=pli[1];
if(i!=pli){
parent.document.getElementById('l'+i).style.textDecoration='';
}
}
}

function fcarregando(){
document.getElementById("icrr").innerHTML="<img src=\"imgs/ict.gif\" width=\"69\" height=\"17\" border=\"0\">";
}
function scarregou(){
document.getElementById("icrr").innerHTML="<img src=\"imgs/icc.gif\" width=\"69\" height=\"17\" border=\"0\">";
}
function fcarrega(){
scarregou();
setTimeout("scarregou()", 100);
setTimeout("scarregou()", 1000);
setTimeout("scarregou()", 2000);
}


function abredes(imagem, altura, larg, tit){
ami = document.getElementById('amini').style;
ami.display="block";
ami.height=altura;
alti=altura-140;
//document.body.style.display='none';
document.getElementById('tudo').style.display='none';
document.getElementById('amini').innerHTML='<div align="center" style="margin-top:25px;cursor:default;"><table border="0" cellspacing="0" cellpadding="0"><tr><td bgcolor="#333333" align="right"><img src="imgs/bf.gif" style="cursor:pointer"></td></tr><tr><td style="font-weight:bold;color:#FFF;text-align:center;">'+tit+'</td></tr><tr><td style="background:#FFFFFF url(\'imgs/fc.gif\');border:10px solid #FFFFFF;cursor:pointer;"><img border="0" src="fotos/g_'+imagem+'" height="'+alti+'" width="'+larg+'"></td></tr><tr><td bgcolor="#333333" align="right"><img src="imgs/bf.gif" style="cursor:pointer"></td></tr></table></div>';
document.location='#';
}

function fechades(){
ami = document.getElementById('amini').style;
ami.display="none";
document.getElementById('tudo').style.display='inline';
}

function FormataValor(campo,tammax,teclapres)
 {
  //uso:
 //<input type="Text" name="preco" maxlength="17" onKeyDown="FormataValor(this,17,event)">
 var tecla = teclapres.keyCode;
 vr = campo.value;
 vr = vr.replace( "/", "" );
 vr = vr.replace( "/", "" );
 vr = vr.replace( ",", "" );
 vr = vr.replace( ".", "" );
 vr = vr.replace( ".", "" );
 vr = vr.replace( ".", "" );
 vr = vr.replace( ".", "" );
 tam = vr.length;
 if (tam < tammax && tecla != 8){ tam = vr.length + 1 ; }
 if (tecla == 8 ){ tam = tam - 1 ; }
  
 if ( tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 ){
  if ( tam <= 2 ){
    campo.value = vr ; }
   if ( (tam > 2) && (tam <= 5) ){
    campo.value = vr.substr( 0, tam - 2 ) + ',' + vr.substr( tam - 2, tam ) ; }
   if ( (tam >= 6) && (tam <= 8) ){
    campo.value = vr.substr( 0, tam - 5 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ; }
   if ( (tam >= 9) && (tam <= 11) ){
    campo.value = vr.substr( 0, tam - 8 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ; }
   if ( (tam >= 12) && (tam <= 14) ){
    campo.value = vr.substr( 0, tam - 11 ) + '.' + vr.substr( tam - 11, 3 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ; }
   if ( (tam >= 15) && (tam <= 17) ){
    campo.value = vr.substr( 0, tam - 14 ) + '.' + vr.substr( tam - 14, 3 ) + '.' + vr.substr( tam - 11, 3 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ;}
 }   
}

function mF(ft){
document.getElementById('exft').innerHTML='<img src="http://www.grupomrsp.com.br/fotos/g_'+ft+'">';
}

function suporte() {
window.open('suporte/suporte.php', '', 'top=150,left=400,width=400,height=450,resizable=0,scrollbars=1');
}

function cadastrar_news(){
f=document.cadastro_news;
 if ((f.news_nome.value == '') || (f.news_email.value == '')  ||  (f.news_email.value.indexOf("@")==-1)  || (f.news_email.value.indexOf(".")==-1) || (f.news_email.value.indexOf(",")==1) || (f.news_email.value.indexOf(";")==1) || (f.news_email.value.length < 6)){
  alert("Preencha corretamente todos os campos...");
	return false
	
} else {
CNL = window.open('','CNL','toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,height=380,width=350,top=0,left=0');
f.action="news.php?add";
f.submit();
f.reset();

} 
}