pdm=location.host.indexOf(".")+1;

function SetCookie (name, value) {  
	var expires= new Date(); 
	expires.setYear(2032);
	document.cookie = name + "=" + escape (value) + 
	"; expires=" + expires.toGMTString() +
	"; path=/" +  
	"; domain="+location.host.substring(pdm);
}

function GetCookie (name) {  
	var arg = name + "=";  
	var alen = arg.length;  
	var clen = document.cookie.length;  
	var i = 0;  
	while (i < clen) {    
		var j = i + alen;    
		if (document.cookie.substring(i, j) == arg)      
			return getCookieVal (j);    
		i = document.cookie.indexOf(" ", i) + 1;    
		if (!i) break;   
	}  
	return null;
}