// JavaScript Document

/* INDICE */
function ativaAba(aba)
{
	var x = document.getElementById("glossario").getElementsByTagName("li").length;
	
	for( var i = 0 ; i < x ; i++ ) {
		document.getElementById("glossario").getElementsByTagName("li")[i].getElementsByTagName("a")[0].className="";
	}

	aba.className = 'active';
}

function ativaGlossario(ind)
{
	for(cont = 0; cont < 27; cont++)
	{
		document.getElementById('glos_'+cont).style.display = "none";
	}
	
	document.getElementById('glos_'+ind).style.display = "block";
}

/************ LIGHTBOX ***************/
function abreLightbox() {
		document.getElementById('divLightbox').style.display = 'block';
}

function fechaLightbox() {
		document.getElementById('divLightbox').style.display = 'none';
}

/************ CONTEUDO LIGHTBOX **************/

function trocaConteudo(ind)
{
	for (cont = 1; cont < 3; cont++)
	{
		document.getElementById('divLightBoxConteudo_'+cont).style.display = 'none';		
	}
	document.getElementById('divLightBoxConteudo_'+ind).style.display = 'block';
}

/* POP UP */
function popup(URL,largura,altura) {
	var width = largura;
	var height = altura;
	var left = 100;
	var top = 100;
	window.open(URL,'popup', 'width='+width+', height='+height+', top='+top+', left='+left+', toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, fullscreen=no');
}

/* FLASH */

function aplicaFlash(swf, width, height, wmode, cache) {
	var noCache = "";
	if (cache == undefined || cache == '') {var noCache = "?" + new Date();}
	if (wmode != "opaque" && wmode != "transparent") {wmode = "transparent";}
	var monta_swf = "";
	monta_swf += "<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='"+ width +"' height='"+ height +"' title=''>";
	monta_swf += "<param name='movie' value='"+ swf + noCache +"'>";
	monta_swf += "<param name='quality' value='high'>";
	monta_swf += "<param name='menu' value='0'>";
	monta_swf += "<param name='wmode' value='"+ wmode +"'>";
	monta_swf += "<embed src='"+ swf + noCache +"' quality='high' wmode='"+ wmode +"' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+ width +"' height='"+ height +"'></embed>";
	monta_swf += "</object>";
	document.write(monta_swf);
}
function aplicaFlashComVars(swf, width, height, wmode, cache, flashVars) {
	var noCache = "";
	if (cache == undefined || cache == '') {var noCache = "?" + new Date();}
	if (wmode != "opaque" && wmode != "transparent") {wmode = "transparent";}
	var monta_swf = "";
	monta_swf += "<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='"+ width +"' height='"+ height +"' title=''>";
	monta_swf += "<param name='movie' value='"+ swf + noCache +"'>";
	monta_swf += "<param name='quality' value='high'>";
	monta_swf += "<param name='menu' value='0'>";
	monta_swf += "<param name='FlashVars' value='"+flashVars+"'>";
	monta_swf += "<param name='wmode' value='"+ wmode +"'>";
	monta_swf += "<embed src='"+ swf + noCache +"' quality='high' FlashVars='"+flashVars+"' wmode='"+ wmode +"' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+ width +"' height='"+ height +"'></embed>";
	monta_swf += "</object>";
	document.write(monta_swf);
}
/* SLIDE LANCAMENTO */

/* DECLARACAO DE ARRAY (IMAGEM / TITULO / DESCRICAO) */

//IMAGEM
var arrImg = new Array();
//arrImg[0] = '../util/img/conteudo/lancamento/img_lancamentoLinhaVitalie.gif';
arrImg[0] = '../util/img/conteudo/lancamento/img_lancamentoSopao.jpg';
arrImg[1] = '../util/img/conteudo/lancamento/img_lancamentoPomarola.jpg';
arrImg[2] = '../util/img/conteudo/lancamento/img_lancamentoColorido.jpg';

//TITULO
var arrTit = new Array();
//arrTit[0] = 'Conhe&ccedil;a a nova linha Knorr Vitalie';
arrTit[0] = 'Sop&atilde;o com + Macarr&atilde;o';
arrTit[1] = 'Pomarola 100% Natural';
arrTit[2] = 'Coma Colorido';

//DESCRICAO
var arrDesc = new Array();
//arrDesc[0] = 'A nova linha Knorr Vitalie foi feita especialmente para quem busca uma alimenta&ccedil;&atilde;o equilibrada mas n&atilde;o abre m&atilde;o do sabor. S&atilde;o novos caldos, sopas e tomates com menos gordura, menos sal e todo sabor de Knorr.';
arrDesc[0] = 'Voc&ecirc; que j&aacute; ama o Sop&atilde;o Knorr vai se surpreender com essa linha de sopas que vem com mais macarr&atilde;o. S&atilde;o tr&ecirc;s sabores irresist&iacute;veis (carne, galinha e m&uacute;sculo com mais legumes) para completar a refei&ccedil;&atilde;o da sua fam&iacute;lia. Experimente!';
arrDesc[1] = 'A Knorr acaba de lan&ccedil;ar todo o sabor do tomate, no molho preparado com ingredientes naturais. Agora ficou ainda mais irresist&iacute;vel! ';
arrDesc[2] = 'A nova linha de sopas creme "Coma Colorido" Knorr, com vegetais 100% naturais, vai tornar suas refei&ccedil;&otilde;es mais deliciosas e coloridas. S&atilde;o quatro cores diferentes, que correspondem a um grupo espec&iacute;fico de vegetais. Descubra os benef&iacute;cios e aproveite todos os nutrientes como fibras, vitaminas e minerais que a linha de sopas creme "Coma Colorido" Knorr oferece e bom apetite!';

