﻿var appVer = navigator.appVersion.toLowerCase();
var iePos  = appVer.indexOf('msie');
var ffPos  = navigator.userAgent.toLowerCase().indexOf('firefox');
var ieVer = 0;
var podefscommand = "nao";
var iebug = false;
var ffbug = false;

if (iePos !=-1) {
	ieVer = parseFloat(appVer.substring(iePos+5,appVer.indexOf(';',iePos)));
	if(ieVer < 7) iebug = true;
	if(ieVer > 5.5) podefscommand = "sim";
}

function addEvent(obj, evType, fn, useCapture){
	if(obj.addEventListener){
		obj.addEventListener(evType, fn, useCapture);
		return true;
	} 
	else if (obj.attachEvent){
		var r = obj.attachEvent("on"+evType, fn);
		return r;
	}
}


/*////////  FLASH   //////////// */

function flash(movie, flashvars, width, height, retorna, swfid){
	if(!swfid)
	{
		swfid = movie.split("/");
		swfid = swfid[swfid.length-1].replace(".swf", "");
	}
	if(podefscommand)
	{ 
		flashvars += "&podefscommand=sim";
		document.write('<scr' + 'ipt for="' + swfid + '" event="FSCommand(funcao)">eval(funcao);</sc' + 'ript>');
	}
	strSWF= '<object id="' + swfid + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + width + '" height="' + height + '">'+
			'<param name="movie" value="' + movie + '">'+
			'<param name="quality" value="high">'+
			'<param name="menu" value="false">'+
			'<param name="wmode" value="transparent">'+
			'<param name="salign" value="LT">'+
			'<param name="FlashVars" value="' + flashvars + '">'+
			'<embed name="' + swfid + '" src="' + movie + '" width="' + width + '" height="' + height + '" salign="LT" flashvars="' + flashvars + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent"></embed>'+
			'</object>';
	if(!retorna) this.document.write(strSWF);
	else return(strSWF);
}


var tempo;

addEvent(window, "load", function()
{
	tempo = setTimeout(fechamenu, 100);
	
}, false);


function abremenu(){
	try 
	{	
		if(tempo) clearTimeout(tempo);
		document.getElementById("topo").style.clip = "rect(0 745px 600px 0)";
		document.getElementById("alinha").style.zIndex = 800;
	}
	catch(e){}
}

function fechamenu(){
	tempo = setTimeout(fechamenuAgora, 100);
}

function fechamenuAgora(){
	try 
	{
		document.getElementById("topo").style.clip = "rect(0 745px 60px 0)";
		document.getElementById("alinha").style.zIndex = 5;
	}
	catch(e){}
}

function slideDown(div){

	if($("#" + div).css("display")=="none") 
	{
		$("#" + div).slideDown("normal");
	} 
	else 
	{
		$("#" + div).slideUp("normal");
	}

}
