jQuery.fn.opacity = function(amount) {
        if (amount > 1) amount = 1;
        if (amount < 0) amount = 0;
        if ($.browser.msie) {
                amount = (parseFloat(amount) * 100);
                this.css('filter', 'alpha(opacity='+amount+')');
        } else {
                this.css('opacity', amount);
                this.css('-moz-opacity', amount);
        }
        return this;
}
jQuery.fn.zIndex = function(amount) {                
        if (amount != null)
        {
            this.css('z-index', amount);
            return this;
        }
        else
        {
            return this.css('z-index');            
        }
}
jQuery.fn.swap = function(b) {
      b = jQuery(b)[0];
      var a = this[0],
          a2 = a.cloneNode(true),
          b2 = b.cloneNode(true),
          stack = this;
      a.parentNode.replaceChild(b2, a);
      b.parentNode.replaceChild(a2, b);
      stack[0] = a2;
      return this.pushStack( stack );
};
jQuery.fn.preloadImages = function()
{
	for(var i = 0; i < arguments.length; i++)
	{
		$("<img>").attr("src", arguments[i]);
	}
}
jQuery.fn.setEnterHandler = function(handler)
{
	var enterKeyHahdler = handler;
	this.keypress(function (e) {  
		if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {     			
   			if (typeof(enterKeyHahdler) == 'function') 
   			{
   			    enterKeyHahdler();
   			}
   			return false;  
   		} 
   		else 
   		{  
   			return true;  
   		}  
   });      
}
 

