
	var user = getCookie('user');
	var password = getCookie('password');
	var s_password = getCookie('s_password');
	var productid = getCookie('productid');

	if ( user == null )
		user = "";

	if ( password == null )
		password = "";

	if ( s_password == null )
		s_password = "false";

	if ( productid == null )
		productid = "false";

	function SetLanguage(Language)
	{
		pathname = location.pathname;
		mydomain = pathname.substring(0, pathname.lastIndexOf('/'))+'/';
		var largeExpDate = new Date;
		largeExpDate.setTime(largeExpDate.getTime() + (60*24*3600*1000));

		SetCookie('language', Language, largeExpDate, mydomain);
	}

	function SetUserNameAndPassword(UserName, Password)
	{
		pathname = location.pathname;
		mydomain = pathname.substring(0, pathname.lastIndexOf('/'))+'/';
		var largeExpDate = new Date;
		largeExpDate.setTime(largeExpDate.getTime() + (60*24*3600*1000));

		if ( document.main.s_pwd && document.main.s_pwd.checked )
		{
			SetCookie('user', UserName, largeExpDate, mydomain);
			SetCookie('password', Password, largeExpDate, mydomain);
			SetCookie('s_password', "true", largeExpDate, mydomain);
		}
		else
		{
			SetCookie('user', "", largeExpDate, mydomain);
			SetCookie('password', "", largeExpDate, mydomain);
			SetCookie('s_password', "false", largeExpDate, mydomain);
		}

		if ( document.main.pid && document.main.pid.checked )
			SetCookie('productid', "true", largeExpDate, mydomain);
		else
			SetCookie('productid', "false", largeExpDate, mydomain);
	}

	function SetCookie(Name, Value)
	{
		var argv = SetCookie.arguments;
		var argc = SetCookie.arguments.length;
		var expires = (argc > 2) ? argv[2] : null;
		var path	= (argc > 3) ? argv[3] : null;
		var domain	= (argc > 4) ? argv[4] : null;
		var secure	= (argc > 5) ? argv[5] : null;
		document.cookie = Name + "=" + escape(Value) + ((expires == null) ? "" : ("; expires="+expires.toGMTString())) + ((path == null) ? "" : ("; path="+path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure":"");
	}

	function getCookieVal(offset)
	{
		var endstr = document.cookie.indexOf(";",offset);

		if (endstr==-1)
			endstr = document.cookie.length;

		return unescape(document.cookie.substring(offset, endstr));
	}

	function getCookie(Name)
	{
		var arg = Name + "=";
		var alen = arg.length;
		var clen = document.cookie.length;
		var i = 0;

		while ( i < clen )
		{
			var j = i + alen;
			if (document.cookie.substring(i,j)==arg)
				return getCookieVal(j);
			i = document.cookie.indexOf(" ", i) + 1;
			if (i==0)
				break;
		}

		return null;
	}
