var pageURL = "" + window.location.href;

function rollOn(name, on){

		pict=document.images[name];
		if (pict == null){
			pict = document.getElementById(name);
		}
		if (on){
			var add = "_on";
		}
		else {
			var add = "";
		}
		base = "/HPower/_Global/img/nav/";
		newSrc = base+ name + add + ".gif";
		pict.src= newSrc;
	
}


function gotoLanguageURL(strLang) {
	var engfound, frefound, charFound;
	var myurl = "" + window.top.location.href;
	var lookforEng = "L=E";
	var lookforFre = "L=F";
	var startParamChar = "?";
	var appendChar = "&";
	var re;
	

	charfound = myurl.indexOf(startParamChar);

	engfound = myurl.indexOf(startParamChar + lookforEng);
	frefound = myurl.indexOf(startParamChar + lookforFre);
	
	//If there's an ?L=Anything, that's the easiest, just switch the language and get out
	if (engfound > 0)
	{
		re = new RegExp ('\\' + startParamChar + lookforEng, 'gi');
		myurl = myurl.replace(re, startParamChar + lookforFre);
	}
	else
	if (frefound > 0) 
	{
		re = new RegExp ('\\' + startParamChar + lookforFre, 'gi');
		myurl = myurl.replace(re, startParamChar + lookforEng);
	}else {
		engfound = myurl.indexOf(appendChar + lookforEng);
		frefound = myurl.indexOf(appendChar + lookforFre);

		//If there's an &L=Anything, that's the easiest, just switch the language and get out
		if (engfound > 0)
		{
			re = new RegExp (appendChar + lookforEng, 'gi');
			myurl = myurl.replace(re, appendChar + lookforFre);
		}
		else
		if (frefound > 0) 
		{
			re = new RegExp (appendChar + lookforFre, 'gi');
			myurl = myurl.replace(re, appendChar + lookforEng);
		} else // No ?, no & L=, so lets just append it
		{
			// if there's an ? then append &L= otherwise append ?L=
			if (charfound > 0)
			{
				if (strLang == "Eng")
					myurl = myurl + '&L=F';
				else
					myurl = myurl + '&L=E';
			}
			else
			{
				if (strLang == "Eng")
					myurl = myurl + '?L=F';
				else
					myurl = myurl + '?L=E';
			}
		}
	}
	

	
	location.href = myurl;
}
