
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {createCookie(name,"",-1);}


function ChangeLanguage(f) {
	var strURL = f.options[f.selectedIndex].value;
	var cCode = strURL.substr(23,2);
	createCookie('ctspace_countrycode',cCode,90);
	window.location=strURL;	
}

function openPopup(strLocation)
{
	window.open(strLocation, 'Citadon', 'height=650,width=550,location=no,menubar=no,scrollbars=yes,status=yes,toolbar=no,resizable=no');
}

function popSolutions(strLocation)
{
	window.open(strLocation, 'Citadon', 'height=600,width=750,location=no,menubar=no,scrollbars=yes,status=yes,toolbar=no,resizable=no');
}

function cwWacLogin()
{
	var LoginWin=window.open("http://citadoncw.citadon.com/tce?ClientType=Thin","","left=" + (screen.width-372)/2 + ",top=" + (screen.height-251)/2 + ",width=372,height=251");
}

function cwWacUKLogin()
{
	var LoginWin=window.open("http://citadoncw.citadon.co.uk/tce?ClientType=Thin","","left=" + (screen.width-372)/2 + ",top=" + (screen.height-251)/2 + ",width=372,height=251");
}

/*
var strCookieCCode = readCookie('ctspace_countrycode');
var strCookieRedirected = readCookie('ctspace_redirected');
if ((strCookieCCode)&&(!strCookieRedirected)) {
	createCookie('ctspace_redirected','YES','');
	window.location='/'+strCookieCCode+'/';
}
*/

