
 $(function() {
		$(".service-menu > li:gt(0)").prepend(" | ");
		$(".main-menu-item").mouseover(function () {
			$(this).children(".sub-menu:hidden").slideDown(150).each(function() {
				$(this).css("left", this.parentNode.offsetLeft + 6);
			});
			$(this).not(".menu-selected").children("img").attr("src", function(arr){
				var src = $(this).attr("src");
				var i = src.lastIndexOf("h.jpg");
				if (i == -1)
					return src.substring(0, src.length - 4) + "h.jpg";
			})
		}).mouseout(function(e) {
			var p = e.relatedTarget;
			if (p)
			{
				p = p.parentNode;
				while (p)
				{
					if (p == this)
						return;
					p = p.parentNode;
				}
			}
			$(this).children(".sub-menu:visible").slideUp(150); 
			$(this).not(".menu-selected").children("img").attr("src", function(arr){
				var src = $(this).attr("src");
				var i = src.lastIndexOf("h.jpg");
				if (i != -1)
					return src.substring(0, i) + ".jpg";
			});	
		});
    });

var COOKIE_LANGUAGE = "language";
var COOKIE_CART     = "cart";

function SetLanguage(languageCode)
{
	SetCookieValue(COOKIE_LANGUAGE, languageCode);
	// make a round-trip to the server in order to get the updated language
	location = location;
}

function GetCookieValue(cookieId)
{
	var start = document.cookie.indexOf(cookieId + "=");
	if (start > -1)
	{
		var end = document.cookie.indexOf(";", start);
		if (end == -1)
			end = document.cookie.length;
		return document.cookie.substring(start + cookieId.length + 1, end);
	}
	else
		return "";
}

function SetCookieValue(cookieId, cookieValue)
{
	document.cookie = cookieId + "=" + cookieValue + ";Path=/";
}

function NoDecode(utftext)
{
	return utftext;
}

function Input_Focus(object, infoText)
{
	var id = object.id;
	var field = document.getElementById(id);

	if (field.value==infoText)
		field.value=''; 
}

function Input_Blur(object, infoText)
{
	var id = object.id;
	var field = document.getElementById(id);

	if (field.value=='')
		field.value=infoText;
}

function DecodeUTF8(utftext)
{
	var plaintext = "";
	var i=0;
	var c=c1=c2=0;
	
	while (i < utftext.length)
	{
		c = utftext.charCodeAt(i);
		if (c < 128)
		{
			plaintext += String.fromCharCode(c);
			i++;
		}
		else if((c > 191) && (c < 224))
		{
			c2 = utftext.charCodeAt(i + 1);
			plaintext += String.fromCharCode(((c&31)<<6) | (c2&63));
			i += 2;
		}
		else
		{
			c2 = utftext.charCodeAt(i+1);
			c3 = utftext.charCodeAt(i+2);
			plaintext += String.fromCharCode(((c&15)<<12) | ((c2&63)<<6) | (c3&63));
			i += 3;
		}
	}
	return plaintext;
}


// Browser support checking
function Browser()
{	
			
	if (document.getElementById && document.createElement)
	{
		if (document.cookie.indexOf("chkcookie", 0) < 0)
		{
			document.cookie = "chkcookie=" + (new Date()).getTime() + "; path=/";
			if (document.cookie.indexOf("chkcookie", 0) < 0)
				location = "/Browser.aspx?reason=1";	
		}
	}
	else
		location = "/Browser.aspx?reason=2";	

}

if (self.Browser) { Browser() }

function windowOpen(url, title, width, height) {
	var left = 0;
	var top = 0;
	if (screen.availHeight) {
		left = (screen.availWidth - width)/2;
		top = (screen.availHeight - height)/2;
	} else {
		left = (800 - width)/2;
		top = (600 - height)/2;
	}
	var popup = window.open(url, title, "dependent=yes,resizable=yes,status=no" +
		",height=" + height + ",width=" + width +
		",left=" + left + ",top=" + top +
		",screenX=" + left + ",screenY=" + top);
	if (popup)
		popup.focus();
}

function goUrl(sUrl)
{
	top.opener.location = sUrl;
	top.window.close();
}

function showPopup(objectID)
{
	document.getElementById(objectID).style.display = "block";
}

function hidePopup(objectID)
{
	document.getElementById(objectID).style.display = "none";
}

function flashContainer(source, width, height)
{
	this.source = source;
	this.width = width;
	this.height = height;
	this.params = new Array();
	
	this.render = function()
	{
		document.write('<object type="application/x-shockwave-flash" data="');
		document.write(this.source);
		if (this.title)
		{
			document.write('" title="');
			document.write(this.title);
		}
		document.write('" height="');
		document.write(this.height);
		document.write('" width="');
		document.write(this.width);
		document.write('"><param name="movie" value="');
		document.write(this.source);
		document.write('" />');
		for (var param in this.params)
		{
			document.write('<param name="');
			document.write(this.params[param]);
			document.write('" value="');
			document.write(param);
			document.write(' />');
		}
		document.write('<param name="wmode" value="opaque" />');
		document.write('</object>');
	}
}

function SelectRequired(src, arg)
{
	if (arg.Value)
		arg.IsValid = arg.Value != "None";
	else
		arg.IsValid = false;
}