jQuery.extend({

	selectionOff: function(obj)    {
	   target = obj || document.body;
	   if (typeof target.onselectstart!="undefined") //IE route
	       target.onselectstart=disableSelection;
	   else if (typeof target.style.MozUserSelect!="undefined") //Firefox route
	       target.style.MozUserSelect="none"
	   else if(typeof target.style.KhtmlUserSelect!="undefined")
	       target.style.KhtmlUserSelect = "none";
	   else { //All other route (ie: Opera)
	       $(target).bind('mousedown',disableSelection);
	   }
	   //alert(document.selection);
	},

	/**
	 * Enable the Selection after the Disabling
	 */
	selectionOn: function(obj)    {
	   target = obj || document.body;
	   if (typeof target.onselectstart!="undefined") //IE route
	       target.onselectstart=null;
	   else if (typeof target.style.MozUserSelect!="undefined") //Firefox route
	       target.style.MozUserSelect=""
	   else if(typeof target.style.KhtmlUserSelect!="undefined")
	       target.style.KhtmlUserSelect = "";
	   else //All other route (ie: Opera)
	       $(target).unbind('mousedown',disableSelection);
	},

	timeUrl: function() {
		return ('&t='+jQuery.time()+'&');
	},
	
	time: function() {
		return (new Date().getTime());
	},

	stripLastComma: function(text) {
		return text.replace(/,+$|,+\s$/,'');
	},
	
	isset: function(elm)
	{
		return typeof elm == 'undefined' ? true : false;
	},
	
	getWinH: function()
	{
		var height = 0;
		if( typeof( window.innerHeight ) == 'number' )
			height = window.innerHeight;
		else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
			height = document.documentElement.clientHeight;
		else if(document.body && (document.body.clientWidth || document.body.clientHeight))
			height = document.body.clientHeight;

		return height;
	},
	
	getWinW: function()
	{
		var width = 0;		
		if( typeof( window.innerWidth ) == 'number' )
			width = window.innerWidth;
		else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
			width = document.documentElement.clientWidth;
		else if(document.body && (document.body.clientWidth || document.body.clientHeight))
			width = document.body.clientWidth;

		return width;
	},
	
	ajaxReplacer: function(gurl, rid, callme)
	{
		
		$.ajax({
		  type: "GET",
		  url: gurl,
		  success: function(msg){
			jQuery.loading.hide(rid);
			if(msg == '') return;
		    $('#'+rid).html(msg);
		  }
		})
	},
	
	loading: {
		show: function(id) { $('#'+id).addClass('loading'); },		
		hide: function(id) { $('#'+id).removeClass('loading'); }
	},
	
	getHref: function(href)
	{
		return href.substr(href.indexOf('#')+1, href.length);
	}
});

$(function() { $("a").focus(function() { $(this).blur() }) });

function disableSelection() { event.returnValue = false; }

Function.prototype.bind_scope = function (object) {
	var m = this;
	var w = function () {
		var args = Array.prototype.slice.call(arguments);
		return m.apply(object, args);
	};
	return w;
};