(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!=null)
		{		
			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 = ({
	
	options:{minHeight:60, maxHeight:300, width:400, title:'&nbsp;', content:'&nbsp;'},
	settings:{minHeight:60, maxHeight:300, width:400, title:'&nbsp;', content:'&nbsp;'},
	show: function(title, content, height, width)
	{
		jQuery.extend(true, GSM_POPUP.settings, GSM_POPUP.options);
		
		var popup_object = jQuery("#Gsm_PopupDiv");
		var content_object = jQuery("#Gsm_PopupContent");
		
		GSM_POPUP.settings.title 	= (title == null) ? GSM_POPUP.settings.title : title;
		GSM_POPUP.settings.content 	= (content == null) ? GSM_POPUP.settings.content : content;
		GSM_POPUP.settings.width 	= (content_object.width() >= GSM_POPUP.settings.width) ? content_object.width() : GSM_POPUP.settings.width;
				
		jQuery("#popupHeadTitle").html(GSM_POPUP.settings.title);
		content_object.html(GSM_POPUP.settings.content).css({width:popup_object.width()+'px', minHeight:GSM_POPUP.settings.minHeight+'px', maxHeight:GSM_POPUP.settings.maxHeight+'px', width:GSM_POPUP.settings.width+'px'});
		var leftPosition = (jQuery(window).width()/2)-(popup_object.width()/2);
		popup_object.css({left:leftPosition+'px',opacity:0.96}).slideDown(600);		
	},
	
	hide: function()
	{
		jQuery.extend(true, GSM_POPUP.settings, GSM_POPUP.options);
		
		jQuery("#Gsm_PopupContent").html(GSM_POPUP.settings.content);
		jQuery("#Gsm_PopupDiv").css({display:'none'});
	}
	
	});

})(jQuery);
