/*window.moveTo(0,0);
if (document.all) { // IE
	window.resizeTo(screen.availWidth,screen.availHeight);
} else { // NETSCAPE
	window.outerHeight = screen.availHeight;
	window.outerWidth = screen.availWidth;
}
window.focus();*/

function RodarFlash(path,variaveis,_width,_height)
{
	varHeight = (_height!=undefined)?_height:0;
	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="'+_width+'" height="'+varHeight+'">')
		document.write('<param name="movie" value="'+path+'?'+variaveis+'">')
		document.write('<param name="quality" value="high">')
		document.write('<param name="wmode" value="transparent">')
		document.write('<embed src="'+path+'?'+variaveis+'" width="'+_width+'" height="'+varHeight+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent"></embed>')
	document.write('</object>')
}

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_jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}
var arrPageSize = new Array();
function apareceImg() {
	
	function getPageScroll(){
		var yScroll;
	
		if (self.pageYOffset) {
			yScroll = self.pageYOffset;
		} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
			yScroll = document.documentElement.scrollTop;
		} else if (document.body) {// all other Explorers
			yScroll = document.body.scrollTop;
		}
	
		arrayPageScroll = new Array('',yScroll);
		return arrayPageScroll;
	}
	function getPageSize(){
		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;
		}
	
		// for small pages with total width less then width of the viewport
		if(xScroll < windowWidth){	
			pageWidth = windowWidth;
		} else {
			pageWidth = xScroll;
		}
	
	
		arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
		return arrayPageSize;
	}
	var arrayPageScroll = getPageScroll();
	var arrayPageSize = getPageSize();
	var largMask;
	if(navigator.appName == "Microsoft Internet Explorer" && screen.width == 1024)
	{
		//largMask = document.body.offsetWidth+145;
		largMask = document.body.offsetWidth+16;
	}
	else if(navigator.appName == "Microsoft Internet Explorer" && screen.width == 1280)
	{
		largMask = document.body.offsetWidth+20;
	}
	else
	{
		largMask = document.body.offsetWidth+15;
	}
	document.getElementById('imgGrd').style.top = (arrayPageScroll[1] + ((arrayPageSize[3] - (screen.height-160)) / 2) + 'px');
	document.getElementById('imgGrd').style.left = (((arrayPageSize[0] - (screen.width-40)) / 2) + 'px');
	document.getElementById('mask').style.height = document.getElementById('geral').offsetHeight+'px';
	document.getElementById('mask').style.width = largMask//document.body.offsetWidth+(navigator.appName == "Netscape" ? 15 : 20)+'px';
	document.getElementById('mask').style.background = '#B7B28F';
	document.getElementById('imgGrd').style.display = 'block';
	document.getElementById('mask').style.display = 'block';
}
function someImg()
{
	document.getElementById('imgGrd').style.display = 'none';
	document.getElementById('mask').style.display = 'none';
}

function flashGaleria(path)
{
	var altura;
	var largura;
	largura = document.body.offsetWidth+(navigator.appName == "Microsoft Internet Explorer" ? 26 : 0);
	altura = document.body.offsetHeight;
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+largura+'" height="'+altura+'">')
		document.write('<param name="movie" value="'+path+'" />')
		document.write('<param name="quality" value="high" />')
		document.write('<param name="scale" value="noscale" />')
		document.write('<param name="bgcolor" value="#ffffff" />')
		document.write('<embed src="'+path+'" quality="high" scale="noscale" bgcolor="#ffffff" width="'+largura+'"  height="'+altura+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />')
	document.write('</object>')
}

var defaultEmptyOK = false
var whitespace = " \t\n\r";
function isEmail (s)
{  
	
 if (isEmpty(s)) 
       if (isEmail.arguments.length == 1) return defaultEmptyOK;
       else return (isEmail.arguments[1] == true);
   
    if (isWhitespace(s)) return false;
    var i = 1;
    var sLength = s.length;

    // look for @
    while ((i < sLength) && (s.charAt(i) != "@"))
    { i++
    }

    if ((i >= sLength) || (s.charAt(i) != "@")) return false;
    else i += 2;

    while ((i < sLength) && (s.charAt(i) != "."))
    { i++
    }

    if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
    else return true;
}

function isEmpty(s)
{   return ((s == null) || (s.length == 0))
}
function isWhitespace (s)

{   var i;

    // Is s empty?
    if (isEmpty(s)) return true;

    for (i = 0; i < s.length; i++)
    {   
        var c = s.charAt(i);

        if (whitespace.indexOf(c) == -1) return false;
    }

    return true;
}
function changeSize(){
	intTodo = "";
	intPublicidade = "";
	
	if(document.getElementById('todo')){
		intTodo=document.getElementById('todo').offsetWidth; }
	else{
		intTodo=0; }
    if(document.getElementById('publicidade')){
		intPublicidade=document.getElementById('publicidade').offsetWidth; }
	else{
		intPublicidade=0; }
	if(document.getElementById('publicidade')){
       document.getElementById('main_container').style.width = (intTodo+intPublicidade)+"px";
	   }
}
// Abre e fecha Perguntas frequentes.


var ant;
function abrefecha(id) //Função que mostra/esconde as tabelas
{
var resposta = document.getElementById("resposta_" + id);			

	if(ant == id){
	if (resposta.style.display == "block"){						
	   resposta.style.display = "none";
	}
		else{							
		resposta.style.display = "block";
		}
		}
	else{
	if(ant != undefined){
	document.getElementById("resposta_" + ant).style.display = "none";						
	}						
	resposta.style.display = "block";
	ant = id;
	}
}


/*Script para abrir a galeria do lojas*/
function ajusteDiv(swf,vars,tamL,tamA){
	
	//alert(swf+"\n"+vars+"\n"+tamL+"\n"+tamA);
	
	var flash = document.getElementById('flash');
	var primeiro = document.getElementById('primeiro');
	var fundo = document.getElementById('fundo');
	
	document.body.scroll = 'no';
	
	//document.body.style.overflow = 'hidden';
	
	fundo.style.display = "block";
	flash.style.display = "block";
	primeiro.style.display = "block";
	
	fundo.style.width = screen.width+"px";
	fundo.style.height = screen.height+"px";
	
	primeiro.style.paddingLeft = (screen.width/2) - (1000/2)+"px";
	
	meuFlash =  '<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="'+tamL+'" height="'+tamA+'">';
	meuFlash +=	'<param name="movie" value="'+swf+'?'+vars+'">';
	meuFlash +=	'<param name="quality" value="high">';
	meuFlash +=  '<param name="wmode" value="transparent">';
	meuFlash +=	'<embed src="'+swf+'?'+vars+'" width="'+tamL+'" height="'+tamA+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent"></embed>';
	meuFlash +=	'</object>';
	
	//alert(meuFlash);
	
	flash.innerHTML = meuFlash;
}

function ocultaDiv(){
	document.body.scroll = 'auto';
	document.body.style.overflow = 'auto';
	document.getElementById('flash').style.display = "none";
	document.getElementById('fundo').style.display = "none";
	document.getElementById('primeiro').style.display = "none";
}
function getPageSize(){
	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;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}
	intTodoHeight = document.getElementById('todo').offsetHeight
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)

	if(navigator.appName != "Microsoft Internet Explorer"){
		document.getElementById('adjustSize').style.height = ((pageHeight-intTodoHeight)+1)+"px";		
	}else{
		document.getElementById('adjustSize').style.height = ((pageHeight-intTodoHeight)+18)+"px";		
		}
}
