/*
	Plugin per jquery - 2008-09-23
	(c) Copyright 2008 Federico Pizzutto. All Rights Reserved. 
	
@	Federico Pizzutto
@	http://www.pngised.net/

*/

/*
	thx to: http://bassistance.de/2007/01/23/unobtrusive-clear-searchfield-on-focus/
*/
	$.fn.search = function() {
		return this.focus(function() {
			if( this.value == this.defaultValue ) {
				this.value = "";
			}
		}).blur(function() {
			if( !this.value.length ) {
				this.value = this.defaultValue;
			}
		});
	};
	

/*
SLIDESHOW
http://www.detacheddesigns.com/blog/blogSpecific.aspx?BlogId=62
*/

	$.fn.slideshow = function() {
	    $("#thumbs a").click(function() {
	        var imageSource = $(this).attr("href");
			//alert(imageSource);
	        $("#bigfoto").addClass("loading");
	        //$("img.primaFoto").remove();
	          showImage(imageSource);
	          return false;
	        });
	
	function showImage(src) {
		$("#bigfoto img").fadeOut("normal").remove();
		var largeImage = new Image();
		$(largeImage).load(function() {
              $(this).hide();
              $("#bigfoto").removeClass("loading").append(this);

                    $(this).fadeIn("slow");              
             });
		$(largeImage).attr("src", src);                                                                            
	}
	};

/*
FIXING tooltip	
*/
	$.fn.tooltip = function() {
		$(this).each(function(){
			var titolo = $(this).children("img").attr("title");
			$(this).children("span").attr("title",titolo);
		});		
	};
/*
	
*/

//	$(function() {
//	    $(".storico-ordini tr").not("tr.intestazioni").mouseover(function() {
//	        $(this).css("cursor", "pointer");
//	    }).click(function() {
//	        var URL = $(this).contents().find("a").attr("href") + " #container";
//	        //alert(URL);
//	        $("#container").load(URL);
//	    });
//	});
