// JavaScript Document
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

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_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; 
	}
}

//Mostrar/ Esconder elementos da página
//Programação: Rodrigo Kaveski
//Ramal: 7070
//Empresa: Totvs SA
//15/03/2007
function showOneHideOthers(element){ 
	var fDiv = document.getElementsByTagName("*");
	var tDiv = new Array();
	var j = 0;
	for (i=0;i<fDiv.length;i++){
		if (fDiv[i].id.substr(0,3) == "hid"){
			tDiv[j] = fDiv[i].id;
			document.getElementById(tDiv[j]).style.display = "none";
			j++;
		}
	}
	document.getElementById(element).style.display = "block";
} 

//Forçar ActiveX no IE
//Programação: IVI CONCEPT - www.ivi-concept.com
//Customização: Rodrigo Kaveski
//Ramal: 7070
//Empresa: Totvs
//29/11/2006
function runSWF(archivo, ancho, alto, wmode, id, version, bgcolor, menu, FlashVars, quality, allowScriptAccess) { 
if(wmode!=""){
	var wmode_data=wmode;
}else{
	var wmode_data="transparent";
}
if(version!=""){
	var version_data=version;
}else{
	var version_data="6,0,0,0";
}
if(menu!=""){
	menu_data=menu;
}else{
	menu_data=false;
}
if(bgcolor!=""){
	var bgcolor_data=bgcolor;
}else{
	var bgcolor_data="#FFFFFF";
}
if(id!=""){
	id_data=id;
}else{
	id_data="flashMovie";
}
if(quality!=""){
	quality_data=quality;
}else{
	quality_data="high";
}
if(allowScriptAccess!=""){
	allowScriptAccess_data=allowScriptAccess;
}else{
	allowScriptAccess_data="always";
}
var quality="high";
 document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+version_data+'" width='+ancho+' height='+alto+' id='+id_data+'>\n');
 document.write('<param name="movie" value='+archivo+'>\n');
 document.write('<param name="allowScriptAccess" value='+allowScriptAccess_data+'>\n');
 document.write('<param name="quality" value='+quality_data+'>\n');
 document.write('<param name="wmode" value='+wmode_data+'>\n'); 
 document.write('<param name="FlashVars" value='+FlashVars+'>\n');
 document.write('<param name="bgcolor" value='+bgcolor_data+'>\n');
 document.write('<param name="menu" value='+menu_data+' >\n');
 document.write('<embed src='+archivo+' bgcolor='+bgcolor_data+' FlashVars='+FlashVars+' menu='+menu_data+' allowScriptAccess='+allowScriptAccess_data+' quality='+quality_data+' pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode='+wmode_data+' width='+ancho+' height='+alto+' swLiveConnect=true name='+id_data+'></embed>');
 document.write('</object>\n');
}


/* POP UP TOTVS */


	function ___fechaDiv(){document.getElementById("prepareSe").style.display='none';}
	
	function resizeDiv(){
		document.getElementById("divTotvs").style.height = document.body.clientHeight;
		document.getElementById("divTotvs").style.width = document.body.clientWidth;
		document.getElementById("iframeTotvs").style.height = document.body.clientHeight;
		document.getElementById("iframeTotvs").style.width = document.body.clientWidth;			
	}	
			
	var loc = String(document.location); 
	var allow = ["form.asp"];

	var allowed = 0;
		
	for (var a=0;a<allow.length; a++){
		if(loc.indexOf(allow[a])!=-1){
			allowed = 1;
		}
	}
	
	if(allowed != 1)	{					
		var popupContent = "<div id='divTotvs' style='position:absolute; top:0px; left:0px; width:100%; height:100%; z-index:20001; border:0px solid black'>";
		popupContent += "<iframe id='iframeTotvs' src='/__popup/divpopup.html' style='width:100%; height:100%;' frameborder='0' ";
		popupContent += "allowtransparency='true'></iframe></div>";
		document.write(popupContent);
		document.body.scroll = "no";
	} else {
		//alert("allowed");	
	}
