<!--
function isIE(){ //ie? 
   if (window.navigator.userAgent.toLowerCase().indexOf("msie")>=1) 
    return true; 
   else 
    return false; 
}

if(!isIE()){   //firefox   browser 
    HTMLElement.prototype.__defineGetter__(     "innerText", 
    function(){
     var anyString = "";
     var childS = this.childNodes;
     for(var i=0; i<childS.length; i++) {
      if(childS[i].nodeType==1)
       anyString += childS[i].tagName=="BR" ? '\n' : childS[i].innerText;
      else if(childS[i].nodeType==3)
       anyString += childS[i].nodeValue;
     }
     return anyString;
    } 
   ); 
   HTMLElement.prototype.__defineSetter__(     "innerText", 
    function(sText){ 
     this.textContent=sText; 
    } 
   ); 
} 

function InfoWindow_Open(theURL, winName) 
{ 
	window.open(theURL,winName,"height=700, width=770, top=0, left=240,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no");
}


function LoadTourSites(path, tourid, departuredate)
{
    try 
    {
        xmlhttp = GetXmlHttpObject(GetTourSites);
        if( path == "/" )
        {
            path = "";
        }
        SendXmlHttpRequest(xmlhttp, path + "/ytb/common/LoadTourSites.aspx?ytb=false&TourID="+tourid+"&DepartureDate="+departuredate+"&"+GetTimeParam());
    }
    catch(e)
    {
    } 
}

function GetTourSites()
{
    try {
        if (xmlhttp.readyState == 4 || xmlhttp.readyState == 'complete') 
        {
            var lbTotalSites = document.getElementById("lbTotalSites");
            var lbSold = document.getElementById("lbSold");
            var lbAvailable = document.getElementById("lbAvailable");
            
            if(xmlhttp.responseText == "")
            {
                lbTotalSites.innerText = "";
                lbSold.innerText = "";
                lbAvailable.innerText = "";
            }
            else
            {
                var response = xmlhttp.responseXML;
                var item = response.getElementsByTagName("Data")[0];
                
                lbTotalSites.innerText = item.getElementsByTagName("TotalSites")[0].firstChild.nodeValue;
                lbSold.innerText = item.getElementsByTagName("Sold")[0].firstChild.nodeValue;
                lbAvailable.innerText = item.getElementsByTagName("Available")[0].firstChild.nodeValue;
            }
        }
    }
    catch(e)
    {   
    }
}

function GoTourListPage(alertmsg, categoryid)
{
    var url = "TourList.aspx";
    if( categoryid != "" )
    {
        url += "?CategoryID=" + categoryid;
    }
    if( alertmsg == 1 )
    {
        if( confirm("Are you sure to give up current order?") )
        {
            document.location = url;
        }
    }
    else
    {
        document.location = url;
    }
}
function GoCityListPage(alertmsg, countryid)
{
    var url = "CityList.aspx";
    if( countryid != "" )
    {
        url += "?CountryID=" + countryid;
    }
    if( alertmsg == 1 )
    {
        if( confirm("Are you sure to give up current order?") )
        {
            document.location = url;
        }
    }
    else
    {
        document.location = url;
    }
}
function GoToPage(alertmsg, url)
{
    if( alertmsg == 1 )
    {
        if( confirm("Are you sure to give up current order?") )
        {
            document.location = url;
        }
    }
    else
    {
        document.location = url;
    }
}
function GoFormDownloadPage(alertmsg)
{
    var url = "FormDownload.aspx";
    if( alertmsg == 1 )
    {
        if( confirm("Are you sure to give up current order?") )
        {
            document.location = url;
        }
    }
    else
    {
        document.location = url;
    }
}
function GoTestimonialsPage(alertmsg)
{
    var url = "Testimonials.aspx";
    if( alertmsg == 1 )
    {
        if( confirm("Are you sure to give up current order?") )
        {
            document.location = url;
        }
    }
    else
    {
        document.location = url;
    }
}
function GoContactPage(alertmsg)
{
    var url = "Contact.aspx";
    if( alertmsg == 1 )
    {
        if( confirm("Are you sure to give up current order?") )
        {
            document.location = url;
        }
    }
    else
    {
        document.location = url;
    }
}
function HidRow(pic)
{
    var rows = new Array("Sightseeing", "Highlight", "RelatedCity", "TourItinerary", "IncludedFeatures", "NotIncludedFeatures", "DepartureDates", "TourFare", "AirfareAddOn", "VisaInformation", "OtherInformation");
    for( var i = 0; i < rows.length; i++ )
    {
        if( i == 0 && pic == "" )
        {
            if( document.getElementById("tr" + rows[i] + "1") != null )
            {
                document.getElementById("tr" + rows[i] + "1").style.display = "none";
            }
            if( document.getElementById("tr" + rows[i] + "2") != null )
            {
                document.getElementById("tr" + rows[i] + "2").style.display = "none";
            }
        }
        if( i != 0 )
        {
            if( document.getElementById("lb" + rows[i]) != null && document.getElementById("lb" + rows[i]).innerText == "" )
            {
                if( document.getElementById("tr" + rows[i] + "1") != null )
                {
                    document.getElementById("tr" + rows[i] + "1").style.display = "none";
                }
                if( document.getElementById("tr" + rows[i] + "2") != null )
                {
                    document.getElementById("tr" + rows[i] + "2").style.display = "none";
                }
            }
        }
    }
}

