function flash_banner(arquivo, largura, altura, transparente){
	document.write('<object type="application/x-shockwave-flash" data="'+arquivo+'" width="'+largura+'" height="'+altura+'">');
	document.write('<param name="movie" value="'+arquivo+'" />');
	document.write('<param name="allowScriptAcess" value="sameDomain" />');
	document.write('<param name="quality" value="best" />');
	if (transparente==true) {
		document.write('<param name="wmode" value="transparent">');
	}
	document.write('</object>');
}

function submit_frm_cadastro(){
	document.getElementById('frm_cadastro').action = '/cadastro/?t=n';
	document.getElementById('frm_cadastro').submit();
}

function abrir(div){
	if (document.getElementById(div).style.display == 'none' || document.getElementById(div).style.display == ''){
		document.getElementById(div).style.display = 'block';
	} else {
		document.getElementById(div).style.display = 'none';
	}
	
}

function excluir_endereco(id_endereco){
	if (confirm('Deseja realmente excluir esse endereço?')==true){
		location.href = '/meu-painel/endereco-entrega/excluir/'+id_endereco;
	}
}

function escolhe_frete(){
	document.getElementById('frmcart').submit();	
}

var profiles =
{

	window510:
	{
		height:510,
		width:510,
		status:0,
		center:1,
		resizable:0
	}

};


$(function() {
	$("#img_prod_gde").popupwindow(profiles);
	$("#img_peq_1").popupwindow(profiles);
	$("#img_peq_2").popupwindow(profiles);
	$("#img_peq_3").popupwindow(profiles);
	$("#img_peq_4").popupwindow(profiles);
	$("#bt_indique").popupwindow(profiles);
});

function abas(num_div){
	var div_abre = "div_"+num_div;
	
	if (num_div == 1){
		
		if (document.getElementById('div_1')){
			document.getElementById('div_1').style.display = 'block';
		}
		if (document.getElementById('div_2')){
			document.getElementById('div_2').style.display = 'none';
		}
		if (document.getElementById('div_3')){
			document.getElementById('div_3').style.display = 'none';
		}
		if (document.getElementById('div_4')){
			document.getElementById('div_4').style.display = 'none';
		}
		// link abas
		if (document.getElementById('link_1')){
			document.getElementById('link_1').className = 'ativo';
		}
		if (document.getElementById('link_2')){
			document.getElementById('link_2').className = '';
		}
		if (document.getElementById('link_3')){
			document.getElementById('link_3').className = '';
		}
		if (document.getElementById('link_4')){
			document.getElementById('link_4').className = '';
		}
		
	} else if (num_div == 2){
		
		if (document.getElementById('div_1')){
			document.getElementById('div_1').style.display = 'none';
		}
		if (document.getElementById('div_2')){
			document.getElementById('div_2').style.display = 'block';
		}
		if (document.getElementById('div_3')){
			document.getElementById('div_3').style.display = 'none';
		}
		if (document.getElementById('div_4')){
			document.getElementById('div_4').style.display = 'none';
		}
		
		// link abas
		if (document.getElementById('link_1')){
			document.getElementById('link_1').className = '';
		}
		if (document.getElementById('link_2')){
			document.getElementById('link_2').className = 'ativo';
		}
		if (document.getElementById('link_3')){
			document.getElementById('link_3').className = '';
		}
		if (document.getElementById('link_4')){
			document.getElementById('link_4').className = '';
		}
		
	} else if (num_div == 3){
		
		if (document.getElementById('div_1')){
			document.getElementById('div_1').style.display = 'none';
		}
		if (document.getElementById('div_2')){
			document.getElementById('div_2').style.display = 'none';
		}
		if (document.getElementById('div_3')){
			document.getElementById('div_3').style.display = 'block';
		}
		if (document.getElementById('div_4')){
			document.getElementById('div_4').style.display = 'none';
		}
		
		// link abas
		if (document.getElementById('link_1')){
			document.getElementById('link_1').className = '';
		}
		if (document.getElementById('link_2')){
			document.getElementById('link_2').className = '';
		}
		if (document.getElementById('link_3')){
			document.getElementById('link_3').className = 'ativo';
		}
		if (document.getElementById('link_4')){
			document.getElementById('link_4').className = '';
		}
		
	} else if (num_div == 4){
		
		if (document.getElementById('div_1')){
			document.getElementById('div_1').style.display = 'none';
		}
		if (document.getElementById('div_2')){
			document.getElementById('div_2').style.display = 'none';
		}
		if (document.getElementById('div_3')){
			document.getElementById('div_3').style.display = 'none';
		}
		if (document.getElementById('div_4')){
			document.getElementById('div_4').style.display = 'block';
		}
		
		// link abas
		if (document.getElementById('link_1')){
			document.getElementById('link_1').className = '';
		}
		if (document.getElementById('link_2')){
			document.getElementById('link_2').className = '';
		}
		if (document.getElementById('link_3')){
			document.getElementById('link_3').className = '';
		}
		if (document.getElementById('link_4')){
			document.getElementById('link_4').className = 'ativo';
		}
		
	}
}

function mostra_imagem(imagem){
	document.getElementById('prod_img_gde').src = '/produtos/m2/'+imagem;
}

function esconde_imagem(imagem){
	document.getElementById('prod_img_gde').src = '/produtos/m2/'+imagem;
}

function removendo(){
	// desativando
	$("#c1").removeClass('ctsbtvisa_at');
	$("#c1").addClass('ctsbtvisa');
	
	$("#c2").removeClass('ctsbtmaster_at');
	$("#c2").addClass('ctsbtmaster');
	
	$("#c3").removeClass('ctsbtdiners_at');
	$("#c3").addClass('ctsbtdiners');
	
	$("#c4").removeClass('ctsbtamer_at');
	$("#c4").addClass('ctsbtamer');
	
	$("#c5").removeClass('ctsbtaura_at');
	$("#c5").addClass('ctsbtaura');
	
	$("#d1").css('display','none');
	$("#d2").css('display','none');
	$("#d3").css('display','none');
	$("#d4").css('display','none');
	$("#d5").css('display','none');
}

function fc(id){
	/*
	displayvisa
	displaymaster
	displaydiners
	displayamex
	displayaura
	*/
	if (id == 1){
		removendo()
		// ativando
		$("#c1").addClass('ctsbtvisa_at');
		$("#d1").css('display','block');
	} else if (id == 2){
		removendo()
		// ativando
		$("#c2").addClass('ctsbtmaster_at');
		$("#d2").css('display','block');
	} else if (id == 3){
		removendo()
		// ativando
		$("#c3").addClass('ctsbtdiners_at');
		$("#d3").css('display','block')	
	} else if (id == 4){
		removendo()
		// ativando
		$("#c4").addClass('ctsbtamer_at');
		$("#d4").css('display','block')	
	} else if (id == 5){
		removendo()
		// ativando
		$("#c5").addClass('ctsbtaura_at');
		$("#d5").css('display','block')	
	}
}


















