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
	}, 
	voip:
	{
		height:570,
		width:320,
		status:0,
		center:1,
		resizable:0
	}, 
	videopop:
	{
		height:405,
		width:500,
		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);
	$("#btvoip").popupwindow(profiles);
	$("#vervideo").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('ccvis_at');
	$("#c1").addClass('ccvis');
	
	$("#c2").removeClass('ccmas_at');
	$("#c2").addClass('ccmas');
	
	$("#c3").removeClass('ccdin_at');
	$("#c3").addClass('ccdin');
	
	$("#c4").removeClass('ccame_at');
	$("#c4").addClass('ccame');
	
	$("#c5").removeClass('ccaur_at');
	$("#c5").addClass('ccaur');
	
	$("#c6").removeClass('cchip_at');
	$("#c6").addClass('cchip');
	
	$("#d1").css('display','none');
	$("#d2").css('display','none');
	$("#d3").css('display','none');
	$("#d4").css('display','none');
	$("#d5").css('display','none');
	$("#d6").css('display','none');
}

function fc(id){
	/*
	displayvisa
	displaymaster
	displaydiners
	displayamex
	displayaura
	*/
	if (id == 1){
		removendo()
		// ativando
		$("#c1").addClass('ccvis_at');
		$("#d1").css('display','block');
	} else if (id == 2){
		removendo()
		// ativando
		$("#c2").addClass('ccmas_at');
		$("#d2").css('display','block');
	} else if (id == 3){
		removendo()
		// ativando
		$("#c3").addClass('ccdin_at');
		$("#d3").css('display','block')	
	} else if (id == 4){
		removendo()
		// ativando
		$("#c4").addClass('ccame_at');
		$("#d4").css('display','block')	
	} else if (id == 5){
		removendo()
		// ativando
		$("#c5").addClass('ccaur_at');
		$("#d5").css('display','block')	
	} else if (id == 6){
		removendo()
		// ativando
		$("#c6").addClass('cchip_at');
		$("#d6").css('display','block')	
	}
}

function aba_cc(div){
	if (div == 'parc_visa'){
		document.getElementById('parc_master').style.display = 'none';
		document.getElementById('parc_visa').style.display = 'block';
		document.getElementById('cc_mc').className = 'mc';
		document.getElementById('cc_vv').className = 'vi-ativo';
		document.getElementById('forma_pg').value = 'visa';
	} else {
		document.getElementById('parc_master').style.display = 'block';
		document.getElementById('parc_visa').style.display = 'none';
		document.getElementById('cc_mc').className = 'mc-ativo';
		document.getElementById('cc_vv').className = 'vi';
		document.getElementById('forma_pg').value = 'master';
	}
}















