$(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();
									 });
	
	$('.promo','#copy').cycle({
		fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		,timeout: 8000
	});
	
	$('#serviceRollover').hover(
		function() {
		$('#serviceRollover > div').fadeIn();			
		}
		,function() {
		$('#serviceRollover > div').fadeOut();
		}
	).children('div').hide();
	
	$('#contactTrigger').click(function(){
		var $this = $(this);
		if ($this.hasClass('open')) {
			$this.removeClass('open').siblings('div').fadeOut('fast');
		} else {
			$this.siblings('div').fadeIn('fast').end().addClass('open');
		}
	});
});
