// get current datetime
var now = new Date();

// create string value unique to this page view
var stamp = now.valueOf();
var rand = Math.random();
var unique = stamp.toString() + rand.toString();

// if rta_id cookie does not exist, set it
var pos = document.cookie.indexOf("rta_id=");
if (pos < 0) {
	// Cookie expires in 5 years
	var expires = now; expires.setFullYear(now.getFullYear() + 5);
	Set_Cookie("rta_id",unique,expires,null,null,false);	
}


// utility function to set cookies
function Set_Cookie(name,value,expires,path,domain,secure) {
	var thisCookie = name + "=" + escape(value);
	var thisCookieSize = thisCookie.length;
    document.cookie = thisCookie +
         ( (expires) ? ";expires=" + expires.toGMTString() : "") +
         ( (path) ? ";path=" + path : "") + 
         ( (domain) ? ";domain=" + domain : "") +
         ( (secure) ? ";secure" : "");
	return false;
}

