$(document).ready(function() {
    if($.browser.msie && ($.browser.version < 7)){ 
		$("body").addClass("ie"); 
		DD_belatedPNG.fix(".fix, span.ilustraPreHome, span.ilustraHome286x540, span.ilustraHome, h1 a, .destFutebas, .destGlacialFest, .destChurras, .contentInterna, .bgTopInterna, .bgBotInterna, .bgHellen615x154");
	}
    $(".formValidate").validate({ errorContainer: $(".msgError"), errorLabelContainer: $(".msgError") });
    
/*   
    $(".btnSim").click(function(){
	$(".maiorIdade").hide();
	$(".boxEstado").fadeIn();
	return false;
    });
    $(".btnNao").click(function(){
	$(".maiorIdade").hide();
	$(".boxObrigado").fadeIn();
	return false;
    });*/
    
    $("input[name='url']").click(function(){
	$(this).focus();
	$(this).select();
    });
    
    $("ul.listResultados li:last, .left300x512 .item:last").addClass("last");
    
    $(".boxCarousel ul").jcarousel({ vertical: true, scroll: 2, wrap: 'last' });
    $(".boxCarousel2 ul").jcarousel({ vertical: true, scroll: 2, wrap: 'last' });	

    $(".number").keypress(function(e){ 
	if(e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)){
	    return false;
	}
    });
    
    $("input + label").click(function() {
	if ($(this).prev().attr("type") == 'checkbox') {
	    if ($(this).prev().is(":checked")) {
		$(this).prev().attr("checked", false);
	    } else {
		$(this).prev().attr("checked", true);
	    }
	} else {
	    $(this).prev().attr("checked", true);
	}
    });
    
});


jQuery.validator.addMethod("cpf", function(value, element) {
    cpf = value.toString().replace( /\.|\-/g, "" );
    var expReg = /^0+$|^1+$|^2+$|^3+$|^4+$|^5+$|^6+$|^7+$|^8+$|^9+$/;
    if (cpf.length != 11 || cpf.match(expReg) ){ return false; }
    add = 0;
    for (i=0; i < 9; i ++){
	add += parseInt(cpf.charAt(i)) * (10 - i);
    }
    rev = 11 - (add % 11);
    if (rev == 10 || rev == 11){ rev = 0; }	
    if (rev != parseInt(cpf.charAt(9))){ return false; }	
    add = 0;
    for (i = 0; i < 10; i ++){
	add += parseInt(cpf.charAt(i)) * (11 - i);
    }
    rev = 11 - (add % 11);
    if (rev == 10 || rev == 11){ rev = 0; }
    if (rev != parseInt(cpf.charAt(10))){ return false; }
    return true;
}, "Informe um CPF v?lido.");

jQuery.validator.addMethod("dia", function(value, element) {
    return value <= 31;
}, "Data invÄlida" );

jQuery.validator.addMethod("mes", function(value, element) {
    return value <= 12;
}, "MÁs invÄlido" );

