(function()
{
	GSM_LOADER = ({
	
	show: function(waittext)
	{
		GSM_MSG.hide();
		GSM_MESSAGE.hide();
		GSM_POPUP.hide();
		
		var w = jQuery(document).width();
		var h = (jQuery(document).height() > jQuery(window).height()) ? jQuery(document).height() : jQuery(window).height();
		jQuery("#Gsm_MaskDiv").css({left:0, top:0, width:w, height:h}).css({display:'block'}).show(function()
		{
			GSM_LOADER.loader(waittext);
		});
	},
	
	loader: function(waittext)
	{
		var leftPosition = (jQuery(window).width()/2)-(jQuery("#Gsm_LoaderDiv").width()/2);	
		
		if(waittext!='')
		{		
			jQuery("#Gsm_LoaderText").text(waittext);
		}
		else
		{
			jQuery("#Gsm_LoaderText").text("Please wait");
		}		
		jQuery("#Gsm_LoaderDiv").css({left:leftPosition, opacity:0.94}).css({display:'block'});
	},
	
	hide: function(time)
	{
		if(time == null)
		{
			time = 200;
		}
		setTimeout("jQuery('#Gsm_MaskDiv').css({display:'none'}); jQuery('#Gsm_LoaderDiv').fadeOut(200);", time);
	},
	
	hideWithMsg: function(msg, time)
	{		
		if(time == null)
		{
			time = 200;
		}
		
		setTimeout("jQuery('#Gsm_MaskDiv').css({display:'none'}); jQuery('#Gsm_LoaderDiv').fadeOut(200, function(){	GSM_MSG.show('"+msg+"'); });", time);
	}
	
	});

})(jQuery);


(function()
{
	GSM_MSG = ({
	
	show: function(msg)
	{
		GSM_MSG.msg(msg);
	},
	
	msg: function(msg)
	{
		jQuery("#Gsm_MessageDiv").css({display:'none'}).hide(10,function()
		{		
			var leftPosition = (jQuery(window).width()/2)-(jQuery("#Gsm_MessageDiv").width()/2);
			jQuery("#Gsm_MessageContent").html(msg).show(function()
			{
				jQuery("#Gsm_MessageDiv").css({left:leftPosition, opacity:.94}).fadeIn(500, function()
				{
					jQuery("#Gsm_MessageContent").html(msg).show();
				});
			});
		});
	},
	
	hide: function()
	{
		jQuery("#Gsm_MessageContent").html('');
		jQuery("#Gsm_MessageDiv").css({display:'none'});
	}
	
	});

})(jQuery);


(function()
{
	GSM_MESSAGE = ({
	
	show: function()
	{
		jQuery("#system_message").hide(function()
		{
			var leftPosition = (jQuery(window).width()/2)-(jQuery("#system_message").width()/2);
			jQuery("#system_message").css({left:leftPosition, opacity:1, display:'block'});
			
		});
	},
	
	hide: function()
	{
		jQuery("#system_message").css({display:'none'});
	}
	
	});

})(jQuery);


(function()
{
	GSM_POPUP = ({
	
	show: function(title, content, height, width)
	{
		var popup = jQuery("#Gsm_PopupDiv");
		var contentdiv = jQuery("#Gsm_PopupContent");
		
		title 	= (title == null) ? 'Popup' : title;
		content = (content == null) ? '' : content;
		height 	= (height == null) ? popup.height() : height;
		width 	= (width == null) ? popup.width() : width;
		
		popup.css({display:'none', width:width+'px'}).hide(10,function()
		{			
			var leftPosition = (jQuery(window).width()/2)-(popup.width()/2);			
			contentdiv.html(content).show(function()
			{				
				jQuery("#popupHeadTitle").html(title);			
				popup.css({left:leftPosition, opacity:.94}).fadeIn(500);
				
			});
		});
	},
	
	hide: function()
	{
		jQuery("#Gsm_PopupContent").html('');
		jQuery("#Gsm_PopupDiv").css({display:'none'});
	}
	
	});

})(jQuery);

function jsPopup(MyURL, MyWidth, MyHeight)
{
  var left=(screen.width-MyWidth)/2;
  var top=(screen.height-MyHeight)/2;
  window.open(MyURL,"_blank","top="+top+",left="+left+",width="+MyWidth+",height="+MyHeight+",toolbar=0,location=0,directories=0,status=0,scrollbars=0,resizable=0,copyhistory=0,menuBar=0");
  return false;
}
