function BlockMove(event) {
	// Tell Safari not to move the window.
	event.preventDefault() ;
}
		 
jQuery.fn.center = function () {
	this.css("position","absolute");
	this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
	this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
	return this;
}

$(document).ready(function() {

	$(".ro").hover(
		function() {
	  		this.src = this.src.replace("_off","_over");
	 	},
	 	function() {
	  		this.src = this.src.replace("_over","_off");
	 	}
	);
    
    
    function preload(arrayOfImages) {
	    $(arrayOfImages).each(function(){
	        $('<img/>')[0].src = this;
	        // Alternatively you could use:
	        // (new Image()).src = this;
	    });
	}

	// Usage:
	
	preload([
	    'images/btnAdd_over.png',
	    'images/btnAbout_over.png'
	]);
		
	
	$("#ipad-dim").css("height", $(document).height());
	$("#dim").css("height", $(document).height());
	$("#marker-dim").css("height", $(document).height());
	$("#about-dim").css("height", $(document).height());
		
	$(".alertdim").click(function(){
		$("#dim").fadeIn();
		positionEverything();
		$("body").css("overflow", "hidden");
		return false;
	});
	
	$("#show-about").click(function(){
		$("#about-dim").fadeIn();
		positionEverything();
		$("body").css("overflow", "hidden");
		return false;
	});
	
	$("#closedim").click(function(){
		/*$("#dim").fadeOut();
		$("body").css("overflow", "auto");
		*/
		window.location = '/';
		return false;
	});
	
	$("#closedim").hover(function(){
		$("#closedim").css("color", "#FFFF00");
	}, function(){
		$("#closedim").css("color", "#999");
	});
	
	$(".closeabout").click(function(){
		$("#about-dim").fadeOut();
		$("body").css("overflow", "auto");
		return false;
	});
	
	$(".closeabout").hover(function(){
		$(".closeabout").css("opacity", 1);
	}, function(){
		$(".closeabout").css("opacity", 0.5);
	});
	
	$("#pad-yes").click(function(){
		$("#ipad-dim").fadeOut();
		$("#marker-dim").fadeIn();
		$("body").css("overflow", "auto");
	});
	
	$("#show-marker").click(function(){
		$("#marker-dim").fadeIn();
		$("body").css("overflow", "hidden");
	});
	
	$("#pad-no").click(function(){
		$("#ipad-dim").fadeOut();
		$("body").css("overflow", "auto");
	});
	
	$("#marker-close").click(function(){ 
		$("#marker-dim").fadeOut();
		$("body").css("overflow", "auto");
	});


	$(window).bind("resize", function(){
	 	$("#dim").css("height", $(window).height());
	 	$("#ipad-dim").css("height", $(window).height());
	 	$("#marker-dim").css("height", $(window).height());
	 	$("#about-dim").css("height", $(window).height());
	 	positionEverything();
	});
	
	function positionEverything() {
		$(".msgbox").center();
		$(".ipad-box").center();
		$(".marker-box").center();
		$(".about-box").center();
	}
	
	positionEverything();
	
	$(document).bind("scroll", function(){
	 	positionEverything();
	});		

});
		 	
		 	
		 
		

