// ---------------------------------------------- MILONIC --------------------------------------------- //
_meH=1;  // keyword for milonic
_menuCloseDelay=500           // The time delay for menus to remain visible on mouse out
_menuOpenDelay=150            // The time delay before menus open on mouse over
_followSpeed=50               // Follow scrolling speed
_followRate=50                // Follow scrolling Rate
_subOffsetTop=10               // Sub menu top offset
_subOffsetLeft=-10             // Sub menu left offset
_scrollAmount=3               // Only needed for Netscape 4.x
_scrollDelay=20               // Only needed for Netcsape 4.x

// ---------------------------------------------- HTML EDITOR --------------------------------------------- //

function doOpenHE(action){
	var id = window.top.frames.top2.document.getElementById("id");
	id.value = document.getElementById("id").value;
	var idHE = window.top.frames.top2.document.getElementById("idHE");
	idHE.value = document.getElementById("idHE").value;
	window.top.frames.top2.doOpenHE(action);	
}

function reloadPage(){
	window.focus();
	var idConteudo = window.top.frames.top2.getLocation();
	if ( idConteudo == null )
		window.location.reload(true);
	else{
		window.location.href = "/index.jsp?conteudo="+idConteudo;
	}
}

function gotoMenu(){
	window.location.href = "/siteadmin/menu.jsp";
}

function closePage(){
	window.top.frames.top2.closeEditor();
}

// ---------------------------------------------- MARQUEE --------------------------------------------- //

function stopMarquee(obj){
	obj.stop();
}

function playMarquee(obj){
	obj.start();
}

