$(document).ready(function() {
    RS.initUI();
    RS.initEvents();
    RS.initMap();
});

var RS = {
    initUI: function() {
	var fadeables = $('#header h1, #header ul li, #projects ul li').css('opacity', 0);
	var i = 0;
	(function() {
	    $(fadeables[i++]).animate({
		opacity: 1
	    }, 400, arguments.callee);
	})();
    },
    initEvents: function() {
	var projects = $('#projects ul li');
	projects.hover(function() {
	    $(this).find('.details').stop(true, false).animate({
		bottom: 0
	    }, 200)
	}, function() {
	    $(this).find('.details').stop(true, false).animate({
		bottom: -125
	    }, 200)
	});
    },
    initMap: function() {
	var overlay;
	    
	var pos = new google.maps.LatLng(40.722933,-74.028111);
	var opts = {
	    zoom: 14,
	    center: pos,
	    disableDefaultUI: true,
	    mapTypeId: google.maps.MapTypeId.ROADMAP
	};
	var map = new google.maps.Map(document.getElementById("map"), opts);
	map.position = 'fixed';
	    
	overlay = new google.maps.OverlayView();
	overlay.draw = function() { };
	overlay.setMap(map);
	
	/*
	var playCoords = [
	    new google.maps.LatLng(40.725194,-74.042101),
	    new google.maps.LatLng(40.728088,-74.041693),
	    new google.maps.LatLng(40.72882,-74.049933),
	    new google.maps.LatLng(40.725925,-74.050426)
	];
	    
	var workCoords = [
	    new google.maps.LatLng(40.726901,-73.999937),
	    new google.maps.LatLng(40.725047,-73.995323),
	    new google.maps.LatLng(40.723437,-73.996675),
	    new google.maps.LatLng(40.722234,-73.997147),
	    new google.maps.LatLng(40.718396,-74.00058),
	    new google.maps.LatLng(40.721356,-74.004636)
	];
	    
	var playPolygon = new google.maps.Polygon({
	    paths: playCoords,
	    strokeColor: "#95C4E9",
	    strokeOpacity: 1,
	    strokeWeight: 2,
	    fillColor: "#95C4E9",
	    fillOpacity: 0.5
	});
	    
	var workPolygon = new google.maps.Polygon({
	    paths: workCoords,
	    strokeColor: "#95C4E9",
	    strokeOpacity: 1,
	    strokeWeight: 2,
	    fillColor: "#95C4E9",
	    fillOpacity: 0.5
	});
	    
	playPolygon.setMap(map);
	workPolygon.setMap(map);
	*/
    }
}
