// JavaScript Document
var GB_ANIMATION = true;

$("document").ready(function(){
			
	// todos os comportamentos InClient irão aqui...
	
	// Inicializando componentes e atributos:	
	$("#btEmpresarial").addClass("MouseHand");
	$("#imgBtPlano1").addClass("MouseHand");
	$("#imgBtPlano2").addClass("MouseHand");
	$("#imgBtPlano3").addClass("MouseHand");
	
	$("#descPlano1").html("Ideal para voc&ecirc; estudar, ouvir m&uacute;sicas, assistir v&iacute;deos, consultar e-mails com velocidade.");
	$("#descPlano2").html("Para quem precisa de uma navega&ccedil;&atilde;o de alta performance e agilidade em seus downloads.");
	$("#descPlano3").html("Velocidade incr&iacute;vel a toda hora do dia. Fa&ccedil;a downloads em tempo recorde.");
	
	$("#codPlano1").attr("value","11");
	$("#codPlano2").attr("value","12");
	$("#codPlano3").attr("value","13");	
	
	/* Definições de Funções 'handlers' para eventos */
	function exibirTelaFundo(){
		var telaH = document.body.clientHeight+60;
		var telaW = document.body.clientWidth;
		$("#thunderboxFundo").css({visibility: "visible"});
		$("#thunderboxImgFundo").width(telaW).height(telaH);
	}
	function ocultarTelaFundo(){
		$("#thunderboxFundo").css({visibility: "hidden"});		
	}	
	function exibirQueroPlano(tipoPlano){
		exibirTelaFundo();		
		var telaW = document.body.clientWidth;
		var posXForm = (telaW/2)-(320/2);		
		$("html, body").animate({scrollTop: $("#queroPlanoAncora").offset().top}, 1000);
		$("#thunderboxQueroPlanoPlanoDesc img").attr("src","images/queroplano/queroplanodesc_"+tipoPlano+".gif")
		$("#thunderboxQueroPlano").css({left:posXForm+"px"});
		$("#thunderboxQueroPlano").css({visibility:"visible"});
		switch(eval(tipoPlano)){
			
			case 11:
				$("#txtNomePlanoEscolhido").val($("#txtNomePlano1").val());			
				$("#txtValorPlanoEscolhido").val($("#txtValorPlano1").val());
				break;
			case 12:
				$("#txtNomePlanoEscolhido").val($("#txtNomePlano2").val());			
				$("#txtValorPlanoEscolhido").val($("#txtValorPlano2").val());
				break;
			case 13:
				$("#txtNomePlanoEscolhido").val($("#txtNomePlano3").val());			
				$("#txtValorPlanoEscolhido").val($("#txtValorPlano3").val());
				break;
			case 21:
				$("#txtNomePlanoEscolhido").val($("#txtNomePlano1").val());			
				$("#txtValorPlanoEscolhido").val($("#txtValorPlano1").val());
				break;
			case 22:
				$("#txtNomePlanoEscolhido").val($("#txtNomePlano2").val());			
				$("#txtValorPlanoEscolhido").val($("#txtValorPlano2").val());
				break;
			case 23:
				$("#txtNomePlanoEscolhido").val($("#txtNomePlano3").val());			
				$("#txtValorPlanoEscolhido").val($("#txtValorPlano3").val());
				break;
			default:
				break;
		}
	}
	
	
	// Fim inicialização de atributos
		
	/* Efeito do Botão Residencial */
	$("#btResidencial").click(function(e){
		$("#txtTipoPlano").val("Residencial");
		if($(this).attr("src") == "images/planos/residencial2.gif"){
			$("#codPlano1").attr("value","11");
			$("#codPlano2").attr("value","12");
			$("#codPlano3").attr("value","13");
			$(this).attr("src", "images/planos/residencial1.gif");
			$(this).removeClass();
			$("#btEmpresarial").attr("src","images/planos/empresarial2.gif");
			$("#btEmpresarial").addClass("MouseHand");
			
			$("#imgTituloPlano1").attr("src","images/planos/titulo1_1.png");
			$("#imgTituloPlano2").attr("src","images/planos/titulo1_2.png");
			$("#imgTituloPlano3").attr("src","images/planos/titulo1_3.png");
			
			$("#imgPlano1").css({background:"url(images/planos/valorPlano1_1.gif) no-repeat 5px 5px"});
			$("#imgPlano2").css({background:"url(images/planos/valorPlano1_2.gif) no-repeat 5px 5px"});
			$("#imgPlano3").css({background:"url(images/planos/valorPlano1_3.gif) no-repeat 5px 5px"});
			
			$("#descPlano1").html("Ideal para voc&ecirc; estudar, ouvir m&uacute;sicas, assistir v&iacute;deos, consultar e-mails com velocidade.");
			$("#descPlano2").html("Para quem precisa de uma navega&ccedil;&atilde;o de alta performance e agilidade em seus downloads.");
			$("#descPlano3").html("Velocidade incr&iacute;vel a toda hora do dia. Fa&ccedil;a downloads em tempo recorde.");
			
			// config nome planos
			$("#txtNomePlano1").attr("value","Plano IVR 500");
			$("#txtNomePlano2").attr("value","Plano IVR 1000");
			$("#txtNomePlano3").attr("value","Plano IVR 2000");
			
			// config valor planos
			$("#txtValorPlano1").attr("value","R$ 59,90");
			$("#txtValorPlano2").attr("value","R$ 79,00");
			$("#txtValorPlano3").attr("value","R$ 199,00");
		}		
	});
	
	/* Efeito do Botão Empresarial */
	$("#btEmpresarial").click(function(e){
		$("#txtTipoPlano").val("Empresarial");
		if($(this).attr("src") == "images/planos/empresarial2.gif"){
			$("#codPlano1").attr("value","21");
			$("#codPlano2").attr("value","22");
			$("#codPlano3").attr("value","23");
			$(this).attr("src", "images/planos/empresarial1.gif");
			$(this).removeClass();
			$("#btResidencial").attr("src","images/planos/residencial2.gif");
			$("#btResidencial").addClass("MouseHand");
						
			$("#imgTituloPlano1").attr("src","images/planos/titulo2_1.png");
			$("#imgTituloPlano2").attr("src","images/planos/titulo2_2.png");
			$("#imgTituloPlano3").attr("src","images/planos/titulo2_3.png");
			
			$("#imgPlano1").css({background:"url(images/planos/valorPlano2_1.gif) no-repeat 5px 5px"});
			$("#imgPlano2").css({background:"url(images/planos/valorPlano2_2.gif) no-repeat 5px 5px"});
			$("#imgPlano3").css({background:"url(images/planos/valorPlano2_3.gif) no-repeat 5px 5px"});
			
			$("#descPlano1").html("Sua empresa conectada com o mundo em tempo integral.");
			$("#descPlano2").html("Super velocidade em conex&atilde;o 24 horas por dia para sua empresa.");
			$("#descPlano3").html("Conex&atilde;o m&aacute;xima para empresas que precisam de alta performance o dia todo.");
			
			// config nome planos
			$("#txtNomePlano1").attr("value","Plano Link 512");
			$("#txtNomePlano2").attr("value","Plano Link 1Mb");
			$("#txtNomePlano3").attr("value","Plano Link 2Mb");
			
			// config valor planos
			$("#txtValorPlano1").attr("value","R$ 499,00");
			$("#txtValorPlano2").attr("value","R$ 799,00");
			$("#txtValorPlano3").attr("value","R$ 999,00");
		}		
	});
	
	/* Comportamento dos botõrs dos planos */
	$("#imgBtPlano1").click(function(){
		exibirQueroPlano($("#codPlano1").attr("value"));
	});
	$("#imgBtPlano2").click(function(){						 
		exibirQueroPlano($("#codPlano2").attr("value"));
	});
	$("#imgBtPlano3").click(function(){						 
		exibirQueroPlano($("#codPlano3").attr("value"));
	});	
	
	$("#btConsulte").click(function(){
		window.location.href = "hospedagem.php";							
	});
});

