/* =====================================================*/
/* == Menu ==*/

function mudacelula(obj, borda,fundo) {
	var obj;
	if(navigator.appName.indexOf("Netscape") != -1) {
		obj = eval('document.' + obj);
	}
	else {
		obj = eval(obj + '.style');
	}
	obj.borderLeftColor = borda;
	obj.borderBottomColor = borda;
	obj.borderRightColor = borda;
	obj.borderTopColor = borda;
	obj.backgroundColor = fundo;
}
/* == Fim MENU ==*/

	var dragswitch=0 
	var nsx
	var nsy
	var nstemp
	
/* Função para OnChange do Combo */	
function mudaPagina( pagina ) {
		if ( pagina != "" )
			document.location = pagina;
	}
/*================================*/

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_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;
}

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 drag_dropns(name){
	temp=eval(name)
	temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
	temp.onmousedown=gons
	temp.onmousemove=dragns
	temp.onmouseup=stopns 
	}
	
function gons(e){
	temp.captureEvents(Event.MOUSEMOVE)
	nsx=e.x
	nsy=e.y
  	}
	
function dragns(e){
	if (dragswitch==1){
	temp.moveBy(e.x-nsx,e.y-nsy)
	return false 
	}
	}
	
function stopns(){
	temp.releaseEvents(Event.MOUSEMOVE)}
	var dragapproved=false
	
function drag_dropie(){
	if (dragapproved==true){
	document.all.showimage.style.pixelLeft=tempx+event.clientX-iex
	document.all.showimage.style.pixelTop=tempy+event.clientY-iey
	return false
	}
	}
	
function initializedragie(){
	iex=event.clientX
	iey=event.clientY
	tempx=showimage.style.pixelLeft
	tempy=showimage.style.pixelTop
	dragapproved=true
	document.onmousemove=drag_dropie
	}
		if (document.all){
		document.onmouseup=new Function("dragapproved=false") 
	}
		
function hidebox(){
	if (document.all)
	showimage.style.visibility="hidden"
		else if (document.layers)
		document.showimage.visibility="hide"
	}
	
function showbox(){
	if (document.all)
	showimage.style.visibility="visible"
		else if (document.layers)
		document.showimage.visibility="show"
	}
	
function AVISA(msg) { 
	alert(msg);
	}

function envia_username(){
	var valor;
	valor= document.Form1.txtlogin.value;
	location.href='intranet.aspx?username=' + document.Form1.txtlogin.value;
	}
	
function limpacampo(campo){
	campo.value=""
	}
	

// == Exibe RELÓGIO == //
function showtime()
	{	
		 if 
		 (
			!document.layers&&!document.all)
			 return
			 var Digital=new Date()
			 var hours=Digital.getHours()
			 var minutes=Digital.getMinutes()
			 var seconds=Digital.getSeconds()
			 var dn="AM" 
			 if (hours>12){
			 dn="PM"
			 hours=hours-12
		 }
 		if (hours==0)
 			hours=12
 			if (minutes<=9)
				 minutes="0"+minutes
 					if (seconds<=9)
 						seconds="0"+seconds
						//change font size here to your desire
						myclock="<font size='2' face='verdana' ><b><font size='1'>Hora atual:&nbsp;</font>"+hours+":"+minutes+":"
									 +seconds+" "+dn+"</b></font>"
						if (document.layers)
						{
								document.layers.liveclock.document.write(myclock)
								document.layers.liveclock.document.close()
						}
						else if (document.all)
						liveclock.innerHTML=myclock
						setTimeout("showtime()",1000)
 }
// == FIM » Exibe RELÓGIO == //

// == utilizado para criar scroll personalizado == //
var myTime;
var myActive;
myActive = 1;
function scrollUp(){
   layertexto.window.scrollBy(0,-2);
   myTime = setTimeout('scrollUp()', 5);
}

function scrollDown(){
   layertexto.window.scrollBy(0,2);
   myTime = setTimeout('scrollDown()', 5);
}
// » COMO USAR 
// SETA DE CIMA
// <area shape="CIRCLE" coords="7,7,6" href="#" onmouseup="clearTimeout(myTime)" onMouseOver="scrollUp()" onmouseout="clearTimeout(myTime)">
			
//SETA DE BAIXO
// <area shape="CIRCLE" coords="7,109,6" href="#" onmouseup="clearTimeout(myTime)" onMouseOver="scrollDown()" onmouseout="clearTimeout(myTime)">
// FIM » COMO USAR //

function display0(a){if(a==0){document.getElementById('a').style.display='';}if(a==1){document.getElementById('a').style.display='none';}}
function display1(b){if(b==0){document.getElementById('b').style.display='';}if(b==1){document.getElementById('b').style.display='none';}}
function display2(c){if(c==0){document.getElementById('c').style.display='';}if(c==1){document.getElementById('c').style.display='none';}}
function display3(d){if(d==0){document.getElementById('d').style.display='';}if(d==1){document.getElementById('d').style.display='none';}}
function display4(e){if(e==0){document.getElementById('e').style.display='';}if(e==1){document.getElementById('e').style.display='none';}}
function display5(f){if(f==0){document.getElementById('f').style.display='';}if(f==1){document.getElementById('f').style.display='none';}}


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; }
}
