
$(document).ready(function() {
    
	/*------- Alternated row Colors -------*/
	$("tr:even").css("background-color", "#F7F7F7");
	
	/*------- Hiding Portfolio Labels -------*/
    $(".folio-box .inner").hover( 
      function () {
        $(this).parent().find(".proj-label").slideUp("fast");
      }, 
      function () {
        $(this).parent().find(".proj-label").slideDown();
      }
    );
        
        /* Nova Validação Lucien */
        $("#contact-form form").submit(function(){
            var name = $("#name").val();
            var erro = false;
            var mail = $("#mail").val();
            var message = $('#message').val()
            if(name.length < 3){
                $("#name").css("background","#ffc9c9");
        	$("#name").css("border-color","#ff4f4f");
                erro = true;
            }
            
            if(message.length < 6){
                $("#message").css("background","#ffc9c9");
        	$("#message").css("border-color","#ff4f4f");
                erro = true;
            }
            
            if(mail.length < 6){
                erro = true;
                $("#mail").css("background","#ffc9c9");
        	$("#mail").css("border-color","#ff4f4f");
                erro = true;
            }else{
                var emailFilter=/^.+@.+\..{2,}$/;
                var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/;
                if (!(emailFilter.test(mail))||mail.match(illegalChars)) {
                    $("#mail").css("background","#ffc9c9");
                    $("#mail").css("border-color","#ff4f4f");
                    
                    erro = true;
                }
            }
            if(erro){
                alert("Verifique os campos Nome, E-mail e Mensagem");
                return false;
            }
            
        })
        
	
	/*------- Contact Form Validation -------*/        
        
	/* On focus change input and textarea color */
    $("#contact-form input, #contact-form textarea").focus(function () {
        /* Style */
        $(this).css("background","#FDFFCA");
        $(this).css("border-color","#DBDF6F");
    });
	/* On blur */
    $("#contact-form input, #contact-form textarea").blur(function () {
        var inputVal = jQuery.trim($(this).val()); /* Grabs actual input value and removes white space before and after it! */
        $(this).val(inputVal); /* Re-add the input without spaces */

        /* Style */
         $(this).css("background","white");
         $(this).css("border-color","#b7ddf2");

        /* Grabs input title="" */
        var checkReq = $(this).attr("title"); 
        if (checkReq == "required" && inputVal == "") { /* If the title correspond to "required" AND the input is blank */
            $(this).css("background","#ffc9c9");
            $(this).css("border-color","#ff4f4f");
        } else {
            $(this).css('background','#C9FFD0'); 
            $(this).css("border-color","#4FFF56");
        }
    });
	
	
	/*------- Homepage Slides -------*/
	if ($("#slides-dock").length > 0) {
	
			$('#slides-dock').cycle({
				fx: "fade",
				slideExpr: "img",
				
				before: function() {
					$("#slide-label").fadeOut();
				},
				after: function() {
					$("#slide-label").fadeIn().html(this.alt);
				}
			});
		
	};

	/*------- Showcase FancyBox (lightbox) -------*/
	if ($("a.jfancy").length > 0) {
	
		$("a.jfancy").fancybox({
			overlayOpacity: 0.6
		});
			
	};
		
})

