

function getURLParam(strParamName){
  var strReturn = "";
  var strHref = window.location.href;
  if ( strHref.indexOf("&") > -1 ){
    var strQueryString = strHref.substr(strHref.indexOf("&")).toLowerCase();
    var aQueryString = strQueryString.split("&");
    for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
      if (
aQueryString[iParam].indexOf(strParamName + "=") > -1 ){
        var aParam = aQueryString[iParam].split("=");
        strReturn = aParam[1];
        break;
      }
    }
  }
  return strReturn;
}



function objRightClick(camada){
		camada.style.top = event.y + document.body.scrollTop + 0;
		camada.style.left = event.x + document.body.scrollLeft + 15;
		mostra(camada);
}

function bodyClick(camada){
	if (camada.style.visibility == "visible")
		{camada.style.visibility = "hidden"}
	else
		{return false}
}

function showhide(what,what2){
var Open = ""
var Closed = ""

if(document.images){
	Open = new Image(7,9)    
	Closed = new Image(7,9)
	Open.src = "../imagens/seta_baixo.gif"
	Closed.src = "../imagens/seta_dir.gif"
}

if (what.style.display=='none'){
	what.style.display='';
	what2.src=Open.src
}
else{
what.style.display='none'
what2.src=Closed.src
}
}


function mudaClasse(obj,srv){ 
	obj.className = srv; 
} 


function mostraDiv(camada){
	if (camada.style.display == 'none')
		{camada.style.display = ''}
}


function escondeDiv(camada){
	if (camada.style.display == '')
		{camada.style.display = 'none'}
}


function trocaDiv(camada){
	if (camada.style.display == 'none')
		{camada.style.display = ''}
	else
		{camada.style.display = 'none'}
}


function troca(camada)
{
	if (camada.style.visibility == "hidden")
		{camada.style.visibility = "visible"}
	else
		{camada.style.visibility = "hidden"}
}


function mostra(camada)
{
	if (camada.style.visibility == "hidden")
		{camada.style.visibility = "visible"}
	else
		{return false}
}


function esconde(camada)
{
	if (camada.style.visibility == "visible")
		{camada.style.visibility = "hidden"}
	else
		{return false}
}



function mudaTamanho(id,tam)
{
	id.style.fontSize = tam + "px";
}



function displayWindow(theURL,winName,width,height,features) { //v3.1
// Made by Eddie Traversa modified from Macromedia Code
// http://nirvana.media3.net/

    var window_width = width;
    var window_height = height;
    var newfeatures= features;
    var window_top = (screen.height-window_height)/2;
    var window_left = (screen.width-window_width)/2;
    newWindow=window.open(''+ theURL + '',''+ winName + '','width=' + window_width + ',height=' + window_height + ',top=' + window_top + ',left=' + window_left + ',features=' + newfeatures + '');
    newWindow.focus();
}



function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}



function MM_displayStatusMsg(msgStr) //v1.0
{
  status=msgStr;
  document.MM_returnValue = true;
}




function MM_openBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) { //v3.0
  if(window.screen)if(isCenter)if(isCenter=="true"){
    var myLeft = (screen.width-myWidth)/2;
    var myTop = (screen.height-myHeight)/2;
    features+=(features!='')?',':'';
    features+=',left='+myLeft+',top='+myTop;
  }
  window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}


function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}


function MM_validateForm() { //alterada por francisco santos
  var i,p,q,t,nm,test,num,report,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; report=args[i+1]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@'); t=val.indexOf('.');
        if (p<1 || p==(val.length-1) || t<1 || val.length < 5) errors+='- '+report+' dever ser um endereço de email válido.\n';
      } else if (test.indexOf('telefone')!=-1) {
	  	if (isNaN(val))	{errors+='- '+report+' deve ser um Número!\n';
		} else if (val.length < 9 || val.length > 15)
			{errors+='- '+report+' deve ter entre 9 e 15 algarismos!\n'}
	  } else if (test!='R') {
        if (isNaN(val)) errors+='- '+report+' deve ser um Número.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (val<min || max<val) errors+='- '+report+' deve ser um Número entre '+min+' e '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+report+' é de preenchimento obrigatório.\n'; }
  } if (errors) {
  		alert('Ocorreram os seguintes erros:\n'+errors);
		document.MM_returnValue = (errors == '');
		return false;
	}
  document.MM_returnValue = (errors == '');
  return true;
}

function compara(pass1,pass2){
	if (pass1 != pass2)	{
	alert('Os campos Password são diferentes');
	return false;
	}
	return true;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  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 MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

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);

//script data e hora
function escreveData() {
	
	monthNames = new Array(12)
	monthNames[1] = "Janeiro";
	monthNames[2] = "Fevereiro";
	monthNames[3] = "Mar&ccedil;o";
	monthNames[4] = "Abril";
	monthNames[5] = "Maio";
	monthNames[6] = "Junho";
	monthNames[7] = "Julho";
	monthNames[8] = "Agosto";
	monthNames[9] = "Setembro";
	monthNames[10] = "Outubro";
	monthNames[11] = "Novembro";
	monthNames[12] = "Dezembro";
	
	
	
	monthday = new Array(7)
	monthday[1] = "Segunda";
	monthday[2] = "Ter&ccedil;a";
	monthday[3] = "Quarta";
	monthday[4] = "Quinta";
	monthday[5] = "Sexta";
	monthday[6] = "S&aacute;bado";
	monthday[7] = "Domingo";

	hoje = new Date();
	dia = hoje.getDate(); 
	
	dia = monthday[hoje.getDay()];
	dian = hoje.getDate();

	// comentar a linha debaixo se nao quiseremos mostrar o mês em número:
	mes = hoje.getMonth() + 1;
	// comentar a linha debaixo se nao quiseremos mostrar o mês por extenso:
	//mes = monthNames[hoje.getMonth() + 1];	
	ano = hoje.getFullYear();
	
	if (dia < 10) dia = "0" + dia;
	// comentar a linha debaixo se nao quiseremos mostrar o mês por extenso:
	if (mes < 10) mes = "0" + mes;
	//if (ano < 2000) ano = "19" + ano;
	//document.write (dia + ", " + dian + " de " + mes + " " + ano);
	document.write (dian + "." + mes + "." + ano);
}
function escreveHora() {
   agora = new Date();
   horas = agora.getHours(); 
   minutos = agora.getMinutes(); 
   if (horas < 10) horas= "0" + horas;
   if (minutos < 10) minutos = "0" + minutos;
   document.write(horas+":"+minutos+"");
}
function escreveAno() {
   agora = new Date();
   document.write(agora.getFullYear());
}
//fim script data e hora