<!--BEGIN Pop-up Images Script------------------------------------------->

// Copyright 1999 - 2002 by Ray Stott, Pop-up Images Script ver 2.0
// OK to use if this copyright is included
// Script is available at http://www.crays.com/jsc

var pic = null
var popImg = null  // use this when referring to pop-up image
var picTitle = null
var imgCount = 0
var imgWinName = "popImg"

function openPopImg(picName, windowTitle, windowWidth, windowHeight){
  closePopImg()
  picTitle = windowTitle
  imgWinName = "popImg" + imgCount++ //unique name for each pop-up window
  popImg = window.open(picName, imgWinName,
           "toolbar=no,scrollbars=no,resizable=no,width=" 
           + (parseInt(windowWidth)+20)  + ",height=" 
           + (parseInt(windowHeight)+15)) 
  }
function closePopImg(){    // close pop-up window if it is open 
  if (navigator.appName != "Microsoft Internet Explorer" 
      || parseInt(navigator.appVersion) >=4) //do not close if early IE
    if(popImg != null) if(!popImg.closed) popImg.close() 
  }
function setStatus(msg){
  status = msg
  return true
  }


// for Netscape 3+ and IE 4+
var priorPic = new Array()
var noPic = 0
var foundit = false

function openPopImg(picName,  windowTitle, windowWidth, windowHeight){
  var i = 0
  if(pic == picName && winOpen()){
    popImg.focus()
    }
  else{
    foundit = false
    for(i=0; i<=noPic; i++){
      if (priorPic[i] == picName)
        foundit = true 
      }
    pic = picName
    closePopImg()
    picTitle = windowTitle
    imgWinName = "popImg" + imgCount++ //unique name for each pop-up window
    if(!foundit){
      priorPic[noPic++] = pic
      }
    popImg = openPopImgWin(imgWinName, windowWidth, windowHeight)
    }
  }
function openPopImgWin(imgWinName, windowWidth, windowHeight){
  var winFeatures = "toolbar=no,scrollbars=no,resizable=no,width=" 
    + windowWidth + ",height=" + windowHeight
  return window.open("pimg.asp", imgWinName, winFeatures)
  }
function winOpen(){
  if(popImg != null){ 
    if(popImg.closed != true) return true; else return false
    }  
  else
    return false
  }


// Use this function to control placement of pop-up window
// in Netscape 4+ and Internet Explorer 4+
function openPopImgWin(imgWinName, windowWidth, windowHeight){
  var leftX = 20  // distance of window's left side from left of screen
  var topY = 20   // distance of window's top side from top of screen
  var winFeatures = "toolbar=no,scrollbars=no,resizable=no,width=" 
    + windowWidth + ",height=" + windowHeight
  if (leftX>0){
    winFeatures += ",screenX=" + leftX + ",left=" + leftX	
                + ",screenY=" + topY + ",top=" + topY
    }
  return window.open("pimg.asp", imgWinName, winFeatures)
  }

     function closePop(url, IsFromPop){
       try{
         if(self.opener != null && IsFromPop != 'true'){
           if(self.opener.closed == true){
             objWin = window.open(url, 'HotelStreet.co.uk');
             objWin.focus();
           } else {
             if(self.opener.location.href != url){
               self.opener.location.href = url;
             }
             self.opener.focus();
           }
         } else {
           objWin = window.open(url, 'HotelStreet.co.uk');
           objWin.focus();
         }
       }catch(e){}
       try{
         self.close();
       }catch(e){}
     }

function BookMark(url,title) {
	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,""); }
	else if(window.external) { // IE Favorite
		window.external.AddFavorite(url,title); }
	else if(window.opera && window.print) { // Opera Hotlist
	return true; }
}

function checkNumber(obj)
{
	if (isNaN(obj.value)) {
	alert ("Please enter the age as a number!")
	obj.focus()}
}

function ChildAges1(objstr)
{
	var value = objstr;
	if (objstr == "Adult2Child1")
	{
		document.getElementById("Age1").style.display='';
		document.getElementById("Age2").style.display='none';
		document.getElementById("childagestag").style.display='';
		
	} else if (value == 'Adult2Child2')
	{
		document.getElementById("Age1").style.display='';
		document.getElementById("Age2").style.display='';
		document.getElementById("childagestag").style.display='';

	} else
	{
		document.getElementById("Age1").style.display='none';
		document.getElementById("Age2").style.display='none';
		document.getElementById("childagestag").style.display='none';
		document.getElementById("Age1").value=''
		document.getElementById("Age2").value=''
	}
}

