// verifica versão do IE
var isIE6 = /msie|MSIE 6/.test(navigator.userAgent);
var isIE7 = /msie|MSIE 7/.test(navigator.userAgent);
		
// ZMsAd v2

function ZMpos01(s){if(document.layers){return document.layers[s];}else if(document.all && !document.getElementById) {return document.all[s];}else {return document.getElementById(s);}}
function ZMpos02(s,x,y){_o = ZMpos01(s);_o.style.clip = 'rect(0px '+x+'px '+y+'px 0px)';}
function ZMLvis01(s){_o=ZMpos01(s);_o.style.visibility = (_o.style.visibility == 'visible') ? 'hidden' : 'visible';}
function ZMLvis02(s){_o=ZMpos01(s);_o.style.visibility = (_o.style.visibility == 'hidden') ? 'visible' : 'hidden';}


function flash(url, formato){
	var aux = "";	
	aux += "<object classid=\"clsid:clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" " +formato+ " align=\"middle\">";
	aux += "<param name=\"allowScriptAccess\" value=\"sameDomain\" />";
	aux += "<param name=\"movie\" value=" +url+ ">";
	aux += "<param name=\"loop\" value=\"false\" />";
	aux += "<param name=\"menu\" value=\"false\" />";
	aux += "<param name=\"quality\" value=\"high\" >";
	aux += "<embed src=" +url+ " quality=\"high\" wmode=\"transparent\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" " +formato+ "></embed>"
	aux += "</object>"
	
	startIeFix();
	document.write(aux);
	stamx(url);
	endIeFix();
}

function flash_xp(nomxp, urlxp, wthxp, hgtxp, hgtxpo){
	var auxp = "";
	
	auxp += "<div id=\"" +nomxp+ "01\" style=\"z-index: 100; width: " +wthxp+ "px; position: relative; height: " +hgtxp+ "px;\">";
	auxp += "<div id=\"" +nomxp+ "02\" onmouseover='ZMpos02(\"" +nomxp+ "02\"," +wthxp+ "," +hgtxpo+ ")' style=\"z-index: 100; left: 0px; width: " +wthxp+ "px; clip: rect(0px, " +wthxp+ "px, " +hgtxp+ "px, 0px); position: absolute; top: 0px; height: " +hgtxp+ "px;\" onmouseout='ZMpos02(\"" +nomxp+ "02\"," +wthxp+ "," +hgtxp+ ")'>";
	auxp += "<object codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" height=\"" +hgtxpo+ "\" width=\"" +wthxp+ "\">";
	auxp += "<param name=\"allowScriptAccess\" value=\"sameDomain\" />";
	auxp += "<param name=\"wmode\" value=\"transparent\">";
	auxp += "<param name=\"wmode\" value=\"false\">";
	auxp += "<param name=\"quality\" value=\"high\">";
	auxp += "<param name=\"menu\" value=\"false\">";
	auxp += "<param name=\"src\" value=\"" +urlxp+ "\">";
	auxp += "<embed src=\"" +urlxp+ "\" quality=\"high\" ";
	auxp += " pluginspage=\"http://www.macromedia.com/go/getflashplayer\" ";
	auxp += " type=\"application/x-shockwave-flash\" wmode=\"transparent\" ";
	auxp += " menu=\"false\" loop=\"true\" height=\"" +hgtxpo+ "\" width=\"" +wthxp+ "\"></embed></object>";
	auxp += "</div>";
	auxp += "</div>";
	
	document.write(auxp);
	fixFlash();
}

function flash_it(nomit,urlit){
	var auxit = "";
	
	auxit += "<div id=\"" +nomit+ "03\" style=\"position: absolute;	top: 0px;	left: 0px;	width: 100%;	height: 600px;	z-index: 200;	text-align: center;	margin: 0 auto; visibility:hidden;\">";
	auxit += "<div style=\"width: 740px;	height: 600px;	text-align: center;	 margin: 0 auto;\">";
	auxit += "<object codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" ";
	auxit += " classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" height=\"600\" width=\"740\">";
	auxit += " <param name=\"WMode\" value=\"Transparent\">";
	auxit += " <param name=\"Loop\" value=\"-1\">";
	auxit += " <param name=\"Quality\" value=\"High\">";
	auxit += " <param name=\"Menu\" value=\"false\">";
	auxit += " <param name=\"Src\" value=\"" +urlit+ "\">";
	auxit += " <embed src=\"" +urlit+ "\" quality=\"high\" ";
	auxit += " pluginspage=\"http://www.macromedia.com/go/getflashplayer\" ";
	auxit += " type=\"application/x-shockwave-flash\" wmode=\"transparent\" ";
	auxit += " menu=\"false\" loop=\"true\" height=\"600\" width=\"740\"></embed></object></div>";
	auxit += "</div>";
	
	document.write(auxit);
	fixFlash();
	
	ZMLvis01(nomit+'03');
	setTimeout('ZMLvis02(\''+nomit+'03\');',5000);
}


//IEEOLASFIX para fixar o click to activate do flash
// está sendo usado na função: flash()
var bo_ns_id = 0

function startIeFix(){
		if(isIE()){
			document.write('<noscript id="bo_ns_id_' + bo_ns_id + '">')
		}
}

function endIeFix(){
		if(isIE()){
			document.write('<!–[if gte IE 6]></noscript><![endif]–>')
			var theObject = document.getElementById('bo_ns_id_' + bo_ns_id++)
			var theNoScript = theObject.innerHTML
			document.write(theNoScript)
		}
}

function isIE_original(){
		var strBrowser = navigator.userAgent.toLowerCase()
		if(strBrowser.indexOf('msie') > -1 && strBrowser.indexOf('mac') < 0){
			return true
		}else{
			return false
		}
}


function isIE(){
		// 14/06/2011: verifica versão do IE devido a incompatibilidade com IE 9
		if(isIE6 || isIE7){
			return true
		}else{
			return false
		}
}


// está sendo usado nas funções: flash_xp() e flash_it()
function fixFlash(){
	// 14/06/2011: verifica versão do IE devido a incompatibilidade com IE 9
	if(isIE6 || isIE7){
		if(document.getElementsByTagName && document.body.outerHTML){
			var tag, arTag=Array('object','embed','applet')
			for(tag in arTag){
				var arEl=document.getElementsByTagName(arTag[tag])
				for(var i=0; i < arEl.length; i++){
					var el=arEl.item(i)
					var params=el.getElementsByTagName('param')
					var html=''
					if(params.length && !/<param/i.test(el.innerHTML))
						for(var x=0;x < params.length;x++)html += params.item(x).outerHTML
					el.outerHTML = el.outerHTML.replace('>', '>' + html)
				}
			}
		}
	}
}

function stamx(urlx) {
	if (urlx.substring(0,66)=="http://www.zonaeletrica.com.br/banners/full_eletrobras_conheca.swf") {
		document.write("<br><img border='0' src='http://nspmotion.com/AdvCounter.aspx?a=12308!38957!1' width='1' height='1'>")
	}
}
