 // JavaScript Document
WebURL = document.location.href;
if(WebURL.indexOf('a1s0001')!=-1 || WebURL.indexOf('13521')!=-1){
	if(WebURL.indexOf('7')!=-1 || WebURL.indexOf('13521')!=-1){
		var rootSite = '/';
	}else{
		var rootSite = '/AGF/Reformulacao_Site_institucional/Tecnologia/Final/';
	}
}else{
	if(WebURL.indexOf('a1.com.br')!=-1){
		var rootSite = '/clientes/agf_novo/';
	}else{
		var rootSite = '/';
	}
}

//--- Matando o cache!
cacheKill = new Date().getTime();

function AbrePopup(l,a,url){
	NewWin  = new Date().getTime();
	var x = parseInt((screen.width-l)/2);
	var y = parseInt((screen.height-a)/2);
	window.open(url, NewWin, 'status=yes,resizable=no,scrollbars=auto,menubar=no,width='+l+',height='+a+',left='+x+',top='+y);
}

function AbrePopupScroll(l,a,url){
	NewWin  = new Date().getTime();
	var x = parseInt((screen.width-l)/2);
	var y = parseInt((screen.height-a)/2);
	var win = window.open(url, NewWin, 'status=yes,resizable=no,scrollbars=yes,menubar=no,width='+l+',height='+a);
	win.moveTo(x,y);
}

function OpenTitulo(h){
	if(h!='' && h == undefined){
		document.getElementById("TituloFlash").height=h;
		document.getElementById("TituloFlash2").height=h;
	}
}

function OpenMenu2(h){
	//alert(h);
	if(h!='' && h != null && h != 'undefined'){
		document.getElementById("DivFlashMenu2").style.height=parseInt(h)+20+'px';
		document.getElementById("Menu2a").height=parseInt(h)+20+'px';
	}else{
		if(h == 'undefined'){
			document.getElementById("DivFlashMenu2").style.height='300px';
			document.getElementById("Menu2a").height='300px';
		}
	}
}
function FlashTitulo(NomePagina){
	/*var titFlash = "";
	
	titFlash += '<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"555\" height=\"26\" id=\"TituloFlash\" align=\"middle\">';
	titFlash += '	<param name=\"allowScriptAccess\" value=\"sameDomain\">';
	titFlash += '	<param name=\"FlashVars\" value=\"link='+ NomePagina +'&rootSite='+rootSite+'\">';
	titFlash += '	<param name=\"movie\" value=\"'+rootSite+'includes/swf/titulo.swf?'+cacheKill+'\">';
	titFlash += '	<param name=\"quality\" value=\"high\">';
	titFlash += '	<param name=\"wmode\" value=\"transparent\">';
	titFlash += '	<param name=\"bgcolor\" value=\"#ffffff\">';
	titFlash += '	<embed src=\"'+rootSite+'includes/swf/titulo.swf?'+cacheKill+'\" quality=\"high\" bgcolor=\"#ffffff\" width=\"555\" height=\"26\" name=\"titulo\" id=\"TituloFlash2\" wmode=\"transparent\" flashvars=\"link='+NomePagina+'&rootSite='+rootSite+'\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\">';
	titFlash += '</object>';
	document.getElementById("DivFlashTitulo").innerHTML=titFlash;*/
	if(NomePagina.indexOf("%26") > -1){
		var newNamePage = NomePagina.replace('%26','&amp;');
		NomePagina = newNamePage;
	}
	document.getElementById("DivFlashTitulo").innerHTML= NomePagina;
}

function FlashMenu1(NomePagina, Nivel){
	var mnFlash1 = "";
	if(Nivel!='' || Nivel==null){NomePagina = Nivel;}
	mnFlash1 += '<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"770\" height=\"26\" id=\"titulo\" align=\"middle\">';
	mnFlash1 += '	<param name=\"allowScriptAccess\" value=\"sameDomain\">';
	mnFlash1 += '	<param name=\"FlashVars\" value=\"link='+NomePagina+'&rootSite='+rootSite+'\">';
	mnFlash1 += '	<param name=\"movie\" value=\"'+rootSite+'includes/swf/menu1.swf\">';
	mnFlash1 += '	<param name=\"quality\" value=\"high\">';
	mnFlash1 += '	<param name=\"wmode\" value=\"transparent\">';
	mnFlash1 += '	<param name=\"bgcolor\" value=\"#ffffff\">';
	mnFlash1 += '	<embed src=\"'+rootSite+'includes/swf/menu1.swf\" quality=\"high\" bgcolor=\"#ffffff\" width=\"770\" height=\"26\" name=\"titulo\" wmode=\"transparent\" flashvars=\"link='+NomePagina+'&rootSite='+rootSite+'\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\">';
	mnFlash1 += '</object>';
	document.getElementById("DivFlashMenu1").innerHTML= mnFlash1;
}

