(function($) {
	$("body").addClass("jsEnabled");
	
	$("a[rel^='gal']").prettyPhoto({
		theme: 'dark_rounded',
		showTitle: true
	});
	
	$('a').each(function(){
		var href = $(this).attr('href');
		if(href.indexOf('.pdf') != -1){
			$(this).addClass('icon_' + fileType);
		}
	});
	
	// Make legends into H2s for easier styling, while maintaining semantic markup.
	$("legend").each(function(){
		var $this = $(this); 
		var legendText = $this.text();
		$this.parent("fieldset")
			.before("<h2>" + legendText + "</h2>")
			.end()
			.remove();
	});
	
	// Adding hover in IE for non-anchor elements
	$(".hoverEnabled").hover(
		function() {
			$(this).addClass("hover");
		},
		function(){
			$(this).removeClass("hover");
		}
	);
	
	//Add zebra-striping to tables
	if ( !$("table").hasClass("noStripe") ) {
		$("table tr:odd").addClass("odd");
	}
	
	//Automatically selects focused field text and adds class for styling
	$('input[type="text"]').focus(function(){
		$(this).select().addClass("focused");
	});
	$('input[type="text"]').blur(function(){
		$(this).removeClass("focused");
	});
	
	
	$("#contactUsForm-details-helpDetails").hide(); // Close contactUsForm-details-helpDetails div on load
	
	$("#projectInfo").parent("p").addClass("active").end().toggle(function(){
			$("#contactUsForm-details-helpDetails").show();
		}, function(){
			$("#contactUsForm-details-helpDetails").hide();
		}
	);
	
	// Google map init.
	var map = $("#map:first");
	if ( map.length > 0 ) {
	    var plauditLatlng = new google.maps.LatLng(44.964662, -93.200303);
	    var myOptions = {
	      zoom: 15,
	      center: plauditLatlng,
	      navigationControl: true,
	      navigationControlOptions: {
	    	style: google.maps.NavigationControlStyle.ZOOM_PAN
	    	},

	      mapTypeId: google.maps.MapTypeId.ROADMAP
	    }
	    var map = new google.maps.Map(map.get(0), myOptions);
	    
	    var image = "http://www.plauditdesign.com/images/plaudit-map-icon.png";
	    
	    var plauditOffice = new google.maps.Marker({
	        position: plauditLatlng,
	        map: map,
	        icon: image
	    });
	}
	
	
})(jQuery); 


jQuery(window).load(function(){
	//portfolio slider
	jQuery("div#portfolioSlideView:first").slideView({
		toolTip: true
	});
});