﻿// JScript File
//featuredPackagesAjaxed
var xmlHttp;
var xmlHttp2;

var theTagID;
function showPackageResults(lb, sid)
{ 
    theTagID = lb;
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Browser does not support HTTP Request");
        return;
    } 
    var url="AjaxOutputPages/PackagesSearchResults.aspx";
    url=url+"?sid=" + sid;
    url=url+"&sessionid="+Math.random();
    xmlHttp.onreadystatechange=stateChanged_package;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}
function stateChanged_package() 
{ 
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    { 
        document.getElementById(theTagID).innerHTML = xmlHttp.responseText;
    } 
} 
/* BEGIN OF GETTING IMAGES*/
function showImages(tid, iid)
{ 
    theTagID = tid;
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Browser does not support HTTP Request");
        return;
    } 
    var url="AjaxOutputPages/GetImages.aspx";
    url=url+"?iid=" + iid;
    url=url+"&sessionid="+Math.random();
    xmlHttp.onreadystatechange=stateChanged_images;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}
function stateChanged_images() 
{ 
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    { 
        document.getElementById(theTagID).innerHTML = xmlHttp.responseText;
    } 
} 
/* END OF FOR GETTING IMAGES */

function domouseover(count)
{
    if(document.getElementById("a_"+count) != null)
    {
        document.getElementById("a_"+count).className = "active";
    }
}
function domouseout(count)
{
    if(document.getElementById("a_"+count) != null)
    {
        //document.getElementById("a_"+count).className = "";
        if(document.getElementById("a_"+count).className == "active"){}
            //document.getElementById("a_"+count).innerHTML = document.getElementById("a_"+count).className;
        else
            document.getElementById("a_"+count).className = "";
    }
}
function showCustomer(str, theName, count, position)
{ 
    document.getElementById("featuredPackageLabel").innerHTML = theName;
    xmlHttp=GetXmlHttpObject();
    xmlHttp2=GetXmlHttpObject();
    itemID = str;
    /*
    if (xmlHttp==null || xmlHttp2==null)
    {
        alert ("Browser does not support HTTP Request");
        return;
    } 
    */
    var url="ajaxer.aspx";
    url=url+"?did="+str;
    url=url+"&sid="+Math.random();
    xmlHttp.onreadystatechange=stateChanged;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
    
    url="AjaxOutputPages/Home_FeaturedPackages.aspx";
    url=url+"?did="+str;
    url=url+"&sid="+Math.random();
    xmlHttp2.onreadystatechange=stateChanged2;
    xmlHttp2.open("GET",url,true);
    xmlHttp2.send(null);
    
    document.getElementById("viewallfp").href = ('Results_Packages.aspx?did='+str);
    for(var i=0;i<=count;i++)
    {
        if(document.getElementById("a_"+i) != null)
        {
            if(i == position)
            {
                document.getElementById("a_"+i).className = "active";
            }
            else
            {
                document.getElementById("a_"+i).className = "";
            }
        }
    }
}
function stateChanged() 
{ 
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    { 
        document.getElementById("destinationName").innerHTML = xmlHttp.responseText;
    } 
} 
function stateChanged2() 
{ 
    if (xmlHttp2.readyState==4 || xmlHttp2.readyState=="complete")
    { 
        document.getElementById("featuredPackagesAjaxed").innerHTML = xmlHttp2.responseText;
    } 
} 

