// JavaScript Document

// Evita borda do flash no Explorer
function GerarSWF(arquivo,altura,largura,id,alig){
    document.writeln('    <object id="globalnav-object" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + largura + '" height="' + altura + '" align="' + alig + '" id="' + id + '">');
    document.writeln('        <param name="movie" value="' + arquivo + '" />');
    document.writeln('        <param name="FlashVars" value="loc=en_US&htmlApp=false&gatewayURL=gwurl" />');
    //document.writeln('        <param name="bgcolor" value="#ffffff" />');
    document.writeln('        <param name="menu" value="false" />');
    document.writeln('        <param name="quality" value="high" />');
    document.writeln('        <param name="salign" value="tl" />');
    //document.writeln('        <param name="scale" value="noscale" />');
    document.writeln('        <param name="wmode" value="transparent" />');
    document.writeln('        <embed id="globalnav-embed" src="' + arquivo + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" flashvars="loc=en_US&htmlApp=false&gatewayURL=gwurl" bgcolor="#ffffff" menu="false" quality="high" salign="tl" scale="noscale" name="' + id + '" width="' + largura + '" height="' + altura + '" align="' + alig + '"></embed>');
    document.writeln('    </object>');
}

function openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
  return true;
}

function selecLugar(loc) {
   var veri=false;
   var reg=15;
   areg0=document.getElementById('r_0');
   reg1 = new Array("rs");
   reg2 = new Array("sc");
   reg3 = new Array("pr");
   reg4 = new Array("sp");
   reg5 = new Array("rj");
   reg6 = new Array("mg");
   reg7 = new Array("es");
   reg8 = new Array("go");
   reg9 = new Array("mt","ms","ro");
   reg10 = new Array("pa","am","ap");
   reg11 = new Array("ba");
   reg12 = new Array("al","se");
   reg13 = new Array("pe","pb");
   reg14 = new Array("rn","ma","pi","ce");
   reg15 = new Array("uru","par");
   for(x=1; x<=reg; x++) {
	   adiv="r_"+x;
	   olink="#lk_"+x;
	   document.getElementById(adiv).style.display="none";
	   areg=eval("reg"+x);
	   aregt=areg.length;
	   for(y=0; y<aregt; y++) {
		   if(loc==areg[y]) {
			   divtx=document.getElementById(adiv);
			   //divtx.style.display="block";
			   $(divtx).slideDown();
			   document.location.hash=olink;
			   ajustaDiv();
			   veri=true;
		   }
		   if(loc=="x") veri=true;
	   }
   }
   if (veri==false) {
	   //areg0.style.display="block";
	   $(areg0).slideDown();
	   window.location.href="#lk_0";
   } else {
	   //areg0.style.display="none";
	   $(areg0).slideUp();
   }
}

function tamtela() {
var xScroll, yScroll;
if (window.innerHeight && window.scrollMaxY) {
	xScroll = document.body.scrollWidth;
	yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
	xScroll = document.body.scrollWidth;
	yScroll = document.body.scrollHeight;
} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
	xScroll = document.body.offsetWidth;
	yScroll = document.body.offsetHeight;
}
var windowWidth, windowHeight;
if (self.innerHeight) {	// all except Explorer
	windowWidth = self.innerWidth;
	windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
	windowWidth = document.documentElement.clientWidth;
	windowHeight = document.documentElement.clientHeight;
} else if (document.body) { // other Explorers
	windowWidth = document.body.clientWidth;
	windowHeight = document.body.clientHeight;
}
// for small pages with total height less then height of the viewport
if(yScroll < windowHeight){
	pageHeight = windowHeight;
} else {
	pageHeight = yScroll;
}
}

function ajustaDiv() {
	tamtela();
	altDiv=pageHeight+"px";
	document.getElementById('conteiner').style.height=altDiv;
	altCont=(pageHeight-150)+"px";
	if(document.getElementById('colprodutos'))
		document.getElementById('colprodutos').style.height=altCont;   // altura da div colmenu
	return true;
}
