/* 
	jQuery EasyThumb 1.0 Plugin
	Check www.hverven.net (For updates, etc)
	Updated: 06.01.08
*/

jQuery(function(){
   jQuery(".easyThumb").prepend("<div class='loading'><img src='http://dev.jquery.com/export/1859/trunk/plugins/autocomplete/indicator.gif' alt='loading...'/ > Loading..</div>");
});

jQuery.fn.easyThumb = function(opt) {
	opt = jQuery.extend({
     		width: 50, /* Width of the thumb*/
     		height: 0, /* Height of the thumb. (optional) */
     		makeLink: false, /* This will make a link to the original image */
     		toolTip: false, /* Show a tooltip with the ALT-text*/
     		m_class: 'none'
  	},opt);

  return this.each( function(){

  		jQuery(this).find(".loading").remove();

  		jQuery(this).find("li").each(function(n) {

  			var obj = jQuery(this).find("img");
  			var url = obj.attr("src");
  			var alt = obj.attr("alt");

			if (opt.width > 0) {
				obj.attr("width",opt.width);
  				obj.attr("src","t.php?image="+url+"&w="+opt.width)
			} else {
				obj.attr("height",opt.height);
  				obj.attr("src","t.php?image="+url+"&h="+opt.height)
			}
			if (opt.makeLink){
				obj.wrap("<a class='"+opt.m_class+"' href=\""+url+"\" title=\""+alt+"\"></a>");
			}

			/* TODO */
  			if(opt.toolTip){}
  		});
		jQuery(this).removeClass("easyThumb").addClass("easyThumbview");
	});	
};