function GetCookie(name) {

    var start = document.cookie.indexOf(name+"=");
    var len = start+name.length+1;
    if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
    if (start == -1) return null;
    var end = document.cookie.indexOf(";",len);
    if (end == -1) end = document.cookie.length;
    return unescape(document.cookie.substring(len,end));
    
}

function swarm() {

	var tsuser = GetCookie('LID');
	
	if (tsuser == null || tsuser == id) {
	
		if (top.name!='TrafficSwarm') {
			
			var swarmurl = 'http://www.trafficswarm.com/cgi-bin/exit.cgi?' + id;
			if (typeof cat != "undefined") { swarmurl += '&' + cat; }

			window2=window.open(swarmurl,'TrafficSwarm','width=750,height=550,left=1,right=1,top=0,toolbar=yes,menubar=yes,scrollbars=yes,status=yes,resizable=yes,status=yes,location=yes');
			window2.blur();
			window.focus();
			return true;

		}	
	
	}
        
}

document.onunload=swarm;
window.onunload=swarm;