function GetXmlHttpObject()
{ 
var objXMLHttp=null;
if (window.XMLHttpRequest)
{
objXMLHttp=new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
return objXMLHttp
}

function gotoDisplay(tabName) {
	var tabList = new Array(7);
	tabList[0] = 'packagedetails';
	tabList[1] = 'abouttheresort';
	tabList[2] = 'destinationdetails';
	tabList[3] = 'travelerreviews';
	tabList[4] = 'destphotos';
	tabList[5] = 'resortphotos';
	tabList[6] = 'resortdetails';
	
    var i = 0;
	for (i = 0; i<7 ; i++ ){
		document.getElementById(tabList[i]).style.display = "none";
	}
		document.getElementById(tabName).style.display = "block";
	}
	
function gotoDisplay2(tabName) {
	var tabList = new Array(2);
	tabList[0] = 'viewreviews';
	tabList[1] = 'submitreviews';

	
    var i = 0;
	for (i = 0; i<2 ; i++ ){
		document.getElementById(tabList[i]).style.display = "none";
	}
		document.getElementById(tabName).style.display = "block";
	}
	function gotoDisplayspecials(tabName) {
	var tabList = new Array(4);
	tabList[0] = 'familyspecials';
	tabList[1] = 'sizzlingspecials';
	tabList[2] = 'singlesspecials';
	tabList[3] = 'habitatspecials';

	
    var i = 0;
	for (i = 0; i<4 ; i++ ){
		document.getElementById(tabList[i]).style.display = "none";
	}
		document.getElementById(tabName).style.display = "block";
	}
function hideElement(elementName) 
{
    document.getElementById(elementName).style.display = "none";
}
function showElement(elementName) 
{
    document.getElementById(elementName).style.display = "block";
}
function showSpecialElement(elementName)
{
    document.getElementById("div_"+elementName).style.display = "block";
    document.getElementById("td_"+elementName).className = "active";
	 if(elementName == 'Singles')
    {
        document.getElementById('aSinglesRss').style.display = "block";
        document.getElementById('aSizzlingRss').style.display = "none";
        document.getElementById('aFamilyRss').style.display = "none";
    }
    if(elementName == 'Sizzling')
     {
           document.getElementById('aSizzlingRss').style.display = "";
           document.getElementById('aSinglesRss').style.display = "none";
           document.getElementById('aFamilyRss').style.display = "none";
           
     }
    if(elementName == 'Family')
     {
      document.getElementById('aFamilyRss').style.display = "block";
      document.getElementById('aSinglesRss').style.display = "none";
      document.getElementById('aSizzlingRss').style.display = "none";
      }
    
}
function hideSpecialElement(elementName)
{
    document.getElementById("div_"+elementName).style.display = "none";
   // document.getElementById("td_"+elementName).className = "";
    if(elementName == 'Family')
    document.getElementById("td_Family").className = "";
 if(elementName == 'Sizzling')
    document.getElementById("td_Sizzling").className = "";
 if(elementName == 'Singles')
    document.getElementById("td_Singles").className = "";
}
function openImage(ur,eID)
	{
	    alert(document.getElementById (eID).src)
	    var fileName=document.getElementById (eID).src;
    var tittle="";
        var lWindow = new lightwindow();
         lWindow.activateWindow({href:fileName, height:"400",width:"600",iframeEmbed:"false",type:"image",title:tittle,caption:tittle});
	   //imgWin= window.open(ur, '', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=yes, width=500, height=600');
	  // width=imgWin.document.body.clientWidth-document.images[0].width;
	  // height=imgWin.document.body.clientWidth-document.images[0].height;
	   
	  // alert(width);
	   //alert(height);
	  // imgWin.resizeTo (width ,height-100 );
	 //  alert (imgWin.document.body.clientWidth-document.images[0].width);
	 //window.open(ur, '', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=yes,'+ width+','+ height);
	 
	}
/*
==============================================================
Script:     Auto-Sizing Image Popup Window

Functions:  Use this script to launch a popup window that
            automatically loads an image and resizes itself
            to fit neatly around that image. The script also
            places a title you set in the titlebar of the 
            popup window. Any number of images can be launched
            from a single instance of the script.
            
Browsers:   NS6-7 & IE4 and later
            [Degrades functionally in NS4]

Author:     etLux
==============================================================



STEP 1.
Inserting the JavaScript <script> In Your Page

Insert the following script in the <head>...</head> part
of your page. Take special care not to break any of the lines;
they must be exactly as shown.

Set the variables as per the instructions in the script.
*/

// Script Source: CodeLifter.com
// Copyright 2003
// Do not remove this notice.

// SETUPS:
// ===============================

// Set the horizontal and vertical position for the popup

PositionX = 100;
PositionY = 100;

// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)

defaultWidth  = 500;
defaultHeight = 500;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows

var AutoClose = true;

// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
function popImage(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
writeln('width=100-(document.body.clientWidth-document.images[0].width);');
writeln('height=100-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
close();		
}}
