var Cookie = {
pref:'',last:null,
cnfg:function(a1) {
	var Bool={secure:1}, text='';
	if (''+a1!==a1) for (var k in a1) if (a1[k]) text += '; '+(
		Bool[k] ? k : k+'='+(
			k!='expires'||isNaN(a1[k]) ? a1[k] : this.date(a1[k])
		)
	);
	return this.pref = text||a1||text;
},
make:function(a1,a2,a3) {
	document.cookie = this.last=escape(a1)+'='+escape(a2)+this.cnfg(a3);
	return this.read(a1) == a2;
},
date:function(a1) {
	var D = new Date();
	D.setTime(D.getTime()+(a1||0)*86400000);
	return D.toGMTString();
},
read:function(a1) {
	var F=' '+document.cookie+';', S=F.indexOf(' '+(a1=escape(a1)));
	return S==-1 ? null : unescape(
		F.substring(a1=S+a1.length+2,F.indexOf(';',a1))
	);
}
}

var loginurl = "/cgi/login_index.pl";
var loginname = "Login";
if(Cookie.read('CUSTOMER_ID')) {
	loginurl = "/cgi/customer_index.pl";
	loginname = "My Account";
}

function customerLogout() {
	Cookie.make('CUSTOMER_ID','',{path:'/',expires:'0'});
	top.document.location.href = "/cgi/login_index.pl";
}

function guestLogout() {
	Cookie.make('GUEST_CUSTOMER_ID','',{path:'/',expires:'0'});
	top.document.location.href = "/cgi/customer_search.pl";
}

