function OnAjaxRequestStart(sender, args)
{
	//--- Only if not on the hompage ---
	if(typeof RapidOrderEntry != 'object')
	{
		//--- Scroll to top ---
		window.scrollTo(0, 0);
	}
}

function jsfInitializeButtonsForIE()
{
	/*
	if(document.getElementsByTagName)
	{
		var aAllLinks = document.getElementsByTagName("a");
		for(var i=0; i<aAllLinks.length; i++)
		{
			var oCurrentLink = aAllLinks[i];
			var sCurrenLinkClass = (oCurrentLink.className+"").toLowerCase();
			if(sCurrenLinkClass.indexOf("slidingbutton")>=0)
			{
				oCurrentLink.onmousedown = new Function("this.focus();");
				oCurrentLink.onmouseup = new Function("this.blur();");
			}
		}
	}
	*/
}

/*************************************************
 * Get X-position of any object.
 * Can be used with a root-id.
 ************************************************/
function jsfGetObjectX(oGetX, sRootId)
{
	var iX = 0;
	var obj = oGetX;
	//--- Loop to top or defined root ---
	while(obj.offsetParent!=null && obj.offsetParent.id!=sRootId)
	{
		//--- Add ---
		iX += obj.offsetLeft;
		//--- Level up ---
		obj = obj.offsetParent
	}
	//--- Add last ---
	iX += obj.offsetLeft;
	return iX;
}

/*************************************************
 * Get Y-position of any object.
 * Can be used with a root-id.
 ************************************************/
function jsfGetObjectY(oGetY, sRootId)
{
	var iY = 0;
	var obj = oGetY;
	//--- Loop to top or defined root ---
	while(obj.offsetParent!=null && obj.offsetParent.id!=sRootId)
	{
		//--- Add ---
		iY += obj.offsetTop;
		//--- Level up ---
		obj = obj.offsetParent
	}
	//--- Add last ---
	iY += obj.offsetTop;
	return iY;
}

/*************************************************
 * Used for .Net unicode-style escaping.
 * Developed by SelfHTML, added by dirty-vinz:
 * http://aktuell.de.selfhtml.org/artikel/javascript/utf8b64/utf8.htm
 ************************************************/
function encode_utf8(rohtext)
{
	// dient der Normalisierung des Zeilenumbruchs
	rohtext = rohtext.replace(/\r\n/g,"\n");
	var utftext = "";
	for(var n=0; n<rohtext.length; n++)
	{
		// ermitteln des Unicodes des  aktuellen Zeichens
		var c=rohtext.charCodeAt(n);
		// alle Zeichen von 0-127 => 1byte
		if (c<128)
		{
			utftext += String.fromCharCode(c);
		}
		// alle Zeichen von 127 bis 2047 => 2byte
		else if((c>127) && (c<2048))
		{
			utftext += String.fromCharCode((c>>6)|192);
			utftext += String.fromCharCode((c&63)|128);
		}
		// alle Zeichen von 2048 bis 66536 => 3byte
		else
		{
			utftext += String.fromCharCode((c>>12)|224);
			utftext += String.fromCharCode(((c>>6)&63)|128);
			utftext += String.fromCharCode((c&63)|128);
		}
	}
	return utftext;
}