function FlashMenu2(NomePagina, Nivel){
	var mnFlash2 = "";
	
	if(Nivel!='' || Nivel==null){NomePagina = Nivel;}
	mnFlash2 += '<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"170\" height=\"300\" id=\"Menu2a\" align=\"middle\">';
	mnFlash2 += '	<param name=\"allowScriptAccess\" value=\"sameDomain\">';
	mnFlash2 += '	<param name=\"FlashVars\" value=\"link='+NomePagina+'&nivel='+Nivel+'&rootSite='+rootSite+'\">';
	mnFlash2 += '	<param name=\"movie\" value=\"'+rootSite+'includes/swf/menu2.swf?'+cacheKill+'\">';
	mnFlash2 += '	<param name=\"quality\" value=\"high\">';
	mnFlash2 += '	<param name=\"wmode\" value=\"transparent\">';
	mnFlash2 += '	<param name=\"bgcolor\" value=\"#ffffff\">';
	mnFlash2 += '	<embed src=\"'+rootSite+'includes/swf/menu2.swf?'+cacheKill+'\" quality=\"high\" bgcolor=\"#ffffff\" width=\"170\" height=\"300\" id=\"Menu2b\" wmode=\"transparent\" flashvars=\"link='+NomePagina+'&nivel='+Nivel+'&rootSite='+rootSite+'\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\">';
	mnFlash2 += '</object>';
	document.getElementById("DivFlashMenu2").innerHTML= mnFlash2;
}

function Header(endheader, tipoheader, heightHeader){
	var ImgHeader = "";
	var heightHeader = "245";
	if (tipoheader == "jpg") {
		if (heightHeader == "0"){
			ImgHeader += '<img src=\"' + rootSite + 'imagens/headers' + endheader + '\" width=\"654\" />';
		}else{
			ImgHeader += '<img src=\"' + rootSite + 'imagens/headers' + endheader + '\" width=\"654\" height=\"' + heightHeader + '" />';
		}
	}else if (tipoheader == "gif") {
		if (heightHeader == "0"){
			ImgHeader += '<img src=\"' + rootSite + 'imagens/headers' + endheader + '\" width=\"654\" />';
		}else{
			ImgHeader += '<img src=\"' + rootSite + 'imagens/headers' + endheader + '\" width=\"654\" height=\"' + heightHeader + '" />';
		}
	} else {
		ImgHeader += '<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"600\" height=\"' + heightHeader + '\">';		ImgHeader += '	<param name=\"movie\" value=\"' + rootSite + 'imagens/headers' + endheader + '?'+cacheKill+'\">';
		ImgHeader +='	<param name=quality value=high>';
		ImgHeader +='	<embed src=\"' + rootSite + 'imagens/headers' + endheader + '?'+cacheKill+'" quality=high pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"600\" height=\"' + heightHeader + '\"></embed>';
		ImgHeader +='</object>';
	}
	var arrUrl = window.location.href.split("/");
	if(arrUrl[arrUrl.length -1] == "gestao_reclamacao.asp"){
		document.getElementById("DivHeader").innerHTML='<img src="/imagens/headers/gestao_reclamacao.jpg" width="654" height="245" alt="">';
	}else if (arrUrl[arrUrl.length -1] == "ouvidoria.asp"){
		document.getElementById("DivHeader").innerHTML='<img src="/imagens/headers/ouvidoria.jpg" width="654" height="245" alt="">';
	}else{
		document.getElementById("DivHeader").innerHTML=ImgHeader;
	}
};

function mapa3(){
	var ImgMapa = "";
	ImgMapa += '<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"80\" height=\"73\">';
	ImgMapa += '<param name=\"allowScriptAccess\" value=\"sameDomain\">';
	ImgMapa += '<param name=\"FlashVars\" value=\"rootSite='+rootSite+'\">';	
	ImgMapa += '<param name=\"movie\" value=\"'+rootSite+'imagens/swf/mapa_bt2.swf\">';
	ImgMapa += '<param name=\"quality\" value=\"high\">';
	ImgMapa += '<param name=\"wmode\" value=\"transparent\">';
	ImgMapa += '<embed src=\"'+rootSite+'imagens/swf/mapa_bt2.swf\" quality=\"high\"  width=\"80\" height=\"73\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\"  flashvars=\"rootSite='+rootSite+'\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" wmode=\"transparent\">';
	ImgMapa += '</object>';
	document.getElementById("DivMapa3").innerHTML=ImgMapa;
}

function mapa(){
	document.write('<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"400\" height=\"320\">');
	document.write('<param name=\"allowScriptAccess\" value=\"sameDomain\">');
	document.write('<param name=\"movie\" value=\"'+rootSite+'corporativo/brasil/swf/mapa.swf\">');
	document.write('<param name=\"quality\" value=\"high\">');
	document.write('<param name=\"wmode\" value=\"transparent\">');
	document.write('<embed src=\"'+rootSite+'corporativo/brasil/swf/mapa.swf\" quality=\"high\"  width=\"400\" height=\"320\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" wmode=\"transparent\">');
	document.write('</object>');
}

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);