function DrawImage(ImgD,maxSize)
{
      var image=new Image();
      image.src=ImgD.src; 
      if(image.width>0  &&  image.height>0)
      { 
          if(image.width/image.height>=1)
          {
             if(image.width>maxSize)
             {
                 ImgD.width=maxSize;
                 ImgD.height=(image.height*maxSize)/image.width;
             }
             else
             {
                 ImgD.width=image.width;
                 ImgD.height=image.height;
             } 
          }
          else
          {
             if(image.height>maxSize)
             {
                ImgD.height=maxSize;
                ImgD.width=(image.width*maxSize)/image.height;
             }
             else
             {
                ImgD.width=image.width;
                ImgD.height=image.height; 
             }
          }
     }
}
function DrawImage2(ImgD, maxSizeW, maxSizeH)
{
      var image=new Image();
      image.src=ImgD.src; 
      if(image.width>maxSizeW  ||  image.height>maxSizeH)
      { 
         var scaleW = 1;
         var scaleH = 1;
         if(image.width>maxSizeW)
         {
             scaleW = maxSizeW/image.width;
         }
         if(image.height>maxSizeH)
         {
            scaleH = maxSizeH/image.height;
         }
         if( scaleW > scaleH )
         {
            ImgD.width=image.width*scaleH;
            ImgD.height=image.height*scaleH;
         }
         else
         {
            ImgD.width=image.width*scaleW;
            ImgD.height=image.height*scaleW;
         }
     }
     else
     {
        ImgD.width=image.width;
        ImgD.height=image.height; 
     }
}
function ShowRelatedCity(cityid)
{
    InfoWindow_Open("TourRelatedCity.aspx?CityID="+cityid, "TourRelatedCity");
}
function PrintItinerary(tourid)
{
    InfoWindow_Open("TourDetailPrint.aspx?TourID="+tourid, "PrintItinerary");
}
function EmailToFriend(tourid)
{
    InfoWindow_Open("EmailToFriend.aspx?TourID="+tourid, "PrintItinerary");
}
function SetCtrlValue(objid, val)
{
    var obj = document.getElementById(objid);
    if( obj != null )
    {
        if( val != null )
        {
            obj.value = val;
        }
        else
        {
            obj.value = "";
        }
    }
}
function DoPrint(){
    document.getElementById("btnPrint").style.display="none";
    document.getElementById("btnClose").style.display="none";
    try
    {
        var   bodystr=document.body.innerHTML;   
        var   p_content=document.getElementById("areaPrint").innerHTML;   
        if   (window.print)   
        {   
            document.body.innerHTML   =   p_content;   
            window.print();   
            document.body.innerHTML=bodystr;  
        }
    }
    catch(e)
    {
        //alert(e.name + ": " + e.message);
    }
    document.getElementById("btnPrint").style.display="";
    document.getElementById("btnClose").style.display="";
}
-->
