/*funcao para linkar select para lojas*/
function FnConhecaLojas(url){
	document.location.href=url;
}
////////////////////////////////////////////////////////////////////////////////////////////
/*funcao para mostrar imagem das lojas rodape*/
function linkOn(ico,txt){
	document.getElementById('padrao').style.display = 'none';
	document.getElementById(txt).style.display = '';
}
function linkOff(ico,txt){
	document.getElementById(txt).style.display = 'none';
	document.getElementById('padrao').style.display = '';
}
////////////////////////////////////////////////////////////////////////////////////////////
/*funcao sub-menu categorias*/
function fnMostraOculta(pId)
{
    // alert(pId);
	if (document.getElementById(pId).style.display == 'block')
	{
		document.getElementById(pId).style.display='none' ;
	}
	else
	{
		document.getElementById(pId).style.display='block' ;
	}
}
////////////////////////////////////////////////////////////////////////////////////////////
//Funcao Adiciona a Favoritos
function fnAdicionaFavoritos(){
	str_titulo = " :: Anima Fest :: ";
	str_url = "http://www.animafest.com.br";
	//FireFox
	if (window.sidebar){
   		window.sidebar.addPanel(str_titulo, str_url,"");
	} else if( window.external ){
	//IE
  		window.external.AddFavorite( str_url, str_titulo);
	} else if(window.opera && window.print){
	//Opera
   		return true;
	}
}
////////////////////////////////////////////////////////////////////////////////////////////
//Funcao de popup
function MM_openBrWindow(theURL,winName,features) 
{
	var myWin =  window.open(theURL,winName,features);
	myWin.focus();
}
////////////////////////////////////////////////////////////////////////////////////////////
/*Funcao para target*/
function fnTarget(str_target) 
{
	//declaracao de variaveis
	var ch_tag_A, vet_A, int_i;
	var str_titulo;	
	//pega todos os <a> da pagina e percorre um por um para achar o rel="external"
    ch_tag_A = document.getElementsByTagName('a');
    for(int_i=0; int_i<ch_tag_A.length; int_i++) 
	{
		vet_A = ch_tag_A[int_i];
		if(vet_A.getAttribute("href") && vet_A.getAttribute('rel') != null) 
		{
			if (vet_A.getAttribute('rel').substring(0,8) == 'external')
			{
				vet_A.target = str_target;
				str_titulo = ch_tag_A.title;
				ch_tag_A.title = str_titulo;
			}
		}
	}
}
////////////////////////////////////////////////////////////////////////////////////////////
/*Funcao para target mapeamento de imagem*/
function fnAreaTarget(str_target) 
{
	//declaracao de variaveis
	var ch_tag_A, vet_A, int_i;
	var str_titulo;	
	//pega todos os <a> da pagina e percorre um por um para achar o rel="external"
    ch_tag_A = document.getElementsByTagName('area');
    for(int_i=0; int_i<ch_tag_A.length; int_i++) 
	{
		vet_A = ch_tag_A[int_i];
		if(vet_A.getAttribute("href") && vet_A.getAttribute('id') != null) 
		{
			if (vet_A.getAttribute('id').substring(0,8) == 'external')
			{
				vet_A.target = str_target;
				str_titulo = ch_tag_A.title;
				ch_tag_A.title = str_titulo;
			}
		}
	}
}
////////////////////////////////////////////////////////////////////////////////////////////
//Validacao da Newsletter
function ValidaNews(form,evento){
	if (form.news.value.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1){
		alert("Atenção!\nDigite corretamente o seu e-mail.");
		form.news.focus();
		return false;
	}
}
///////////////////////////////////////////////////////////////////////////////////////////
// Validacao Newsletter descadastrar
function verificaEmail(){
	if(document.getElementById('news').value.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1){
		alert("Atenção!\nColoque seu EMAIL corretamente para descadastrar!");
		document.getElementById('news').focus();
		return false;
	}
	return true;
}
////////////////////////////////////////////////////////////////////////////////////////
//Validacao do Indique Amigo
function ValidaAreaClientes(form,evento){
	if ( form.login_area_cliente.value == '' ){
		alert('Atenção!\nO campo LOGIN deve ser preenchido.') ;
		form.login_area_cliente.focus();
		return false ;
	}
	if ( form.senha_area_cliente.value == '' ){
		alert('Atenção!\nO campo SENHA deve ser preenchido.') ;
		form.senha_area_cliente.focus();
		return false ;
	}
}
///////////////////////////////////////////////////////////////////////////////////////////
//Funcao para flash
function fnFlash(str_url,int_largura,int_altura){
	document.writeln('<object type="application/x-shockwave-flash" data="'+str_url+'" width="'+int_largura+'" height="'+int_altura+'">');
	document.writeln('<param name="movie" value="'+str_url+'">');
	document.writeln('<param name="quality" value="high">');
	document.writeln('<param name="wmode" value="transparent">');
	document.writeln('</object>');
}

///////////////////////////////////////////////////////////////////////////////////////////
//Funcao para Verificar tarifa cesta
function fnCheca_Sedex2(nform) 
{
	opcao = document.getElementById("opcao").value;

	//return false;
	//validacao de radio buttons
	marcado = -1
	for (i=0; i<nform.frete.length; i++) {
		if (nform.frete[i].checked) {
			marcado = i
			resposta = nform.frete[i].value
			if (resposta == "sedex" || resposta == "sedex10")
			{
				if(nform.cep.value.length < 8)
					{
						alert("Atenção!\nFavor Preencher o CEP corretamente.");
						nform.cep.focus();
						return false;
					}
			}
		}
}
	
	if (marcado == -1) {
		alert("Atenção!\nSelecione uma das opções de frete.");
		nform.frete[0].focus();
		return false;
	} 
	
	if(opcao == 1)
	{
		if(nform.tarifa.value == "" || nform.tarifa.value == 0)
			{
				alert("Atenção!\nTarifa não foi calculada, aperte o botão atualizar após digitar o cep.");
				return false;
			}
		else
			{
				document.location.href = 'fechamento.asp#pagamentos';
			}
	}
	else if(opcao == 2)
		{
			document.location.href = 'fechamento.asp?acao=S#pagamentos'
		}
	else if(opcao == 3)
		{
			if(nform.str_transportadora.value == "")
				{
					alert("Atenção!\nO campos TRANSPORTADORA deve ser preenchido corretamente.");
					nform.str_transportadora.focus();
					return false;
				}
			else if (nform.str_telefone.value == "")
				{
					alert("Atenção!\nO campos TELEFONE deve ser preenchido corretamente.");
					nform.str_telefone.focus();
					return false;
				}
			else
				{
					document.location.href = 'fechamento.asp?acao=T&transportadora=' + document.getElementById('str_transportadora').value + '&telefone=' + document.getElementById('str_telefone').value+'#pagamentos';
				}
		}
}

///////////////////////////////////////////////////////////////////////////////////////////
//Atualizar Quantidades De Pedidos Da Cesta de Compras
function jReload()
{
	document.formCesta.submit();
}