$(function(){
	
	/**
	 * DEFAULTS
	 **/
	
	// Alert/Flash Message
	setTimeout(hideAlert,4000);
	$("#alert-message").click(function(){
	    hideAlert();
	});
	function hideAlert(){
	    if ($("#alert-message")[0]) { $("#alert-message").slideUp('fast'); }
	}
	
	// END
	
	/**
	 * TARGET BLANK
	 */
	$('.target-blank').click(function(){
		$(this).attr('target', '_blank').click();
		return false;
	});
	
	// Dropdown Nav Main
	$(".drop").hide();
	
	$("ul#nav li.navigation").hover(function(){
		$(this).addClass("hover-li-main");
        $('ul:first',this).stop(true, true).slideToggle('fast');
        
    }, function(){	
    	$(this).removeClass("hover-li-main");
        $('ul:first',this).stop(true, true).slideUp('fast');
    });
    
    // Dropdown login
	$(".dropLogin").hide();
	
	/* Pode substituir todo o JS do Dropdown */
/* Dropdown Comment */
    $(".box-form-comment").hide();
   
   $('a.link').toggle(
       function() {
            $('.dropLogin').slideDown(200).css('display','block');
            $(".dropLogin li .box-form-comment").fadeIn("fast");
       },
       function() {
       		
            $('.dropLogin').slideUp(200).css('display','block');
            $('.dropLogin').fadeOut("fast");
       });
    /* End Dropdown Comment */

	
	//highlight
	$("#featured > ul").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 9000, true);
	
	var v = $(".contact-form").jcheck({language: 'pt-br'});
	v.validates("name","subject", {presence: true});
	v.validates("email", {format: {"with": "email", message: "Digite um e-mail válido"}});
	v.validates("message", {length: {minimum: 5, maximum: 255}});
	
	/* Hide Values Default Form Home */
	$('.student_portal input[type="text"], .student_portal input[type="password"]').each(function(index) {
        var valor_previous = $(this).val();
        $(this).focusin(function() {
            var self = $(this);
            var valor = self.val();
            if(valor == valor_previous){
                self.val("");
            }
 
        }).focusout(function() {
            var valor = $(this).val();
            if(valor == ''){
                $(this).val(valor_previous);
            }
        });
    });
	/* End Hide Values Default Form Home */
});
