function jerry(imageWidth,imageHeight,nextId, prevId, imgId){
	this.imgWidth = imageWidth;
	this.imgHeight = imageHeight;
	this.nextId = nextId;
	this.prevId = prevId;
	this.imgId = imgId;
	
	this.initNextPrev = function(){
	 
		if(this.imgId != this.nextId){
			$("#next a").mouseover(function(){
  				$(this).css({background: "transparent url('/templates/jerry/images/next.gif') no-repeat scroll right bottom" });
  			});
  			$("#next a").mouseout(function(){
  				$(this).css({background: "none" });
  			});
		}else
		{
			$("#next").css({display: "none"});
		}
		if(this.imgId != 1){

  			$("#prev a").mouseover(function(){
  				$(this).css({background: "transparent url('/templates/jerry/images/prev.gif') no-repeat scroll left bottom" });
  				
  			});
  			$("#prev a").mouseout(function(){
  				$(this).css({background: "none" });
  			});
		}	
		else
		{
			$("#prev").css({display: "none"});
		}
	}
	
	this.showComments = function(){
		$("#comments").toggleClass("hidden");
		if($("#comments").is(":visible")){
			$('html,body').animate({scrollTop: $("#comments").position().top}, 10);
		}else
		{
			$('html,body').animate({scrollTop: 0}, 10);
		}
	}
	this.toggleAbout = function(){
		if($("#about").is(":visible")){
			$("#about").addClass("hidden");
		}else
		{
			$("#about").removeClass("hidden");
		}
	}
	
	this.init = function(){
	 
		$("#photo").removeAttr("title");
	
		var cX = $("#content").offset().left;
		var nY = $("#nav").offset().top;
		var cW = Number($("#content").innerWidth());
		var cH = Number($("#content").height());
		var aW = Number($("#about").width());
		var aH = Number($("#about").height());
		$("#about").css({ top: nY-aH-25+"px", left: cW-aW-15+"px"});	
	}
	
	this.positionNav = function(){
		var cX = $("#content").offset().left;
		var cY = $("#content").offset().top;
		var cW = Number($("#content").outerWidth());
		var cH = Number($("#content").innerHeight());
		var nW = Number($("#nav").width());
		var nH = Number($("#nav").height());
		$(".image-bar .right").css({ left: cW-nW-10+"px"});	
	}
	
	this.positionComnum = function(){
		var left = $("#comments-nav a").offset().left;
		var top = $("#comments-nav a").offset().top;
		$("#comnum").css({ left: left+13+"px", top: top+6+"px"});
	}
}	

$(document).ready(function() {
	jer.init();
	jer.positionNav();
	$("#header-container").css({ width: jer.imgWidth+"px"});
	jer.initNextPrev();
});

$(window).resize(function(){
	jer.init();
	jer.positionNav();
	$("#header-container").css({ width: jer.imgWidth+"px"});
});
