function replaceChars(entry) {
out = "##&&##"; // replace this
add = "'"; // with this
temp = "" + entry; // temporary holder

while (temp.indexOf(out)>-1) {
pos= temp.indexOf(out);
temp = "" + (temp.substring(0, pos) + add + 
temp.substring((pos + out.length), temp.length));
}
url2 = temp;
}

function setXcookie(xlang,url)
{
	var LangValue = xlang;
	setCookie('belang',LangValue,'60');
	replaceChars(url)
	//alert(url2);
	location.href = url2;
}
function setXcookie2(xlang)
{
	var LangValue = xlang;
	setCookie('belang',LangValue,'60');
}


function setCookie(NameOfCookie, value, expiredays) 
{ 


var ExpireDate = new Date ();
ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
document.cookie = NameOfCookie + "=" + escape(value) + 
((expiredays == null) ? "" : "; path=/; expires=" + ExpireDate.toGMTString());
}

function getCookie(NameOfCookie)
{ if (document.cookie.length > 0)
{ begin = document.cookie.indexOf(NameOfCookie+"="); 
if (begin != -1) 
{ begin += NameOfCookie.length+1; 
end = document.cookie.indexOf(";", begin);
if (end == -1) end = document.cookie.length;
return unescape(document.cookie.substring(begin, end)); } 
}
return null; 
}

function delCookie (NameOfCookie) 
{ if (getCookie(NameOfCookie)) {
document.cookie = NameOfCookie + "=" +
"; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
}