jQuery(document).ready(function() {
	jQuery.fn.imgdesc = function(set) {
		return this.each(function() {
			if(set == null) set = {autohide : "yes", text : this.title};
			else if(set.text == null ) set.text = this.title;
			
			var desc = set.text;
			if(desc.length > 45) desc = (this.title).substr(1,45);
			
			var imgWidth = jQuery(this).attr("width");
			var imgHeight = jQuery(this).attr("height");
			var imgClass = jQuery(this).attr("class");
			var imgSrc = jQuery(this).attr("src");
			if( !( ( jQuery(this).parent("a") )[0] ) ) { 
				var imgTag = "<a href='"+ imgSrc + "' class='" + imgClass + " imgLink' style='width:" +imgWidth + "px;height: " + imgHeight + "px;display: block;overflow:hidden;'></a>";
				//alert(imgTag);
				jQuery(this).wrap(imgTag);
				
				//Query(this).next("a").attr({href : imgSrc, class : imgClass + " imgLink"}).append(jQuery(this));
				}
			jQuery(this).removeClass().after("<span class='imgDesc imaDesc-opacity'>"+desc+"</span>").next(".imgDesc").css({"top" : "-39px" , "width" : (imgWidth - 20) + "px" });	
			
			if( set.autohide == "yes" || set.autohide == null ) {
			jQuery(this).hover(function(){
		jQuery(this).next(".imgDesc").fadeTo("fast" , 0.8);
	},function() {
		jQuery(this).next(".imgDesc").fadeTo("fast", 0);
	});
			}
			else if( set.autohide == "no") {
				jQuery(this).next(".imgDesc").fadeTo("fast" , 0.8);
			}
			
			jQuery(this).parent("a").css({"width":imgWidth,"height":imgHeight ,"display":"block", "overflow":"hidden"}).addClass(imgClass);
			

		});
	};

});
