$(function() { 
		// =========================================
		// Make external links open in a new window 
		// =========================================
		$('a[href^="http"]').not('[href*="' + location.host + '"]')
			.each(function() {
				var $this = $(this);
				var oldtitle = $this.attr("title");
				$this.attr({target: "_blank", title: (oldtitle.length) ? "Opens in a new window: " + oldtitle : "Opens in a new window"})
				.click(function(){ // Add Analytics tracking to external links
					if(_gaq) { _gaq.push(['_trackEvent', 'outgoing_links', this.href]); }
					}); // END Add Analytics tracking to external links
			 });
		
		// Add Analytics tracking to document links
		$('a[href$=".pdf"], a[href$=".doc"], a[href$=".xls"], a[href$=".ppt"], a[href$=".rtf"]').click(function(){ 
			if (_gaq) { _gaq.push(['_trackEvent', 'downloads', this.href]); }
			}); // END Add Analytics tracking to document links
	if( !Modernizr.inputtypes.date ) {
		Date.firstDayOfWeek = 0;
		$('input[type=date]').datePicker().val(new Date().asString());
	}

	if( !Modernizr.input.placeholder ) {
		$('input[placeholder]').placeholder({blankSubmit:true});
	}
	
	$('form.validate').each(function(){
						$(this).validate();
									 });
	
	$('#nivoWrap').nivoSlider({
			effect:'random', //Specify sets like: 'fold,fade,sliceDown'
			slices:8,
			animSpeed:500,
			pauseTime:6000,
			startSlide:Math.floor(Math.random() * $("#nivoWrap").children('img').length), //Set starting Slide (0 index)
			directionNav:false, //Next & Prev
			directionNavHide:false, //Only show on hover
			controlNav:false, //1,2,3...
			controlNavThumbs:false, //Use thumbnails for Control Nav
		  	controlNavThumbsFromRel:false, //Use image rel for thumbs
			controlNavThumbsSearch: '.jpg', //Replace this with...
			controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
			keyboardNav:false, //Use left & right arrows
			pauseOnHover:false, //Stop animation while hovering
			manualAdvance:false, //Force manual transitions
			captionOpacity:0.8, //Universal caption opacity
			beforeChange: function(){},
			afterChange: function(){},
			slideshowEnd: function(){} //Triggers after all slides have been shown
		});
	
	$('#header .contactLink').delay(500).animate({height: '53px'});
});
