jQuery(document).ready(function(){

	$("p").hide();

	$("img").click(function(){
	if($(this).prev().css("display")=="none")
		{
			jumpToTop();$(this).prev().fadeIn("slow");
		}
		else
		{
			$(this).prev().fadeOut("slow");
		}
	});
	$("p").click(function(){$(this).fadeOut("slow");});
	window.addEventListener("orientationchange", jumpToTop, false);
	window.addEventListener("load", jumpToTop, false);
});

jumpToTop = function()
{
	var orientation = window.orientation;
	
	switch (orientation) {

		// horizontal
		case 90:
		case -90:

			document.body.setAttribute("orient", "landscape");
			setTimeout(function(){window.scrollTo(0, 180);}, 100);
			break;	

			// vertical
		default:
			document.body.setAttribute("orient", "portrait");
			setTimeout(function(){window.scrollTo(0, 1);}, 100);
			break;
	}
}

