// Nivo Slider Options
$(document).ready(function(){	
	$("#slider").nivoSlider({
		effect:		'random',	//Specify sets like: 'fold, fade, sliceDown'
		slices:		20,
		pauseTime:		5000,
		directionNavHide:	false,
		pauseOnHover:		true,		//Stop animation while hovering
		manualAdvance:	false,		//Force manual transitions
		captionOpacity:	0.8		//Universal caption opacity
	});
	
	
	
});

/* Page Jump */
$('.jump').click(function() {
	var elementClicked = $(this).attr("href");
	var destination = $(elementClicked).offset().top;
	$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination-20}, 1000 );
	return false;
});

$(function(){
	// Clears floated elements
	$("#nav, #slider_container, input.submit, button").after("<div class='clear'></div>");
	$("#body_content, #content, #header, #footer").append('<div class="clear"></div>');
});

$(window).load(function(){
	
	// SuperFish dropDown navigation options
	$("ul#nav").superfish({ 
		animation:		{height:'show', opacity:'show'},
		delay:			100,
		autoArrows:		true,
	    	dropShadows:	false
	});
	
	/* IMAGES ------------------------------------------------------------- */
	// this script is to resize all images by 6px the total px of the padding (2px x 2) and border (1px x 2)
	$("#body_content img").each(function(){
		var newImgWidth = $(this).width() - 6;
		$(this).width(newImgWidth);
		
		var parentHeight = $(this).innerHeight() + 2;
		var parentWidth = $(this).outerWidth();
		var parentCss = {
			  'height' : parentHeight,
			  'width' : parentWidth
			}
		
		if( $(this).parent("a") ){
			$(this).parent("a").css(parentCss)
		}
	});
	
	// adds the dropshadow in the homepage slider
	$("#slider_container").prepend('<span id="slider_bottom_shadow"></span>');
	
	// Adds the curved edges on the dropDown	
	$("ul#nav li > ul.subnav li:first-child").addClass("first_item");
	$("ul#nav li > ul.subnav li:last-child").addClass("last_item");

});

/* Text hide for the contact form */							
$(document).ready(function(){
	$('.hide').each(function() {
	    var default_value = this.value;
	    $(this).css('color', '#a2a2a2');
	    $(this).focus(function() {
	        if(this.value == default_value) {
	            this.value = '';
	            $(this).css('color', '#444444');
	        }
	    });
	    $(this).blur(function() {
	        if(this.value == '') {
	            this.value = default_value;
	            $(this).css('color', '#a2a2a2');
	        }
	    });
	});
});



