		$(window).load(function(){
		
			//ipad fix
			if(navigator.platform == 'iPad' || navigator.platform == 'iPhone' || navigator.platform == 'iPod'){
			}else{
				$("#onscreen,#navigation").css("position","fixed");
			}
		
			//move images
			$(".postContent img, .postContent object").each(function(){
				$(this).addClass("scrollEntity");
				$(this).parents(".post").children(".images").append($(this));
			});
			
			$(".postContent").each(function(){
				$(this).appendTo($(this).parents(".post").children(".overlay"));
			});
			$(".overlay").hide();
			
			//resize images
			$(".images img, .images object, .images embed").each(function(){
				if(!$(this).hasClass("noScale")){
					w = $(this).width();
					h = $(this).height();
					nh = $(window).height();
					r = nh/h;
					$(this).width(w*r);
					$(this).height(nh);
				}
			});
			
			//if no content
			$(".postContent").each(function(){
				if(jQuery.trim($(this).text())==""){
					$(this).text("No info provided for this post");
				}
			});
			
			//show .images
			$("#cover").fadeOut();
			
			//size page
			fw = $(".post:last").offset().left + $(".post:last").width();
			$("body, #container").width(fw);
			
			//set first image
			ci = 0;
			
			//if text page
			if($(".content").length > 0){
				$("#container").css("overflow","visible");
				$(".post").css("float","right");
				$("#container,body,html").width($(window).width());
			}

		});
		
		$(window).scroll(function(){
			if(navigator.platform == 'iPad' || navigator.platform == 'iPhone' || navigator.platform == 'iPod'){
				$("#navigation").css("left",window.pageXOffset + "px");
				$("#navigation").css("right","auto");
				$("#navigation").css("width",$(window).width() + "px");
				$('#onscreen').css("right",-1*(window.pageXOffset - 50) + "px");
			}
		});
		
		$(window).resize(function(){
			
			//resize body
			$("body, html, #container").css({"width":9999999+"px"});
		
			//resize images
			$(".images img, .images object, .images embed").each(function(){
				if(!$(this).hasClass("noScale")){
					w = $(this).width();
					h = $(this).height();
					nh = $(window).height();
					r = nh/h;
					$(this).width(w*r);
					$(this).height(nh);
				}
			});
			
			//size page
			fw = $(".post:last").offset().left + $(".post:last").width();
			$("body, html, #container").width(fw);
			
		});
		
		//.image doubleclick
		$("img").dblclick(function(){
			if(ci != ($(".scrollEntity").length-1)){
				$("html,body").animate({
					scrollLeft: $(".scrollEntity:eq("+(ci+1)+")").offset().left + "px"
				});
				ci++;
				setTimeout("ipad()",300);
			}else{
				$("#pagination a").each(function(){
					if($(this).text() == "Next"){
						wl = $(this).attr("href");
					}
				});
				window.location = wl;
			}
		});
		
		//process li
		$("#navigation ul").each(function(){
			l = $(this).find("li").length;
			w = 250;
			w += (Math.ceil(l/5)-1)*250;
			
			$(this).parents(".module").width(w);
			$(this).width(w);
		});
		
		//#slide
		$("#slide").click(function(){
			$("#navigation").slideToggle(function(){
				if($("#navigation").is(":hidden")){
					// $("#onscreen a").css({
					//  	"color":"#fff"
					// })
				}else{
					// $("#onscreen a").css({
					//	"color":"#fff"
					// })
				}
			});
		});
		
		$("#left").click(function(){
			if(ci != 0){
				$("html,body").animate({
					scrollLeft: $(".scrollEntity:eq("+(ci-1)+")").offset().left + "px"
				});
				ci--;
				setTimeout("ipad()",300);
			}else{
				$("#pagination a").each(function(){
					if($(this).text() == "Previous"){
						wl = $(this).attr("href");
					}
				});
				window.location = wl;
			}
		});
		$("#right").click(function(){
			if(ci != ($(".scrollEntity").length-1)){
				$("html,body").animate({
					scrollLeft: $(".scrollEntity:eq("+(ci+1)+")").offset().left + "px"
				});
				ci++;
				setTimeout("ipad()",300);
			}else{
				$("#pagination a").each(function(){
					if($(this).text() == "Next"){
						wl = $(this).attr("href");
					}
				});
				window.location = wl;
			}
		});
		// Key Functions
		$(document).keydown(function(event) {
			//Left
			if(event.keyCode == 74){
				if(ci != 0){
					$("html,body").animate({
						scrollLeft: $(".scrollEntity:eq("+(ci-1)+")").offset().left + "px"
					});
					ci--;
				}else{
					$("#pagination a").each(function(){
						if($(this).text() == "Previous"){
							wl = $(this).attr("href");
						}
					});	
					window.location = wl;
				}
			}
			//Right
			if(event.keyCode == 75){
				if(ci != ($(".scrollEntity").length-1)){
					$("html,body").animate({
						scrollLeft: $(".scrollEntity:eq("+(ci+1)+")").offset().left + "px"
					});
					ci++;
				}else{
					$("#pagination a").each(function(){
						if($(this).text() == "Next"){
							wl = $(this).attr("href");
						}
					});	
					window.location = wl;
				}
			}
		});
		
		$(".info").click(function(){
			p = $(this).parents(".post");
			if(p.find(".overlay").is(":hidden")){
				p.find(".overlay").fadeIn(function(){
					$(this).parents(".post").find(".x").fadeIn();
					//console.log("1");
					$(".info").fadeOut();
				});
			}else{
				$(this).parents(".post").find(".x").fadeOut(function(){
					p.find(".overlay").fadeOut();
					//console.log("2");
					$(".info").fadeIn();
				});
			}
		});
		
		$(".x").click(function(){
			p = $(this).parents(".post");
			$(this).parents(".post").find(".x").fadeOut(function(){
				p.find(".overlay").fadeOut();
				//console.log("3");
				$(".info").fadeIn();
			});
		});
		
		function ipad(){
			if(navigator.platform == 'iPad' || navigator.platform == 'iPhone' || navigator.platform == 'iPod'){
				$("#navigation").css("left",window.pageXOffset + "px");
				$("#navigation").css("right","auto");
				$("#navigation").css("width",$(window).width() + "px");
				$('#onscreen').css("right",-1*(window.pageXOffset - 50) + "px");
			}
		}
