var xmlHttp

function addStat(accommID,statType)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="includes/savePageClick.asp?accommID=" + accommID + "&statType='" + statType+"'" ;


xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);

}

function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("debug").innerHTML=xmlHttp.responseText;
}
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
} 

///fav section 
var expDays = 30;
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
var ShowCount = 0;
var SwapColour;

function ListToDoItems() {
var NumToDoItems = GetCookie('PT_NumToDoList');
var i;
var ToDoItem;
var ToDoName
var ToDoType
var hotCt, ghCt, slfCt, attCt, rstCt
htCt = 0 
ghCt = 0 
slfCt = 0 
attCt = 0
rstCt = 0 
if (NumToDoItems == null) {
NumToDoItems = 0;
}
ShowCount = 0;
for (i=1; i <= NumToDoItems; i++) {
ToDoItem = GetCookie('PT_ToDoItem'+i);
ToDoName = GetCookie('PT_ToDoName'+i);
ToDoType = GetCookie('PT_ToDoType'+i);
switch (ToDoType){
	case "Hotel" :htCt++  ;break
	case "Guest House" :ghCt++ ;break
	case "Self Catering" :slfCt++  ;break
	case "Attraction" :attCt++ ;break
	case "Restaurant" :rstCt++ ;break
	
	} 
	PrintItem(htCt,ghCt,slfCt,attCt,rstCt)
   }

}
//
function listAccommIDs() {
var NumToDoItems = GetCookie('PT_NumToDoList');
var i;
var ToDoItem;
var ToDoName
var ToDoType
var hotCt, ghCt, slfCt, attCt, rstCt
htCt = 0 
ghCt = 0 
slfCt = 0 
attCt = 0
rstCt = 0 
if (NumToDoItems == null) {
NumToDoItems = 0;
}
ShowCount = 0;
var accommIds = ""
for (i=1; i <= NumToDoItems; i++) {
ToDoItem = GetCookie('PT_ToDoItem'+i);
ToDoName = GetCookie('PT_ToDoName'+i);
ToDoType = GetCookie('PT_ToDoType'+i);
		accommIds+=(ToDoItem+",")
   }
   $('AccommIds').setProperty('value', accommIds); 

}//
//////////
function listAccommIDs() {
var NumToDoItems = GetCookie('PT_NumToDoList');
var i;
var ToDoItem;
var ToDoName
var ToDoType
var hotCt, ghCt, slfCt, attCt, rstCt
htCt = 0 
ghCt = 0 
slfCt = 0 
attCt = 0
rstCt = 0 
if (NumToDoItems == null) {
NumToDoItems = 0;
}
ShowCount = 0;
var accommNames = "<strong>Your Shortlist :</strong><br/>"
for (i=1; i <= NumToDoItems; i++) {
ToDoItem = GetCookie('PT_ToDoItem'+i);
ToDoName = GetCookie('PT_ToDoName'+i);
ToDoType = GetCookie('PT_ToDoType'+i);
if (ToDoName != null) {
		accommNames+=("<a href='details.asp?accommID="+ToDoItem+"' target='_self' title='View "+ToDoName+"'>"+ToDoName+"</a> - <a href='javascript:DeleteItem(" + i + ")'>Remove</a><br />")
   }
}
   
  $('AccommNames').setHTML(accommNames); 

}

//////////
function DeleteItem(Count) {
DeleteCookie('PT_ToDoItem'+Count);
DeleteCookie('PT_ToDoName'+Count);
DeleteCookie('PT_ToDoType'+Count);
window.location = window.location;
}
function PrintItem(htCt,ghCt,slfCt,attCt,rstCt) {
ShowCount++;
var shortListCt = ''
$('shortList').setHTML(shortListCt);

if (Number(htCt+ghCt+slfCt+attCt+rstCt) > 0 ) {
	//document.write(Number(htCt+ghCt+slfCt+attCt+rstCt))
shortListCt+= ('<img src="images/left_shortlist.gif" alt="site search links" width="157" height="21" /><br />');
}
//shortListCt+=("<tr bgcolor='#EEDFDC'>")
if (htCt > 0) {
shortListCt+=('<img src="images/white.gif" width="157" height="1" vspace="2" alt="one" /><br /><a href="emailShortList.asp" class="searchLink"><img src="images/arrow2.gif" alt="seven" width="7" height="7" hspace="5" border="0" />'+htCt+'  x hotel</a><br />')
}
if (ghCt > 0) {
shortListCt+=('<img src="images/white.gif" width="157" height="1" vspace="2" alt="two" /><br /><a href="emailShortList.asp" class="searchLink"><img src="images/arrow2.gif" alt="eight" width="7" height="7" hspace="5" border="0" /></a><a href="emailShortList.asp" class="searchLink">'+ghCt+'  x guest house</a><br />')
}
if (slfCt > 0) {
shortListCt+=('<img src="images/white.gif" width="157" height="1" vspace="2" alt="three" /><br /> <a href="emailShortList.asp" class="searchLink"><img src="images/arrow2.gif" alt="nine" width="7" height="7" hspace="5" border="0" /></a><a href="emailShortList.asp" class="searchLink">'+slfCt+'  x self catering </a><br />')
}
if (attCt > 0) {
shortListCt+=('<img src="images/white.gif" width="157" height="1" vspace="2" alt="four" /><br /><a href="emailShortList.asp" class="searchLink"><img src="images/arrow2.gif" alt="ten" width="7" height="7" hspace="5" border="0" /></a><a href="emailShortList.asp" class="searchLink">'+attCt+'  x attraction</a><br />')
}
if (rstCt > 0) {
shortListCt+=('<img src="images/white.gif" width="157" height="1" vspace="2" alt="five" /><br /><a href="emailShortList.asp" class="searchLink"><img src="images/arrow2.gif" alt="eleven" width="7" height="7" hspace="5" border="0" /></a><a href="emailShortList.asp" class="searchLink">'+rstCt+'  x restaurant</a><br />')
}

shortListCt+=('<img src="images/white.gif" width="157" height="1" vspace="2" alt="six" /><br /><a href="emailShortList.asp" class="searchLink"><img src="images/arrow2.gif" alt="twelve" width="7" height="7" hspace="5" border="0" /><strong>View your Shortlist</strong></a><br />  <img src="images/white.gif" width="157" height="1" vspace="2" alt="thirteen" />');

$('shortList').setHTML(shortListCt);

}
function AddItem(accommID, accommName, accommType) {
var NumToDoItems = GetCookie('PT_NumToDoList');
var i;
var ToDoItem;
if (NumToDoItems == null) {
NumToDoItems = 0;
}
ToDoItem = accommID;
if ((ToDoItem != null) && (ToDoItem != "undefined" )) {
NumToDoItems++;
SetCookie('PT_ToDoItem'+NumToDoItems, ToDoItem, exp);
SetCookie('PT_ToDoName'+NumToDoItems, accommName, exp);
SetCookie('PT_ToDoType'+NumToDoItems, accommType, exp);
SetCookie('PT_NumToDoList',NumToDoItems, exp);
window.location = window.location;
   }
}
function set() {
VisitorName = prompt("Who are you?");
SetCookie ('VisitorName', VisitorName, exp);
SetCookie ('WWHCount', 0, exp);
SetCookie ('WWhenH', 0, exp);
}
function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
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 SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) {
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}




////
