//browser/platform checker
function fon_checkBrowser(){
	this.ver=navigator.appVersion; this.dom=document.getElementById?1:0;
	this.mac=(this.ver.indexOf("PPC")!= -1)?1:0;	this.win=(this.ver.indexOf("Win")!= -1)?1:0;
	this.ie5up=(this.ver.indexOf("MSIE") && this.dom && parseInt(this.ver) >= 4) ?1:0;
	this.ie4=(document.all && !this.dom)?1:0; this.ie=(this.ie5up || this.ie4);
	this.ns5up=(this.ver.indexOf("MOZILLA") && this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0; this.ns=(this.ns4 || this.ns5up);
	this.fon=(this.ie || this.ns);
	return this;
}
fon=new fon_checkBrowser();

var expDays = 365;
var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

function SetCookie (name, value) {  
var expires = (SetCookie.arguments.length > 2) ? SetCookie.arguments[2] : null;  
var path = (SetCookie.arguments.length > 3) ? SetCookie.arguments[3] : null;  
var domain = (SetCookie.arguments.length > 4) ? SetCookie.arguments[4] : null;  
var secure = (SetCookie.arguments.length > 5) ? SetCookie.arguments[5] : false;  
document.cookie = name + "=" + escape (value) + 
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
((path == null) ? "" : ("; path=" + path)) +  
((domain == null) ? "" : ("; domain=" + domain)) +    
((secure == true) ? "; secure" : "");
}

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 == 0) break;   
}  
return null;
}

function delCookie (name) {  
var exp = new Date();  
exp.setTime (exp.getTime() - 1);  
var cval = getCookie (name); 
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}	

function getCookieVal (offset) {  
var endstr = document.cookie.indexOf (";", offset);  
if (endstr == -1)    
endstr = document.cookie.length;  
return unescape(document.cookie.substring(offset, endstr));
}
