﻿function show(idobj){
	document.getElementById(idobj).style.display = 'block';
}

function hidden(idobj){
	document.getElementById(idobj).style.display = 'none';
}
	
function fechahome(){
	hidden('indexHome');
	show('siteBody');
}
	
function abrehome(){
	/*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;
	}


	hidden('siteBody');
	document.getElementById('flashHome').style.width = windowWidth;
	document.getElementById('flashHome').style.height = windowHeight;
	show('indexHome');*/
	
	history.go();

}

function abreVideo(id){
	window.open('apps/player/?id='+id,'videoPlayer', 'width=700, height=350, top=100, left=100, scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
}

function abreVideoYT(id){
	window.open('apps/playeryt/?id='+id,'videoPlayer', 'width=700, height=350, top=100, left=100, scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
}

function faderIn(){
	var fader = document.getElementById('faderBody');
	var pgWidth = document.getElementById('bodyAll').offsetWidth;
	var pgHeight = document.getElementById('bodyAll').offsetHeight;
	fader.style.height = pgHeight +'px';
	show('faderBody');
}

function faderLoaderIn(){
	var pgWidth = document.getElementById('bodyAll').offsetWidth;
	var pgHeight = document.getElementById('bodyAll').offsetHeight;
	show('faderLoading');
	document.getElementById('faderLoading').style.left = ((pgWidth-100)/2)+"px";
	document.getElementById('faderLoading').style.top = (yScroll+((windowHeight-100)/2)-5)+"px";
}


function setFullSize(divID){
	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;
	}
	
	
	document.getElementById(divID).style.width = windowWidth + "px";
	document.getElementById(divID).style.height = windowHeight + "px";

}




//submit newsletter
var reqNews;
function cadNewsletter(news_email){
	reqNews = null;
	if (window.XMLHttpRequest) {
		reqNews = new XMLHttpRequest();
		reqNews.onreadystatechange = sub_news_carrega;
		reqNews.open("GET", 'apps/newsletter/?email='+ news_email, true);
		reqNews.send(null);
	} else if (window.ActiveXObject) {
		reqNews = new ActiveXObject("Microsoft.XMLHTTP");
		if (reqNews) {
			reqNews.onreadystatechange = sub_news_carrega;
			reqNews.open("GET", 'apps/newsletter/?email='+ news_email, true);
			reqNews.send();
		}
	}
}
function sub_news_carrega(){
	if (reqNews.readyState == 4){
		if (reqNews.status == 200) { 
			window.alert("A partir de agora você vai receber as novidades do site no e-mail!!\n\n Obrigado por se cadastrar!");
			document.getElementById('newsletterEmail').value = "Digite seu e-mail aqui";
		}else {
			window.alert("Ooooops!!\n\nHouve um probleminha ao obter os dados!\nPor favor tente novamente em alguns minutos!");
		}
	}else{
		document.getElementById('newsletterEmail').value = "Cadastrando...";
	}
}


function lojaForm(){
	var sWidth, sHeight, screenWidth, screenHeight; 
	screenWidth = screen.availWidth; 
	screenHeight = screen.availHeight; 
	
	url = "conteudo/loja/form.php";
	
	sWidth = 400; 
	sHeight = 450; 
	
	if(navigator.appName == "Netscape") { 
		sec = window.open(url,'_blank','scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,copyhistory=no,height='+sHeight+',width='+sWidth+',top='+ (screenHeight - sHeight)/2 +',left='+ (screenWidth - sWidth)/2); 
		window.sec.focus(); 
	}else{	
		window.open(url,'_blank','scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,copyhistory=no,height='+ sHeight +',width='+ sWidth +',top='+ (screenHeight - sHeight)/2 +',left='+ (screenWidth - sWidth)/2); 
	}; 
}

