/*	
	CleanCorp - Business Template
*/

$(window).load(function() {
   $('#slider').nivoSlider({
		effect:'random', //Specify sets like: 'fold,fade,sliceDown'
		animSpeed:500,
		pauseTime:3000,
		startSlide:0, //Set starting Slide (0 index)
		directionNav:false, //Next & Prev
		directionNavHide:false, //Only show on hover
		controlNav:false, //1,2,3...
		keyboardNav:true, //Use left & right arrows
		pauseOnHover:true, //Stop animation while hovering
		manualAdvance:false, //Force manual transitions
		captionOpacity:0.8, //Universal caption opacity
	});
});

$(document).ready(function() {
	
	/*** Dropdown fade ***/
 	$("ul#navigation li").mouseenter(function(){
		$(this).find("ul").hide().slideDown(250);
    })

	/*------- Alternated row Colors -------*/
	$("tr:even").css("background-color", "#F7F7F7");

	/*** 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");
		
		var checkReq = $(this).attr("title"); /* Grabs input 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");
		}
	});
	
});