$(document).ready(function(){
	
// ----->  menu superior - descer container de links rapidos
$('.BoxSelect div').hide();
	
	$(".BoxSelect > a").click(function(e){
		e.preventDefault();
		
		if($(this).next().css("display")!="none"){
		  $(this).next().slideToggle(200);
		
		}else{
		  $('.BoxSelect div').slideUp(200);
		  $(this).next().slideToggle(200);
		}
	
		return false;
	});
	
// ----->  fechar menu de login	
$('.login-fechar').click(function(e){
	e.preventDefault();
	$('.BoxSelect div').slideUp('slow');
});

// ----->  fechar content de suporte
$('#fastHelp .BoxSelect').click(function(e){
	$('.BoxSelect div').slideUp('slow');
});

// -----> main menu controls
$("#mainMenu div").hide();

$("#mainMenu ul li").hover(function(e) { 
		e.preventDefault();
		$(this).find("span").fadeIn(500); ; 
	
	}, function() { 
		//$(this).css({ 'background' : 'none'});
		//$(this).find("span").hide();
		$(this).find("span").fadeOut(200).hide() ; 
});

// -----> mais telefones de suporte
telefoneAberto = 0;
$(".lineCitys3").click(function(e){
	
	e.preventDefault();
	
	$("#teles")[0].reset();
	
	if(telefoneAberto == 0){
		$("#telefonesGlobais").show(300);
		telefoneAberto++;
	}else{
		$("#telefonesGlobais").hide(300);
		telefoneAberto=0;
	}
	
	$("#teleEstados").html('<span>'+ teleCityes['RJ'] + '</span>');
	
});

// -----> mais telefones de suporte
telefoneAberto = 0;
$(".lineCitys").click(function(e){
	
	e.preventDefault();
	
	$("#teles")[0].reset();
	
	if(telefoneAberto == 0){
		$("#telefonesGlobais").show(300);
		telefoneAberto++;
	}else{
		$("#telefonesGlobais").hide(300);
		telefoneAberto=0;
	}
	
	$("#teleEstados").html('<span>'+ teleCityes['RJ'] + '</span>');
	
});


$("#telefonesGlobais a").click(function(e){
	e.preventDefault();
	
	$("#telefonesGlobais").hide(300)
	telefoneAberto = 0
	$("#teles")[0].reset();
	
});

// -----> mais atendimento online
AtendimentoAberto = 0;
$(".lineCitys2").click(function(e){
    e.preventDefault();
    $("#atend")[0].reset();
    $("html, body").animate({scrollTop:0}, "slow");

    if(AtendimentoAberto == 0){
            $("#atendimentoGlobais").show(300);
            AtendimentoAberto++;
    }else{
            $("#atendimentoGlobais").hide(300);
            AtendimentoAberto=0;
    }
});

$("#atendimentoGlobais a").click(function(e){
    e.preventDefault();

    $("#atendimentoGlobais").hide(300)
    AtendimentoAberto = 0
    $("#atend")[0].reset();
});


// telefones
teleCityes = []

/*teleCityes['AC'] = '(68) 4007-1200 | Rio Branco ';
teleCityes['AL'] = '(82) 4007-1200 | Maceió ';
teleCityes['AP'] = '(96) 4007-1200 | Macapá ';
teleCityes['AM'] = '(92) 4007-1200 | Manaus ';
teleCityes['BA'] = '(71) 4007-1200 | Salvador ';
teleCityes['CE'] = '(88) 4007-1200 | Fortaleza ';
teleCityes['DF'] = '(61) 4007-1200 | Brasília ';
teleCityes['ES'] = '(27) 4007-1200 | Vitória ';
teleCityes['GO'] = '(62) 4007-1200 | Goiânia ';
teleCityes['MA'] = '(98) 4007-1200 | São Luís ';
teleCityes['MT'] = '(65) 4007-1200 | Cuiabá ';
teleCityes['MS'] = '(67) 4007-1200 | Campo Grande ';
teleCityes['MG'] = '(31) 4007-1200 | Belo Horizonte ';
teleCityes['PA'] = '(91) 4007-1200 | Belém   ';
teleCityes['PB'] = '(83) 4007-1200 | João Pessoa  ';
teleCityes['PR'] = '(41) 4007-1200 | Curitiba  <br /> (45) 4007-1200 | Cascável <br /> (46) 4007-1200 | Francisco Beltrão <br /> (43) 4007-1200 | Londrina <br /> (42) 4007-1200 | Ponta Grossa ';
teleCityes['PE'] = '(81) 4007-1200 | Recife  ';
teleCityes['PI'] = '(86) 4007-1200 | Teresina  ';
teleCityes['RJ'] = '(21) 4007-1200 | Rio de Janeiro  <br /> (21) 3879-5400 | Rio de Janeiro <br /> (21) 3879-5407 | Fax Rio de Janeiro';
teleCityes['RN'] = '(84) 4007-1200 | Natal  ';
teleCityes['RS'] = '(51) 4007-1200 | Porto Alegre <br /> (54) 4007-1200 | Caxias do Sul <br /> (53) 4007-1200 | Pelotas <br /> (55) 4007-1200 | Santa Maria ';
teleCityes['RO'] = '(69) 4007-1200 | Porto Velho ';
teleCityes['RR'] = '(95) 4007-1200 | Boa Vista  ';
teleCityes['SC'] = '(48) 4007-1200 | Florianópolis  ';
teleCityes['SP'] = '(11) 4007-1200 | São Paulo <br /> (19) 4007-1200 | Campinas  <br /> (13) 4007-1200 | Santos <br /> (15) 4007-1200 | Sorocaba ';
teleCityes['SE'] = '(79) 4007-1200 | Aracajú ';
teleCityes['TO'] = '(63) 4007-1200 | Palmas  ';*/

teleCityes['MG'] = '(31) 4042-2260 | Belo Horizonte ';
teleCityes['PR'] = '(41) 4042-2412 | Curitiba';
teleCityes['RJ'] = '(21) 3879-5400 | Rio de Janeiro <br /> (21) 3879-5407 | Fax Rio de Janeiro';
teleCityes['SP'] = '(11) 3230-8200 | São Paulo <br /> (11) 3717-5231 | São Paulo';

$('#headerEstado').change(function() {
   
   $("#teleEstados").html();
   
   var varURL = $("option:selected", this).val();
   
	$("#teleEstados").html('<span>'+ teleCityes[varURL] + '</span>');
   
});

//######################################################################
//### ABAS DA HOME DE HOSPEDAGEM
//######################################################################

	$("div.abahome").hide();
	$("div.abahome:first").show();
	
	$("#abasHome a:first").addClass("ativa");
	
	$("#abasHome a").click(function(e){
		
		e.preventDefault()
		
		$("div.abahome").hide();
		$("#abasHome a").removeClass("ativa");
		$(this).addClass("ativa");
		
		$( $(this).attr("name") ).show();
		
 });
 
//######################################################################
//### ABAS DOS PLANOS DE HOSPEDAGEM
//######################################################################

//--------------------> abas internas para os planos
	$("div.contaba").hide();
	$("div.contaba:first").show();
	
	$("#rjAbas a:first").addClass("selected");
	$("#rjAbas li:first").addClass("selected");
	
	$("#rjAbas li").click(function(e){
		
		e.preventDefault()
		
		$("div.contaba").hide();
		$("#rjAbas a").removeClass("selected");
		$("#rjAbas li").removeClass("selected");
		
		$(this).addClass("selected");
		$(this).find("a").addClass("selected");
		
		$($(this).find("a").attr("name")).show();
		
 });
 
    $("#atend").validate({
            rules: {
                    'from_screen_name': {
                            required: true,
                            minlength: 6,
                            maxlength: 100
                    },
                    'email': {
                            required: true,
                            minlength: 6
                    }
            },
            messages: {
                'from_screen_name': '',
                'email': ''
            },
            submitHandler: function() {
                window.open('', 'formpopup', 'width=400,height=400,resizeable,scrollbars');
                this.target = 'formpopup';
                $("#atendimentoGlobais").hide(300);
                AtendimentoAberto = 0;
                this.submit();
            }
    });

// end of document ready
});