// ---------------------------------------------- MISC --------------------------------------------- //

	function on_load() {
		atualizaData();
	}
	
	function atualizaData() {
        c = document.getElementById("hoje");
        if (c != null) {
                c.innerHTML = '<table border="0" width="260"><tr><td align="right" nowrap><font color="#5F5E5E" size="1" face="Verdana, Arial, Helvetica, sans-serif">' + hoje() + '</font></td></tr></table>';
        }
	}

	function buildEnquete(x, numero){
	   var width = 520;
	   var height = 450;
	   
	   var left = 99;
	   var top = 99;   
	
	   var url = "/enquete/resultadoenquete.jsp?result=" ;
	   var ok = false;
	   for ( var i = 1; i <= numero; i ++ ){ 
			if ( document.getElementById(x + i).checked ){ 
				url += document.getElementById(x + i).value;
	  			ok = true; 
				break;
			}
	   }
	
	   if ( !ok ){
			alert("Você tem que escolher uma opção");
			return ;
	   }
	
	   window.open(url, 'Enquete', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
	}


	function openWindow(url){
	   var width = 569;
	   var height = 450;
	   
	   var left = 99;
	   var top = 55;   
	
	   window.open(url, 'Programas', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=yes, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
	}
	
	function img_on(img){
		oimg=gmobj(img);
		oimg.src="/images/"+img+"_over.gif";
	}
	
	function img_off(img){
		oimg=gmobj(img)
		oimg.src="/images/"+img+".gif"
	}
	
	function m_over(obj, img) {
		obj.src = "img/"+img+"on.jpg";
	}

	function m_out(obj, img) {
		obj.src = "img/"+img+"off.jpg";
	}	
	
	function hoje() {
	
	var day="";
	var month="";
	var myweekday="";
	var year="";
	newdate = new Date();
	mydate = new Date();
	dston =  new Date('April 4, 1999 2:59:59');
	dstoff = new Date('october 31, 1999 2:59:59');
	var myzone = newdate.getTimezoneOffset();
	newtime=newdate.getTime();
	
	var zone = 6;  // references your time zone
	
	if (newdate > dston && newdate < dstoff ) {
	zonea = zone - 1 ;
	dst = "  Pacific Daylight Savings Time";
	}
	else {
	zonea = zone ; dst = " Horï¿½rio de Brasï¿½lia - Brasil";
	}
	var newzone = (zonea*30*30*1000);
	newtimea = newtime+(myzone*30*1000)-newzone;
	mydate.setTime(newtimea);
	myday = mydate.getDay();
	mymonth = mydate.getMonth();
	myweekday= mydate.getDate();
	myyear= mydate.getYear();
	year = myyear;
	
	if (year < 2000)    // Y2K Fix, Isaac Powell
	year = year + 1900; // http://onyx.idbsu.edu/~ipowell
	myhours = mydate.getHours();
	if (myhours >= 12) {
	myhours = (myhours == 12) ? 12 : myhours - 12; mm = " ";
	}
	else {
	myhours = (myhours == 0) ? 12 : myhours; mm = " ";
	}
	myminutes = mydate.getMinutes();
	if (myminutes < 10){
	mytime = ":0" + myminutes;
	}
	else {
	mytime = ":" + myminutes;
	};
	arday = new Array("Domingo"," Segunda-feira","Ter&ccedil;a-feira","Quarta-feira","Quinta-feira","Sexta-feira","S&aacute;bado")
	armonth = new Array("janeiro ","fevereiro","mar&ccedil;o ","abril ","maio","junho ","julho","agosto ","setembro ", "outubro ","novembro ","dezembro ")

	var cHoje = ( arday[myday] +", " + myweekday + " de " + armonth[mymonth] + " de " + year);
	
	return cHoje;
	}

// ---------------------------------------------- SWAP - IMAGE --------------------------------------------- //
	
	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);
	
	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.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_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_showHideLayers() { //v3.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_goToURL() { //v3.0
	  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
	  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
	}

				// ----------- SETTINGS ----------- //


			// Speed Settings //
			var pausetime = 4000;		// Pause Length (milliseconds).
			var msginc = 30;		// The number of increments for each transition (lower = faster). 
			var interval = 5;		// Interval between movment steps (milliseconds - less is faster & smoother).
			var ppat = new Array();		// Pause pattern. List pause lengths for each message in milliseconds, eg (2500,0,1000).
			var ipat = new Array();		// Increment pattern. List the number of steps for the transition of each message, eg (20,1,40).
			var wraptime = false;		// Prevent resetting speed patterns.

			// Direction Settings //
			var direction = 'up';		// Direction: 'up', 'down', 'left', 'right', and combos such as 'downleftright', 'rand', 'prand', 'xrand', 'pattern', 'dpattern', 'wpattern' (see below).
			var dpat = new Array('left','left','left','left');		// For direction setting 'pattern', 'prand' and 'xrand' only.

			// Transition Settings //
			var transition = 'contig';	// Transition method: 'contig', 'cover', 'uncover', 'wipe', 'unwipe', 'coverwipe', 'uncoverwipe', 'rand', 'prand', 'xrand', 'pattern', 'dpattern', 'wpattern' (see below).
			var tpat = new Array('cover','uncover','contig');		// For transition setting 'pattern', 'dpattern', 'wpattern', 'prand' and 'xrand' only.

			// Colour Settings //
			var bgcolor = 'pattern';	// Background colour of the marquee and messages eg '#0099FF', 'white' or 'images/myimage.jpg'.
			var cpat = new Array('');	// Background colour pattern: List the background colour for each maessage.

			// Advanced //
			var mhalign = 'center';		// Horizontal alignment setting for TD container.
			var mvalign = 'middle';		// Vertical alignment setting for TD container.
			var csspat = new Array();	// List CSS Classes for each message TD container - default 'mrqtd' (TD.mrqtd).

			// Opera Position Adjustment - set these two variables to match CSS margins (if used - otherwise 5 is normal). //
			var dispv = 5;			// Top margin in pixels.
			var disph = 5;			// Left margin in pixels.

			// Bottom-Right Netscape Saftey //
			var nsafe = false;		// Evade direction/transition combos that cause scrollbar pop-up in NS.

			// Message Dump //
			mdump = true;
			dumptest = false;