function checkData()
{	
	var today = new Date();
	var obj = document.searchform;
	var arrYM=obj.FromDateYM[obj.FromDateYM.selectedIndex].value.split("-");
	var d = obj.FromDateDay[obj.FromDateDay.selectedIndex].value;
	var m = arrYM[1];
	var y = arrYM[0];
	var err=0;

	fy = parseInt (y);

	y = parseInt (y) - 2000;
	
	// months with 30 days
	if (m ==4 || m==6 || m==9 || m==11){
		if (d==31) {
			alert ("That month does not have 31 days.");
			return false;
		}	
	}

	if (m==2){
		if (d>29) {
			alert ("That month does not have 31 days.");
			return false;
		}
		if (d==29 && ((y/4)!=parseInt(y/4))) {
			alert ("That year is not a leap year.");
			return false;
		}
	}

	var searchDate = new Date(fy, parseInt(m)-1, parseInt(d), today.getHours(), today.getMinutes(), today.getSeconds())

	if (searchDate < today) {
		alert ("Please choose a date that is after today.");
		return false;
	}
	
	if (obj.resort_id.tagName=="SELECT"){
		if (obj.resort_id.options[obj.resort_id.selectedIndex].value == 0) {
			alert ("Please choose a destination.");
			return false;
		}
	}
	
	if (obj.RoomType[obj.RoomType.selectedIndex].value.indexOf('Child1')>0 && (document.getElementById("Age1").value.length<1 || isNaN(document.getElementById("Age1").value) || document.getElementById("Age1").value>13)) {
		alert ("Please specify the child age in years!\nMax child age is 13!");
		return false;
	}
	if (obj.RoomType[obj.RoomType.selectedIndex].value.indexOf('Child2')>0 && (document.getElementById("Age1").value.length<1 || document.getElementById("Age2").value.length<1 || isNaN(document.getElementById("Age1").value) || isNaN(document.getElementById("Age2").value) || document.getElementById("Age1").value>13 || document.getElementById("Age2").value>13)) {
		alert ("Please specify the childrens ages in years!\nMax child age is 13!");
//		alert (obj.RoomType[obj.RoomType.selectedIndex].value);
		ChildAges1(obj.RoomType[obj.RoomType.selectedIndex].value)
		return false;
	}
//	document.getElementById("subbut").style.display='none';
	getData(document.getElementById('searchform'));
	window.scroll(0,0);
	changeFormAction();
	return false;
}

function changeFormAction()
{
	var obj = document.searchform
//	obj.submit()
	if (obj.resort_id.value.length>0) {
//	obj.action="javascript:get(document.getElementById('searchform'))";
//	obj.method="get";
//	obj.target="_self";
getXML(document.getElementById('searchform'))
	}
}

function changeAction()
{
	var obj = document.searchform
	obj.submit()
	if (obj.DestinationID.value.length>0) {
//	obj.action="javascript:get(document.getElementById('searchform'))";
//	obj.method="get";
//	obj.target="_self";
get(document.getElementById('searchform'))
window.focus()
	}
}


function DayFromDate()
{
	var obj = document.searchform
	var arrYM=obj.FromDateYM[obj.FromDateYM.selectedIndex].value.split("-")
	var d = obj.FromDateDay[obj.FromDateDay.selectedIndex].value
	var m = arrYM[1]
	var y = arrYM[0]
	fy = parseInt (y)

	y = parseInt (y) - 2000
	var weekday=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var searchDate = new Date(fy, parseInt(m)-1, parseInt(d))
document.getElementById("DayName").innerHTML=weekday[searchDate.getDay()]
}

function toggleLayer(whichLayer)
{
	if (document.getElementById)
	{
		// this is the way the standards work
		var style2 = document.getElementById(whichLayer).style;
		style2.display = style2.display? "none":"block";
	}
	else if (document.all)
	{
		// this is the way old msie versions work
		var style2 = document.all[whichLayer].style;
		style2.display = style2.display? "none":"block";
	}
	else if (document.layers)
	{
		// this is the way nn4 works
		var style2 = document.layers[whichLayer].style;
		style2.display = style2.display? "none":"block";
	}
}

function hideMe(whichLayer)
{
	if (document.getElementById)
	{
		// this is the way the standards work
		var style2 = document.getElementById(whichLayer).style;
		style2.display = "none";
	}
	else if (document.all)
	{
		// this is the way old msie versions work
		var style2 = document.all[whichLayer].style;
		style2.display = "none" ;
	}
	else if (document.layers)
	{
		// this is the way nn4 works
		var style2 = document.layers[whichLayer].style;
		style2.display = "none";
	}
}

