jQuery(document).ready(function(){
	jQuery(".imgthumb").click(function(){
		var loading = '<img id="loadinggif" src="/Images/style/loading.gif" alt="loading" />';
		jQuery(this).append(loading);
		var brokenstring=jQuery(this).attr("href").split("#");
		var src = brokenstring[1];	
		jQuery("#mainimg").image(src,function(){
			jQuery("#mainimg").attr("src",src);
			jQuery("#loadinggif").remove();
		});		
		return false;
	});	
	
	//Tooltips
	tooltip();
	jQuery("a.disabledlink").click(function(){ return false; });
	
});

jQuery.fn.image = function(src, f){ return this.each(function(){ var i = new Image(); i.src = src; i.onload = f; });};

this.tooltip = function(){			
		xOffset = 10;
		yOffset = 20;	
	jQuery("a.tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";	
		jQuery("#toolbarwrap").prepend('<div id="tooltip">'+ this.t +'<div id="tooltiparrow"><img src="/Images/style/div_arrow.png"></div></div>');
		jQuery("#tooltip").css("width","170px");
		jQuery("#tooltip").css("left","50%");
		jQuery("#tooltip").css("margin-left","-85px");
		jQuery("#tooltip").fadeIn("fast");
		var thisindex = jQuery(this).attr("rel");
		var margleft = Number(((thisindex-1)*60)+15);
		jQuery("#tooltiparrow").css("left",margleft+"px");
    },
	function(){
		this.title = this.t;		
		jQuery("#tooltip").remove();
    });		
};
