﻿
//new functuions --
//author:jobin george
//date :08-17-2010
//purpose:right side search on main.master, to pass value to hidden
// field hidSearchType
 
var defaults="-- Hotel --/-- Package --/--  Destination --";
function fnSetSearchType(type) {
    var spanValue;
    var textvalue; 
    document.getElementById("hidSearchType").value = type;
    if (document.getElementById("hidSearchType").value == "Dest") {
        spanValue = "destination";
        textvalue = '--  Destination --';
    }    
    else if (document.getElementById("hidSearchType").value == "Pack") { spanValue = "package"; textvalue = '-- Package --';; }
    else if (document.getElementById("hidSearchType").value == "Hotel"){ spanValue = "hotel"; textvalue ='-- Hotel --';}    
    document.getElementById("spTabSelValue").innerHTML = spanValue;
    document.getElementById("txtSearch").value = textvalue;
}

//author:jobin george
//date :08-17-2010
//purpose:right side search on main.master, to set the text box values
function fnSetSearchText(eventtype) {
    if (eventtype == 'focus') {
        document.getElementById("txtSearch").value = '';
    }
    else if (eventtype == 'blur') {
    if (document.getElementById("txtSearch").value.length == 0) {

        var textvalue;

        if (document.getElementById("hidSearchType").value == "Dest") textvalue = '--  Destination --';
        else if (document.getElementById("hidSearchType").value == "Pack") textvalue = '-- Package --';
        else if (document.getElementById("hidSearchType").value == "Hotel") textvalue = '-- Hotel --';
        document.getElementById("txtSearch").value = textvalue;
        }
    }

}

function fnNavigate() {
   
    if (document.getElementById("txtSearch").value.length > 0 && defaults.indexOf(document.getElementById("txtSearch").value)==-1) {
         var navUrl;
         if (document.getElementById("hidSearchType").value == "Dest") {
             navUrl = "destinations.aspx?search=" + document.getElementById("txtSearch").value;
         }
         else if (document.getElementById("hidSearchType").value == "Pack") {
             navUrl = "packages.aspx?search=" + document.getElementById("txtSearch").value;
        }
      else if (document.getElementById("hidSearchType").value == "Hotel") {
      navUrl = "hotels.aspx?tp=search&val=" + document.getElementById("txtSearch").value;
        }
        window.location.href = navUrl;
   }}

function fnFillScrollHeader() {
    //ulHeaderScroll
     
    var strHtml;
    strHtml = "<li><div class='panel'><div class='sliding_cont'>";
    strHtml = strHtml + "<a href='#'><img src='images/thumb_img_01.jpg'  alt='thumb_01' class='img_border' /></a>";
    strHtml = strHtml + "<div class='object_text'><a href='#'> XXlocXX </a></div>";
    strHtml = strHtml + "</div><div class='clear'></div></div></li>";

    var strHtmlfull;
    strHtmlfull = strHtml + strHtml;
    strHtmlfull = strHtmlfull + strHtml;
    strHtmlfull = strHtmlfull + strHtml;

    document.getElementById("ulHeaderScroll").innerText = strHtmlfull;
}
function fnKeyDown(e) {
    
            var key;
         if(window.event)
              key = window.event.keyCode;     //IE

         else
             key = e.which;     //firefox

        
        if (key == 13)
        {
            fnNavigate();
        }

}


