function esconde(divID) {
variavel = divID;
MM_showHideLayers(variavel,'','hide')
} 

// FUNCAO ABRIR JANELAS
function MM_openBrWindow(theURL,winName,features){
  window.open(theURL,winName,features);}

// FUNCAO ABRIR JANELAS
function ABRIR(theURL,winName,features){
  window.open(theURL,winName,features);}

//FUNCAO FECHAR JANELAS
function FECHAR(){
window.close();}

//FUNCAO IMPRIMIR
function IMPRIMIR(theURL){
window.print("theURL");}


//FUNCAO LER PAGINA
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

//FUNCAO FINALIZAR LEITURA PAGINA
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;
}

//FUNCAO BANNER FLASH
function objectSwf(swf,width,height) {
	document.write('<object type="application/x-shockwave-flash" width="' + width + '" height="' + height + '" data="' + swf + '">');
	document.write('<param name="movie" value="' + swf + '" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="menu" value="false" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<embed src="' + swf + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '" wmode="transparent"></embed>');
	document.write('</object>');
}

function objectYoutube(swf,width,height) {
	document.write('<object type="application/x-shockwave-flash" width="' + width + '" height="' + height + '" data="' + swf + '">');
	document.write('<param name="movie" value="' + swf + '" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="menu" value="false" />');
	document.write('<param name="wmode" value="transparent" />');	
	document.write('<embed src="' + swf + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '" wmode="transparent"></embed>');
	document.write('</object>');
}


function validaForm(formulario){

for(i=0;i<=formulario.length-1;i++){
	if ((formulario[i].type=="textarea")||(formulario[i].type=="file")||(formulario[i].type=="hidden")||(formulario[i].type=="text")||(formulario[i].type=="password")){
		if ((formulario[i].wmsg!="")&&(formulario[i].wmsg!=undefined)){
			if (formulario[i].email=="sim"){
				if((formulario[i].value=="")||(formulario[i].value.indexOf('@')==-1)||(formulario[i].value.indexOf('.')==-1)){
					alert(formulario[i].wmsg);
					try{
						formulario[i].focus();
					}
					catch(e){
						}				
				    return false
				}	
			}else{
				if(formulario[i].value==""){
					alert(formulario[i].wmsg);
					try{
						formulario[i].focus();
					}
					catch(e){

						}
				
					return false
				}
			}
		}
	}	
}
//Olá bem vindo ao meu artigo nele vou explicar como fazer uma validação inteligente de formulário, 
}

function Rotaciona(){
	wBanner= Math.random() * 100;
	if((wBanner>0) && (wBanner<50)){
	document.write('<iframe id=\"iFrameNews\" name=\"banners\" src=\"banner_inicial.php\" width=\"420\" height=\"260\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" frameborder=\"0\" allowtransparency=\"yes\"></iframe>');	
	wBanner= Math.random() * 100;
	} else {
	document.write('<iframe id=\"iFrameNews\" name=\"adote\" src=\"adote_inicial.php\" width=\"420\" height=\"260\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" frameborder=\"0\" allowtransparency=\"yes\"></iframe>');
	wBanner= Math.random() * 100;
	}
}

function Rotacionab(){
	wBannerb= Math.random() * 100;
	if((wBannerb>0) && (wBannerb<20)){
	document.write('<script type=\"text/javascript\">objectSwf(\'images/banner.swf\',420,260);</script>');
	wBannerb= Math.random() * 100;
	} else if ((wBannerb>21) && (wBannerb<40)){
	document.write('<script type=\"text/javascript\">objectSwf(\'images/banner2.swf\',420,260);</script>');
	wBannerb= Math.random() * 100;
	} else if ((wBannerb>41) && (wBannerb<60)){
	document.write('<script type=\"text/javascript\">objectSwf(\'images/banner3.swf\',420,260);</script>');
	wBannerb= Math.random() * 100;
	} else if ((wBannerb>61) && (wBannerb<80)){
	document.write('<script type=\"text/javascript\">objectSwf(\'images/banner4.swf\',420,260);</script>');
	wBannerb= Math.random() * 100;
	} else {
	document.write('<iframe id=\"iFrameNews\" name=\"adote\" src=\"adote_inicial.php\" width=\"420\" height=\"260\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" frameborder=\"0\" allowtransparency=\"yes\"></iframe>');
	wBanner= Math.random() * 100;	
	}
}





var horizontal_offset="0px" 
var vertical_offset="0" 
var ie=document.all 
var ns6=document.getElementById&&!document.all 

function getposOffset(what, offsettype){ 
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop; 
var parentEl=what.offsetParent; 
while (parentEl!=null){ 
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop; 
parentEl=parentEl.offsetParent; 
} 
return totaloffset; 
} 

function iecompattest(){ 
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body 
} 

function clearbrowseredge(obj, whichedge){ 
var edgeoffset=(whichedge=="rightedge")? parseInt(horizontal_offset)*-1 : parseInt(vertical_offset)*-1 
if (whichedge=="rightedge"){ 
var windowedge=ie && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-30 : window.pageXOffset+window.innerWidth-40 
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth 
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure) 
edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth+parseInt(horizontal_offset) 
} 
else{ 
var windowedge=ie && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18 
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight 
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure) 
edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight 
} 
return edgeoffset 
} 

function showhint(menucontents, obj, e, tipwidth){ 
if ((ie||ns6) && document.getElementById("linkbox")){ 
dropmenuobj=document.getElementById("linkbox") 
dropmenuobj.innerHTML=menucontents 
dropmenuobj.style.left=dropmenuobj.style.top=-500 
if (tipwidth!=""){ 
dropmenuobj.widthobj=dropmenuobj.style 
dropmenuobj.widthobj.width=tipwidth 
} 
dropmenuobj.x=getposOffset(obj, "left") 
dropmenuobj.y=getposOffset(obj, "top") 
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+"px" 
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px" 
dropmenuobj.style.visibility="visible" 
obj.onmouseout=hidetip 
} 
} 

function hidetip(e){ 
dropmenuobj.style.visibility="hidden" 
dropmenuobj.style.left="-500px" 
} 

function createlinkbox(){ 
var divblock=document.createElement("div") 
divblock.setAttribute("id", "linkbox") 
document.body.appendChild(divblock) 
} 

if (window.addEventListener) 
window.addEventListener("load", createlinkbox, false) 
else if (window.attachEvent) 
window.attachEvent("onload", createlinkbox) 
else if (document.getElementById) 
window.onload=createlinkbox 