function addtext(what){
	if (document.createTextNode){
	var mytext=document.createTextNode(what)
	document.getElementById("searchstatus").appendChild(mytext)
}
}

function ShowFrame(whichLayer) {
  var fr = document.getElementById(whichLayer);
if(fr.style.display=="none") {
   fr.style.display="block";
}
else {
   fr.style.display="none";
  }
 }

    function showreviewform(iHotel)
    {
    var Url = "hotel_review.asp?hotel=" + iHotel;
    window_handle=window.open ( Url, "", "toolbar=0,resizable=1,menubar=0,location=0,status=0,scrollbars=3,width=550,height=520,screenX=30,screenY=15,left=30,top=15");
    window_handle.focus();
    }

    function showpoireviewform(iPoi)
    {
    var Url = "poi_review.asp?poi=" + iPoi;
    window_handle=window.open ( Url, "", "toolbar=0,resizable=1,menubar=0,location=0,status=0,scrollbars=3,width=550,height=520,screenX=30,screenY=15,left=30,top=15");
    window_handle.focus();
    }
    
    function showresortreviewform(iResort)
    {
    var Url = "resort_review.asp?resort=" + iResort;
    window_handle=window.open ( Url, "", "toolbar=0,resizable=1,menubar=0,location=0,status=0,scrollbars=3,width=550,height=520,screenX=30,screenY=15,left=30,top=15");
    window_handle.focus();
    }
    function showamendform(ifkid,iCat)
    {
    var Url = "amend_form.asp?fkid=" + ifkid + "&cat_id=" + iCat;
    window_handle=window.open ( Url, "", "toolbar=0,resizable=1,menubar=0,location=0,status=0,scrollbars=3,width=550,height=420,screenX=30,screenY=15,left=30,top=15");
    window_handle.focus();
    }
    function showinfoapprovalform(iInfoid)
    {
    var Url = "qry_amend_form.asp?infoid=" + iInfoid;
    window_handle=window.open ( Url, "", "toolbar=0,resizable=1,menubar=0,location=0,status=0,scrollbars=3,width=550,height=420,screenX=30,screenY=15,left=30,top=15");
    window_handle.focus();
    }

    function showresortreviewapprovalform(iReview)
    {
    var Url = "qry_resort_review_detail.asp?review=" + iReview;
    window_handle=window.open ( Url, "", "toolbar=0,resizable=1,menubar=0,location=0,status=0,scrollbars=3,width=550,height=520,screenX=30,screenY=15,left=30,top=15");
    window_handle.focus();
    }
    function showhotelreviewapprovalform(iReview)
    {
    var Url = "qry_hotel_review_detail.asp?review=" + iReview;
    window_handle=window.open ( Url, "", "toolbar=0,resizable=1,menubar=0,location=0,status=0,scrollbars=3,width=550,height=520,screenX=30,screenY=15,left=30,top=15");
    window_handle.focus();
    }
    function showattractionreviewapprovalform(iReview)
    {
    var Url = "qry_attraction_review_detail.asp?review=" + iReview;
    window_handle=window.open ( Url, "", "toolbar=0,resizable=1,menubar=0,location=0,status=0,scrollbars=3,width=550,height=520,screenX=30,screenY=15,left=30,top=15");
    window_handle.focus();
    }
    function showemailform(link)
    {
    var Url = "/email.asp?url=" + link;
    window_handle=window.open ( Url, "", "toolbar=0,resizable=1,menubar=0,location=0,status=0,scrollbars=3,width=450,height=320,screenX=30,screenY=15,left=30,top=15");
    window_handle.focus();
    }

    function showemailofferform(link)
    {
    var Url = "/emailoffer.asp?" + unescape(link);
    window_handle=window.open ( Url, "", "toolbar=0,resizable=1,menubar=0,location=0,status=0,scrollbars=3,width=450,height=320,screenX=30,screenY=15,left=30,top=15");
    window_handle.focus();
    }

function switchsubmit()
{
document.searchform.submit.disabled=true;
document.searchform.submit.value="Please wait.....";
setTimeout("enablesubmit()",5000);
}
function enablesubmit()
{
document.searchform.submit.disabled=false;
document.searchform.submit.value="Check Availability";
}

function confirmdeleteinfo()
{
var answer=confirm("This will delete this submission.\n Are you sure you want to continue?");
if (answer)
	return true ;
else
	return false ;
}

function confirmdelete()
{
var answer=confirm("This will delete this Hotel.\n Are you sure you want to continue?");
if (answer)
	return true ;
else
	return false ;
}

