	function ID(id)
	{
		return document.getElementById(id);
	}

	function getMyXY(o)
	{

		var myWidth = 0, myHeight = 0;
		if( typeof( window.innerWidth ) == 'number' ) //Non-IE
		{
			myWidth = window.innerWidth;
			myHeight = window.innerHeight;
		}
		else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) //IE 6+ in 'standards compliant mode'
		{
			myWidth = document.documentElement.clientWidth;
			myHeight = document.documentElement.clientHeight;
		}
		else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) //IE 4 compatible
		{
			myWidth = document.body.clientWidth;
			myHeight = document.body.clientHeight;
		}
		else
		{
			myHeight = document.getElementById('mesure').offsetHeight;
			myWidth = document.getElementById('mesure').offsetWidth;
		}

		var w = o.offsetWidth;
		var h = o.offsetHeight;

		var x = Math.round((myWidth/2)-(w/2));
		var y = Math.round((myHeight/2)-(h/2));
		y += document.body.scrollTop;

		o.style.left = (x)+'px';
		o.style.top = (y)+'px';
	}

	function updateCart()
	{
	}

	function changeButtonBackground(button_id, mouse_action)
	{
		if (mouse_action == "over")
			ID(button_id).style.backgroundImage = "url('template/default/img/header_button_selected.png')";
		if (mouse_action == "out")
			ID(button_id).style.backgroundImage = "url('template/default/img/header_background.gif')";
	}

	function load()
	{
		getMyXY(ID('pre_loader'));
		checkSystemMessage();
 	}

	function closePopup()
	{
		var options = {};

		if($("#system_message_popup").dialog('isOpen'))
		{
			$.closePopupLayer('myStaticPopup');
			$("#system_message_popup").dialog('destroy');
		}
	}

	function checkSystemMessage()
	{
		if(ID('system_message').innerHTML != '')
		{
			openStaticPopup();
			openPopup();
		}

		if(ID('system_task_message'))
		{
			if(ID('system_task_message').innerHTML != '')
			{
				ID('system_message').innerHTML = ID('system_task_message').innerHTML;
				openStaticPopup();
				openPopup();
			}

		}
	}

	function openPopup()
	{
		$.ui.dialog.defaults.bgiframe = true;
		$(function()
		{
			var resizable = $("#system_message_popup").dialog('option', 'resizable');
			$("#system_message_popup").dialog({ resizable: true});
			$("#system_message_popup").bind('dialogclose', function(event, ui)
			{
				closePopup();
			});
		});
	}
			
	function isNumeric(value) {
	  if (value == null || !value.toString().match(/^[-]?\d*\.?\d*$/)) return false;
	  return true;
	}
	
	function openStaticPopup() 
	{
		$.openPopupLayer({
			name: "myStaticPopup",
			width: 550,
			target: "system_message_hidden",
			beforeClose: function(){closePopup();}
		});
	}
