var usrType;
var userTypeArray = new Array("A","B","C","D","E","F","M","N","O","P","Q","R");

function readCookie(cookieName)
{
 // alert("reading cookie...");
 if (document.cookie.length>0)
   {
   startIdx=document.cookie.indexOf(cookieName + "=");
   if (startIdx!=-1)
     {
     startIdx=startIdx + cookieName.length+1;
     endIdx=document.cookie.indexOf(";",startIdx);
     if (endIdx==-1)
      endIdx=document.cookie.length;
     return unescape(document.cookie.substring(startIdx,endIdx));
     }
   }
   // The cookie value was blank, so randomly choose a letter for this user and set the cookie
   var letter = randomChar("ABCDEFGHIJKLMNOPQRSTUVWX");
   setCookie("PZN_userRecommendationType", letter, 365);
   return letter;
}

function setCookie(c_name,value,expiredays)
{
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";path=/;expires="+exdate.toGMTString());
}

function randomChar(str) 
// Given  : str is a nonempty string 
// Returns: a random character from the string 
{  
    return str.charAt(randomInt(0, str.length-1)); 
}

function randomInt(low, high) 
// Given   : low <= high 
// Returns : a random integer in the range [low, high] 
{ 
    return Math.floor(Math.random()*(high-low+1)) + low; 
} 

function showTripAdLink()
{
 
 // reads the cookie
 usrType = readCookie("userRecommendationType");
 // alert("Cookie Value is " + usrType);
 // document.write("Cookie value is " + usrType + "<br/><br>\n");
 
 // User Type Array
 var index;
 // Iterate the User Types and check whtr the logged in user is of available type then return true.
 
 var s_prop24;
 var s_linkTrackVars;

 for (index in userTypeArray)
 {
  if(usrType != "" && userTypeArray[index] == usrType)
  {
		//var s=s_gi('harglobal');
		//s_linkTrackVars='prop24';
		//s_prop24 = 'TripAdvisor Leftnav:ON';
		//s_tl(this,'o','TripAdvisor Leftnav:ON');
	    s_linkType='o';s_linkName='TripAdvisor Leftnav:ON';s_prop24='TripAdvisor Leftnav:ON';s_linkTrackVars="s_prop24";s_lnk=s_co(this); s_gs('harrahsglobal');
   		return true;
  }
 }
 s_linkType='o';s_linkName='TripAdvisor Leftnav:OFF';s_prop24='TripAdvisor Leftnav:OFF';s_linkTrackVars="s_prop24";s_lnk=s_co(this); s_gs('harrahsglobal');
 return false;
}