$(function() {
$("nav ul.topmenu a.active").animate({"padding-left":"20px"},400, function () {
	
	$(this).animate({"padding-left":"0px"},400)
	})
	
if ($('.contenthome-view-gallery').length)	
	$(window).bind("load resize", function(){ 
	$('.contenthome-view-gallery').jScrollPane({});
	});
	
if ($('#gallery').length)	
	var myPhotoSwipe = $("#gallery a").photoSwipe({ enableMouseWheel: false , enableKeyboard: true});
	
	
	if ($('#contact_form').length)	
		$("#contact_form").validate({
  submitHandler: function(form) {
       $.post('mailer.php', $('#contact_form').serialize(), function(data) {
     $('.contactform').html("<h1>Thank you!</h1>");
   });
     }
 });
	
	    
	if ($('.pressbox').length)	
	$(window).bind("load resize", function(){ 
	$('.pressbox').jScrollPane({});
	});
	
	$(".logobottom").fadeOut(500, function () {
		$(this).fadeIn(500);
		});
		
if ($('.index-pic').length)
$(window).bind("load resize", function(){		
$("#root.index").height($(".index-pic").height());	
});

	
	
	
	
	
	
if ($('#map_canvas').length)	{
	
	  var chicago = new google.maps.LatLng(40.717989272649, -73.96161317825317),
          pointToMoveTo, 
          first = true,
          curMarker = new google.maps.Marker({})
          
      
      var myOptions = {
          zoom: 16,
          center: chicago,
          mapTypeId: google.maps.MapTypeId.ROADMAP
        };
      
      var map = new google.maps.Map($("#map_canvas")[0], myOptions);
    
     curMarker.setMap(); 
          
          
          pointToMoveTo = new google.maps.LatLng(40.718834964282536, -73.96403789520264);
          
          
          // Add new marker
          curMarker = new google.maps.Marker({
              position: pointToMoveTo,
              map: map,
              icon: "img/marker.png"
          });
          
}


   	if ($('.mapnavpanel').length)	
	$(window).bind("load resize", function(){ 
	$('.mapnavpanel').jScrollPane({});
	});   
});
