var sid = Math.floor(Math.random()*100001)
sid = sid.toString()
var currentTime = new Date()
var month = currentTime.getMonth() + 1
month.toString();
var day = currentTime.getDate()
day.toString();
var year = currentTime.getFullYear()
year.toString();
var date = (month&day&year)
var hours = currentTime.getHours().toString()
var minutes = currentTime.getMinutes().toString()
var seconds = currentTime.getSeconds().toString()
sid = sid+month+day+year+hours+minutes+seconds
setCookie('sid',sid,1);

var GCIDquery = window.top.location.search.substring(1); //get querystring
GCIDquery = GCIDquery.substring(5,GCIDquery.length); // extract value of GCID
if (GCIDquery == "") { //check if querysting is blank
	GCID=getCookie('GCID'); //check for cookie if querysting is blank
	if (GCID!=null && GCID!="")
  		GCID = GCID;
	else 
  	{
  		GCID="C18131x381";//default GCID
  		setCookie('GCID',GCID,90);
 	}
 }	
 else 
    {
    GCID = GCIDquery;
    setCookie('GCID',GCID,90);
  	}
if (document.images)
{
trackingPixel = new Image()
trackingPixel.src = "http://track.roiservice.com/track/pixel.gif.aspx?roiid=931318107000014&sid="+ sid + "&GCID=" + GCID
document.images.src = trackingPixel.src
var hotDealsURL = "http://reservations.ihotelier.com/crs/indexpromo.cfm?roiid=931318107000014&hotelid=2933&languageid=1&sid=" + sid + "&GCID=" + GCID
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1 ;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return "";
}
function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : "; expires="+exdate.toGMTString());
}