var arrLink = new Array();
arrLink[0] = '';
arrLink[1] = '/Produtos/Produto.aspx?id=231';
arrLink[2] = '';


var img1 = new Image();
var img2 = new Image();
var img3 = new Image();
img1.src = '../util/img/conteudo/lancamento/img_lancamentoSopao.jpg';
img2.src = '../util/img/conteudo/lancamento/img_lancamentoPomarola.jpg';
img3.src = '../util/img/conteudo/lancamento/img_lancamentoColorido.jpg';

/* INICIALIZAR AS VARIAVEIS */
var imgAtual = -1;

/* VARIAVEL DE QUANTAS IMAGENS EXISTEM NO ARRAY */
var imgContador = arrImg.length - 1;

/* FUNCAO */
function slideLancamento()
{																	
	imgAtual++;
	
	if(imgAtual > imgContador)
	{
		imgAtual = 0;
	}
	if (arrLink[imgAtual] == '')
	{
	    document.getElementById('linkCont').style.display = 'none';
	}
	else
	{
	    document.getElementById('linkCont').style.display = 'block';
	}
	document.getElementById('linkCont').href = arrLink[imgAtual];
	document.getElementById('imgCont').src = arrImg[imgAtual];
	document.getElementById('titCont').innerHTML = arrTit[imgAtual];
	document.getElementById('desCont').innerHTML = arrDesc[imgAtual];
}

/* FUNCAO RESOLUCAO DA TELA */

function resolucao()
{
	
	var classname = "conteinerTotal";
	var classname1 = "rodape";
	
	var el = getElementbyClass(classname);
	var rod = getElementbyClass(classname1);
	
	var larg = screen.width;
	
	if(larg == '800')
	{
		el[0].style.width = "1024px";
		rod[0].style.width = "1024px";
	}
}

function getElementbyClass(classname){
	
	partscollect=new Array();
		var inc=0;
		var alltags=document.all? document.all : document.getElementsByTagName("*")
		for (i=0; i<alltags.length; i++){
		if (alltags[i].className==classname)
		partscollect[inc++]=alltags[i]
		}
		return partscollect;
}

var antDecada = "";
var antAno = "";

function escolhaAno(decada, ano)
{
	cont = 1;
	
	if(antDecada != "" || antAno !="")
	{
		document.getElementById('decada_'+antDecada).style.display = "none";
		document.getElementById('decada_'+antDecada+'_ano_'+antAno).style.display = "none";
		document.getElementById('galeria_decada_'+antDecada+'_ano_'+antAno).style.display = "none";
		document.getElementById('titulo_decada_'+antDecada+'_ano_'+antAno).style.display = "none";
	}
	/* LIMPA A LINHA DO TEMPO */
	while (cont < decada+1)
	{
		document.getElementById('decada_'+cont).style.display = "none";
		cont++;
	}
	
	/* MOSTRA A LINHA DO TEMPO E O CONTEUDO DO ANO */
	document.getElementById('decada_'+decada).style.display = "block";	
	document.getElementById('decada_'+decada+'_ano_'+ano).style.display = "block";
	document.getElementById('galeria_decada_'+decada+'_ano_'+ano).style.display = "block";
	document.getElementById('titulo_decada_'+decada+'_ano_'+ano).style.display = "block";

	/* ATRIBUI OS DADOS DO ANTIGO ID */
	antDecada = decada;
	antAno = ano;
}

function trocaVideo(videoName){
	var strWMV = '';

	strWMV+='<object id="boxMediaPlayer" width="278" height="260")';
	strWMV+='<object id="boxMediaPlayer" width="278" height="260"';
	strWMV+='classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"';
	strWMV+='codebase="http://activex.microsoft.com/activex/controls/ mplayer/en/nsmp2inf.cab#Version=5,1,52,701"';
	strWMV+='standby="Carregando componentes..." type="application/x-oleobject">';
	strWMV+='<param name="fileName" value="../util/video/'+videoName+'.wmv" />';
	strWMV+='<param name="animationatStart" value="1" />';
	strWMV+='<param name="transparentatStart" value="1" />';
	strWMV+='<param name="autoStart" value="1" />';
	strWMV+='<param name="ShowControls" value="1" />';
	strWMV+='<param name="ShowDisplay" value="0" />';
	strWMV+='<param name="ShowStatusBar" value="0" />';
	strWMV+='<param name="loop" value="0" />';

	strWMV+='<embed type="application/x-mplayer2"';
	strWMV+='pluginspage="http://microsoft.com/windows/mediaplayer/en/download/"';
	strWMV+='id="boxMediaPlayer" displaysize="4" autosize="0"';
	strWMV+='bgcolor="darkblue" showcontrols="1" showtracker="1"';
	strWMV+='showdisplay="0" showstatusbar="1" videoborder3d="0" width="278" height="260"';
	strWMV+='src="../util/video/"'+videoName+ 'autostart="1" designtimesp="5311" loop="0">';
	strWMV+='</embed></object>';
	
	document.write(strWMV);
}

function login() {
        document.getElementById('formLoginComentario').style.display='none';
        document.getElementById('formEnviarComentario').style.display='block';
}

/* FECHAR BANNER HOME */
function fecharBanner()
{
    document.getElementById('banner').style.display='none';
}

function abrePopup(){
  popup('http://www.opoderdasrefeicoes.com.br/contest_youtube/meu_arroz/regulamento.php', 450,360 );
}