function confirmdeleteresort()
{
var answer=confirm("This will delete this entire Resort.\n Are you sure you want to continue?");
if (answer)
	return true ;
else
	return false ;
}

function confirmdeleteregion()
{
var answer=confirm("This will delete this entire Region.\n Are you sure you want to continue?");
if (answer)
	return true ;
else
	return false ;
}
// Solution for XHTML strict deprecation of target attribute
function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}
// window.onload = externalLinks;

// AJAX
var xmlHttp
function showHttp(qrystr,div,page)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var url=page
url=url+"?"+(qrystr)
//alert(url)
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=function(){
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
	var thisdiv=document.getElementById(div)
       thisdiv.innerHTML=xmlHttp.responseText;
       var aNodeList = thisdiv.getElementsByTagName("A"); 
       if (aNodeList.item(2)!=null && !win22.closed && win22.location){
      // alert (aNodeList.item(2));
      // win22.location.href=aNodeList.item(2);
       }
   }
};
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function showHint(str)
{
if (str.length<=3||document.getElementById("live").checked!=true)
{ 
document.getElementById("result").innerHTML="Type at least 4 characters!"
return
}
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
} 
var div="result"      
var url="getresort.asp"
url=url+"?q="+escape(str)
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=function(){
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
       document.getElementById("result").innerHTML=xmlHttp.responseText;
   }
};
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 

function showResort(str)
{
if (str.length==0)
{ 
document.getElementById("result").innerHTML="Type the resort ID"
return
}
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var id="result" 
var url="getresortname.asp"
url=url+"?q="+escape(str)
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function stateChanged()
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
   { 
   document.getElementById("result").innerHTML=xmlHttp.responseText 
   } 
} 

function GetXmlHttpObject()
{
  var xmlHttp=null;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
         if (xmlHttp.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //xmlHttp.overrideMimeType('text/xml');
           // xmlHttp.overrideMimeType('text/html');
         }
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    }
  return xmlHttp;
}
// Funtion to collect form data
   function getData(obj) {
      var getstr = "";
      for (i=0; i<obj.childNodes.length; i++) {
         if (obj.childNodes[i].tagName == "INPUT") {
            if (obj.childNodes[i].type == "text" || obj.childNodes[i].type == "hidden") {
               getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";
            }
            if (obj.childNodes[i].type == "checkbox") {
               if (obj.childNodes[i].checked) {
                  getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";
               } else {
                  getstr += obj.childNodes[i].name + "=&";
               }
            }
            if (obj.childNodes[i].type == "radio") {
               if (obj.childNodes[i].checked) {
                  getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";
               }
            }
         }   
         if (obj.childNodes[i].tagName == "SELECT") {
            var sel = obj.childNodes[i];
            getstr += sel.name + "=" + sel.options[sel.selectedIndex].value + "&";
         }
         
      }
//      alert(escape(getstr));
	win22=window.open('linkout.asp?'+(getstr),'','toolbar=1,resizable=1,menubar=1,location=1,status=1,scrollbars=1,width=400,height=600,left=5,top=5');
	win22.blur();
	window.focus();

   }
   
   function getXML(obj) {
      var getstr = "";
      for (i=0; i<obj.childNodes.length; i++) {
         if (obj.childNodes[i].tagName == "INPUT") {
            if (obj.childNodes[i].type == "text" || obj.childNodes[i].type == "hidden") {
               getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";
            }
            if (obj.childNodes[i].type == "checkbox") {
               if (obj.childNodes[i].checked) {
                  getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";
               } else {
                  getstr += obj.childNodes[i].name + "=&";
               }
            }
            if (obj.childNodes[i].type == "radio") {
               if (obj.childNodes[i].checked) {
                  getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";
               }
            }
         }   
         if (obj.childNodes[i].tagName == "SELECT") {
            var sel = obj.childNodes[i];
            getstr += sel.name + "=" + sel.options[sel.selectedIndex].value + "&";
         }
         
      }
   	document.getElementById('searchresults').innerHTML='<div id="searchstatus" class="SearchBox"><img src="/images/loader.gif" width="100" height="100" border="0" alt="Search can take up to 30 seconds"><br /><span class="HeadFont">Searching for the best prices. Please wait... <br/>Results can take up to 30 seconds and will appear here.</span></div>'
	var strPage=window.location.pathname + '\?type=xmlsearch';
    showHttp(getstr,'searchresults','xml/xmlsearch.asp');
	urchinTracker(strPage);   
   }
