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;  
   		}  
   });      
}
 

function bookmark(title, url) {
    if(document.all) { // ie
        window.external.AddFavorite(url, title);
    }
    else if(window.sidebar) { // firefox
        window.sidebar.addPanel(title, url, "");
    }
    else if(window.opera && window.print) { // opera
        var elem = document.createElement('a');
        elem.setAttribute('href',url);
        elem.setAttribute('title',title);
        elem.setAttribute('rel','sidebar');
        elem.click(); // this.title=document.title;
    }
}
function mailac(item){
	item = item.replace('_thumb','');
	jQu('#hangisi').attr('value','http://www.cyprusmarble.com/'+item);
	jQu('#gonder').stop().animate({
		top: 120
	  }, 2000, function() {
		// Animation complete.
	  });
}
function closegnder(){
	jQu('#gonder').stop().animate({
		top: -350
	  }, 2000, function() {
		// Animation complete.
	  });
}
