function MM_reloadPage(init)
{
  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);

//
function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}

// Para aparecer a chavinha...
function showHideLayers()
{ 
  var i, visStr, obj, args = showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3)
  {
    if ((obj = findObj(args[i])) != null)
    {
      visStr = args[i+2];
      if (obj.style)
      {
        obj = obj.style;
        if(visStr == 'show') visStr = 'visible';
        else if(visStr == 'hide') visStr = 'hidden';
      }
      obj.visibility = visStr;
    }
  }
}


// Novas funções para colocação de um iframe atrás do menu
// para resolver o problema da sobreposição dos checkbox.
function showHideLayersSub(objeto, opcao, iframe)
{
	var DivRef = document.getElementById(objeto);
	var IfrRef = document.getElementById(iframe);
	if(opcao == 'show')
	{
		DivRef.style.visibility = 'visible';
	}
	else if(opcao == 'hide')
	{
		DivRef.style.visibility = 'hidden';
	}
}

function showHideLayersMenu(objeto, opcao, iframe)
{ 
	var DivRef = document.getElementById(objeto);
	var IfrRef = document.getElementById(iframe);

	if(opcao == 'show')
	{
		DivRef.style.zIndex = 99999;
		IfrRef.style.zIndex = 99998;

		IfrRef.style.top = DivRef.style.top;
		IfrRef.style.left = DivRef.style.left;
		IfrRef.style.width = DivRef.offsetWidth;
		IfrRef.style.height = DivRef.offsetHeight;
	
		IfrRef.style.display = "block";
		DivRef.style.visibility = 'visible';
		DivRef.style.display = "block";
	}	 
	else
	{
		DivRef.style.visibility = 'hidden';
		DivRef.style.display = "none";
		IfrRef.style.display = "none";
	}
}




function preloadImages()
{
  if(document.images)
  {
    if(!document.imageArray) document.imageArray = new Array();
    var i,j = document.imageArray.length, args = preloadImages.arguments;
    
    for(i=0; i<args.length; i++)
    {
      if (args[i].indexOf("#")!=0)
      {
        document.imageArray[j] = new Image;
        document.imageArray[j++].src = args[i];
      }
    }
  }
}
//
function disableRightClick(e)
{
  var message = "   www.ricarela.com\n\nricarela@ricarela.com";
  
  if(!document.rightClickDisabled) // initialize
  {
    if(document.layers) 
    {
      document.captureEvents(Event.MOUSEDOWN);
      document.onmousedown = disableRightClick;
    }
    else document.oncontextmenu = disableRightClick;
    return document.rightClickDisabled = true;
  }
  if(document.layers || (document.getElementById && !document.all))
  {
    if (e.which==2||e.which==3)
    {
      alert(message);
      return false;
    }
  }
  else
  {
    alert(message);
    return false;
  }
}
disableRightClick();
//
//
function browserRedirect()
{
  var ns4 = document.layers;
  var ns6 = document.getElementById && !document.all;
  var ie4 = document.all;
  
  if(ns4) URLStr = "ASP/browser_nao_suportado.asp";
  else if(ns6) URLStr = "ASP/browser_nao_suportado.asp";
  else if(ie4) URLStr = "#";
  else URLStr = "default.asp";
  location = URLStr;
}
//browserRedirect();
//
//
function browserVer4Detect()
{
  if(navigator.appVersion.substring(0,1) < 4)
    URLStr = "ASP/browser_nao_suportado.asp";
  else
    URLStr = "#";
  window.location = URLStr;
}

//browserVer4Detect();

//------------------------------------------------------------------------------------------// Retorna a data por extenso
//------------------------------------------------------------------------------------------
function Hoje()
{
var agora = new Date();
var anoN = agora.getYear()
var mesN = agora.getMonth() + 1;
var diaN = agora.getDay() + 1;
var diaNr = ((agora.getDate()<10) ? "0" : "")+ agora.getDate();
if(diaN==1) dia = "Domingo";
if(diaN==2) dia = "Segunda-feira";
if(diaN==3) dia = "Terça-feira";
if(diaN==4) dia = "Quarta-feira";
if(diaN==5) dia = "Quinta-feira";
if(diaN==6) dia = "Sexta-feira";
if(diaN==7) dia = "Sábado";
if(mesN==1) mes="Janeiro";
if(mesN==2) mes="Fevereiro";
if(mesN==3) mes="Março";
if(mesN==4) mes="Abril";
if(mesN==5) mes="Maio";
if(mesN==6) mes="Junho";
if(mesN==7) mes="Julho";
if(mesN==8) mes="Agosto";
if(mesN==9) mes="Setembro";
if(mesN==10) mes="Outubro";
if(mesN==11) mes="Novembro";
if(mesN==12) mes="Dezembro";
document.write (" "+dia+", "+diaNr+" de "+mes+" de "+anoN);
}


//------------------------------------------------------------------------------------------// Limpa o input ao clicar
//------------------------------------------------------------------------------------------

function clearText(thefield) {
	if (thefield.defaultValue==thefield.value) { thefield.value = ""; }
}



function na_open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable, codigo)
{
toolbar_str = toolbar ? 'yes' : 'no';
menubar_str = menubar ? 'yes' : 'no';
statusbar_str = statusbar ? 'yes' : 'no';
scrollbar_str = scrollbar ? 'yes' : 'no';
resizable_str = resizable ? 'yes' : 'no';
//codigo == <%="& codigo &"%>;
// Manter o comando abaixo na mesma linha
window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+', menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
//
}

function pop() { 
semx=window.open("","","status=no, toolbar=no, scrollbars=yes, menubar=no");self.focus();semx.resizeTo(750,600);semx.moveTo(50,50);semx.location="_sAdmin/default.asp";
}

function mail() { 
	window.open('http://10.8.81.1/inc/emailregras.asp','','height=400,width=500,location=no,menubar=no,resizable=no,status=no,toolbar=no');
}

