//	File:	common.js//	Author:	Mikael Simonsson <mikael@bluemist.se >//	Copyright (C) 2003-2006 Mikael Simonsson, E-handel.//	This file may not be redistributed in whole or part. A license from E-handel//	is required for each instance of the application which this file is a part of.function g_openWindow(sURL, sName, iWidth, iHeight, sResizable, sStatus){	var sOptions = '';	sOptions += 'toolbar=0,location=0,directories=0,menubar=0';	sOptions += ',status=' + sStatus + ',scrollbars=' + sResizable +',resizable='  + sResizable;	sOptions += ',width=' + iWidth + ',height=' + iHeight;	var objWin = window.open(sURL, sName, sOptions);	if (objWin != null)	  {		objWin.moveTo((screen.width-iWidth)/2,(screen.height-iHeight)/2);		objWin.focus();	  }}function g_selectProduct(oSelect){	if ( oSelect.length > 0 )	{		if ( oSelect.selectedIndex > 0 )		{			if ( oSelect.options[oSelect.selectedIndex].value == '' )				oSelect.selectedIndex = oSelect.selectedIndex - 1;		}	}}function g_toggleGroup(iId, sTemplatePath){	var oUl = 0;	var oImg = 0;	if ( document.getElementById )	{		oUl = document.getElementById('groupItem' + iId);		oImg = document.getElementById('groupImage' + iId);	}	else if ( document.all )	{		oUl = document.all['groupItem' + iId];		oImg = document.all['groupImage' + iId];	}	if ( oUl && oImg )	{		if ( oUl.style.display == 'none')		{			oUl.style.display = 'block';			oImg.src = sTemplatePath + '/i/minus.gif';		}		else		{			oUl.style.display = 'none';			oImg.src = sTemplatePath + '/i/plus.gif';		}	}	return false;}function g_selectGo(o, sPathRelativeToRoot){	if ( o.length > 0 && o.selectedIndex != -1 && o.options[o.selectedIndex].value != '' )		self.location.href = sPathRelativeToRoot + o.options[o.selectedIndex].value;}function g_DecodeBase64(sInputRaw){	var sOutput = "";	var sBase64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";	// Strip invalid chars	var sInput = sInputRaw.replace(/[^A-Za-z0-9\+\/\=]/g, "");	var iInputLength = sInput.length;	// We need at least 4 characters and the string must be in parts of 4	if ( iInputLength >= 4 && iInputLength % 4 == 0 )	{		var i = 0;		var c1, c2, c3 = "";		var e1, e2, e3, e4 = "";		do		{			e1 = sBase64Chars.indexOf(sInput.charAt(i++));			e2 = sBase64Chars.indexOf(sInput.charAt(i++));			e3 = sBase64Chars.indexOf(sInput.charAt(i++));			e4 = sBase64Chars.indexOf(sInput.charAt(i++));			c1 = ( e1 << 2 ) | ( e2 >> 4 );			c2 = ( ( e2 & 15 ) << 4 ) | ( e3 >> 2 );			c3 = ( ( e3 & 3 ) << 6 ) | e4;			sOutput = sOutput + String.fromCharCode(c1);			if ( e3 != 64 ) sOutput = sOutput + String.fromCharCode(c2);			if ( e4 != 64 ) sOutput = sOutput + String.fromCharCode(c3);		} while ( i < iInputLength );	}	return sOutput;}function g_EmProtection(sInput64, sStyle){	var sOutput = "";	var sEm = g_DecodeBase64(sInput64);	sOutput += "<" + "a" + " h" + "ref=\"";	sOutput += "m" + "ail" + "to" + ":";	sOutput += sEm;	sOutput += "\"";	if ( sStyle.length > 0 )		sOutput += " style=\"" + sStyle + "\"";	sOutput += ">" + sEm;	sOutput += "</" + "a>";	return sOutput;}