//** Kapil Kanojia ** Browser Detection Start //
var BrowserDetect = {
    init: function() {
        this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
        this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
        this.OS = this.searchString(this.dataOS) || "an unknown OS";
    },
    searchString: function(data) {
        for (var i = 0; i < data.length; i++) { 
            var dataString = data[i].string;
            var dataProp = data[i].prop;
            this.versionSearchString = data[i].versionSearch || data[i].identity;
            if (dataString) {
                if (dataString.indexOf(data[i].subString) != -1)
                    return data[i].identity;
            }
            else if (dataProp)
                return data[i].identity;
        }
    },
    searchVersion: function(dataString) {
        var index = dataString.indexOf(this.versionSearchString);
        if (index == -1) return;
        return parseFloat(dataString.substring(index + this.versionSearchString.length + 1));
    },
    dataBrowser: [
		{
		    string: navigator.userAgent,
		    subString: "Chrome",
		    identity: "Chrome"
		},
		{ string: navigator.userAgent,
		    subString: "OmniWeb",
		    versionSearch: "OmniWeb/",
		    identity: "OmniWeb"
		},
		{
		    string: navigator.vendor,
		    subString: "Apple",
		    identity: "Safari",
		    versionSearch: "Version"
		},
		{
		    prop: window.opera,
		    identity: "Opera"
		},
		{
		    string: navigator.vendor,
		    subString: "iCab",
		    identity: "iCab"
		},
		{
		    string: navigator.vendor,
		    subString: "KDE",
		    identity: "Konqueror"
		},
		{
		    string: navigator.userAgent,
		    subString: "Firefox",
		    identity: "Firefox"
		},
		{
		    string: navigator.vendor,
		    subString: "Camino",
		    identity: "Camino"
		},
		{		// for newer Netscapes (6+)
		    string: navigator.userAgent,
		    subString: "Netscape",
		    identity: "Netscape"
		},
		{
		    string: navigator.userAgent,
		    subString: "MSIE",
		    identity: "Explorer",
		    versionSearch: "MSIE"
		},
		{
		    string: navigator.userAgent,
		    subString: "Gecko",
		    identity: "Mozilla",
		    versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
		    string: navigator.userAgent,
		    subString: "Mozilla",
		    identity: "Netscape",
		    versionSearch: "Mozilla"
		}
	],
    dataOS: [
		{
		    string: navigator.platform,
		    subString: "Win",
		    identity: "Windows"
		},
		{
		    string: navigator.platform,
		    subString: "Mac",
		    identity: "Mac"
		},
		{
		    string: navigator.userAgent,
		    subString: "iPhone",
		    identity: "iPhone/iPod"
		},
		{
		    string: navigator.platform,
		    subString: "Linux",
		    identity: "Linux"
		}
	]

};
BrowserDetect.init();
//** Kapil Kanojia ** Browser Detection End //


// Kapil Kanojia ** Show Popup with opaque Layer Start //


// Function to hide or show Obe block by getting the value start
function hideObeMainBlock(getValShowHide) {
    if (getValShowHide == "1") {
        // 	setTimeout("hideMainBlock()",10)
        document.getElementById("img4").src = "/images/icon_arrowdown.gif";
        document.getElementById("expd4").style.display = "none";
    }
}

function hideMainBlock() {
    toggleimage('img4', 'expd4');
    animatedcollapse.toggle('expd4');
    hideobeBtmCur();
}
// Function to hide or show Obe block by getting the value end

//Opening a new window Starts Here
var win = null;
function NewWindow(mypage, myname, w, h, scroll, resize) {
    var winl = (window.screen.width - w) / 2;
    var wint = (window.screen.height - h) / 2;
    var settings = 'height=' + h + ',';
    settings += 'width=' + w + ',';
    settings += 'top=' + wint + ',';
    settings += 'left=' + winl + ',';
    settings += 'scrollbars=' + scroll + ',';
    settings += 'resizable=' + resize + '';
    win = window.open(mypage, myname, settings);
    if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
//Opening a new window Ends Here

//INC function starts
document.include = function(url) {
    if ('undefined' == typeof (url)) return false;
    var p, rnd;
    if (document.all) {
        // For IE, create an ActiveX Object instance
        p = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else {
        // For mozilla, create an instance of XMLHttpRequest.
        p = new XMLHttpRequest();
    }
    // Prevent browsers from caching the included page

    // by appending a random  number
    rnd = Math.random().toString().substring(2);
    url = url.indexOf('?') > -1 ? url + '&rnd=' + rnd : url + '?rnd=' + rnd;
    // Open the url and write out the response
    p.open("GET", url, false);
    p.send(null);
    document.write(p.responseText);
}
//INC function ends

//Home banner function starts
//alert("Kapil here \nPlease ignore some javascript errors if it comes.. \n\n Sorry for the inconvinience")

//var maxPhoto=3;
var interval;
var selectedId = 0;
function Begin() {
   interval = window.setInterval("fnstart()", 5000);
}

function fnstart() {
    //if (selectedId < maxPhoto)
    if (selectedId < imgPath.length)
        selectedId = parseInt(selectedId) + 1;
    else
        selectedId = 1;

    fnchange(selectedId)
}


function fnchange(arg) {
    //alert(imgPath.length)
    //for (intCounter=0; intCounter <= maxPhoto; intCounter++)
    for (intCounter = 0; intCounter <= imgPath.length; intCounter++) {
        if (arg == intCounter) {
            //var imgPath = "../images/intbanner_img"+intCounter+".jpg";
            var imgURL = imgPath[intCounter - 1];
            banner1(intCounter, '3', 'intimg', imgURL);
            selectedId = arg;
        }
    }
}


function banner1(curntlnk, totllnk, imgname, imgsrc) {

    var imgnameobj = document.getElementById(imgname);
    for (i = 1; i <= totllnk; i++) {
        document.getElementById("bannerlink" + i).className = "bannerlink";
    }
    document.getElementById("bannerlink" + curntlnk).className = "banneractivelink";
    imgnameobj.src = imgsrc;
}

function banner(curntlnk, totllnk, imgname, imgsrc) {
    //alert('inside banner function' + imgsrc)
    clearInterval(interval);
    var imgnameobj = document.getElementById(imgname);
    for (i = 1; i <= totllnk; i++) {
        document.getElementById("bannerlink" + i).className = "bannerlink";
    }
    document.getElementById("bannerlink" + curntlnk).className = "banneractivelink";
    imgnameobj.src = imgsrc;
}

//Home banner function ends

function changeval(str) {
    var aryOptn = str.split(',');
    document.getElementById("phn1").innerHTML = aryOptn[0];
    document.getElementById("phn2").innerHTML = aryOptn[1];
    document.getElementById("fax").innerHTML = aryOptn[2];
}

/*Font resizing function starts*/
function fontresize(bdobj, fntsz, curnlnk, totllnk) {
    $("div.bdytxt").attr("id", "ContentFontResize");	
    var bodymain = document.getElementById(bdobj);
    if (fntsz == '11') {
        //bodymain.className = 'bdycontnt11';
        $("#ContentFontResize p").css("font-size", "10px");
        for (i = 1; i <= totllnk; i++) {
            document.getElementById("lnkfnt" + i).style.display = "block";
            document.getElementById("lnkfnt" + curnlnk).style.display = "none";
            document.getElementById("blkfnt" + i).style.display = "none";
        }
        document.getElementById("blkfnt" + curnlnk).style.display = "block";
    }
    else if (fntsz == '13') {
    //bodymain.className = 'bdycontnt13';
    $("#ContentFontResize p").css("font-size", "13px");
        for (i = 1; i <= totllnk; i++) {
            document.getElementById("lnkfnt" + i).style.display = "block";
            document.getElementById("lnkfnt" + curnlnk).style.display = "none";
            document.getElementById("blkfnt" + i).style.display = "none";
        }
        document.getElementById("blkfnt" + curnlnk).style.display = "block";
    }
    else if (fntsz == '14') {
    // bodymain.className = 'bdycontnt14';
    $("#ContentFontResize p").css("font-size", "14px");
        for (i = 1; i <= totllnk; i++) {
            document.getElementById("lnkfnt" + i).style.display = "block";
            document.getElementById("lnkfnt" + curnlnk).style.display = "none";
            document.getElementById("blkfnt" + i).style.display = "none";
        }
        document.getElementById("blkfnt" + curnlnk).style.display = "block";
    }
}
/*Font resizing function end*/

function swaptab(objblk1, objlk2, objtab1, objtab2) {
    var objtab1 = document.getElementById(objtab1);
    var objtab2 = document.getElementById(objtab2);
    var blk1 = document.getElementById(objblk1);
    var blk2 = document.getElementById(objlk2);
    if (objtab1.className == "preleasetaboff") {
        objtab1.className = "preleasetabon";
        objtab2.className = "preleasetaboff";
        blk1.style.display = "";
        blk2.style.display = "none";
    }
    else if (objtab2.className == "preleasetaboff") {
        objtab1.className = "preleasetaboff";
        objtab2.className = "preleasetabon";
        blk1.style.display = "none";
        blk2.style.display = "";
    }
}

function innerpgexpndr(objcurvlft, objcurvrght, objexpdrbody) {
    var objcurvlft = document.getElementById(objcurvlft);
    var objcurvrght = document.getElementById(objcurvrght);
    var objexpdrbody = document.getElementById(objexpdrbody);
    if (objexpdrbody.className == "innerpgtabbody") {
        objcurvlft.className = "ectaboff_curvlft";
        objcurvrght.className = "ectaboff_curvrght";
        objexpdrbody.className = "innerpgtabbodyblock";
    }
    else {
        objcurvlft.className = "ectaboff_curvlft";
        objcurvrght.className = "ectaboff_curvrght";
        objexpdrbody.className = "innerpgtabbody"
    }
}

// Bookmark script starts
//var bookmarkurl="http://www.yahoo.com";//book mark url
//var bookmarktitle="Yahoo";//bookmark title
//function addbookmark()
//{
// if(document.all && !window.opera)
// { window.external.AddFavorite(bookmarkurl, bookmarktitle);return false}
//}
// Bookmark script ends

/* Modified to support Opera */
function addbookmark(title, url) {
    if (window.sidebar) // firefox
        window.sidebar.addPanel(document.title, document.URL, "");
    else if (window.opera && window.print) { // opera
        var elem = document.createElement('a');
        elem.setAttribute('href', url);
        elem.setAttribute('title', title);
        elem.setAttribute('rel', 'sidebar');
        elem.click();
    }
    else if (document.all)// ie
        window.external.AddFavorite(document.URL, document.title);
}

// Toggle images function starts
function toggleimage(obj, divid) {
    img1 = document.getElementById('img1');
    img2 = document.getElementById('img2');
    img3 = document.getElementById('img3');
    img7 = document.getElementById('img7');
    
    imgFST = document.getElementById('imgFST');
    imgMMB = document.getElementById('imgMMB');
    imgSch = document.getElementById('imgSch');
    imgPNR = document.getElementById('imgPNR');

    if (img1 != null)
        img1.src = '/images/icon_arrowdown.gif';

    if (img2 != null)
        img2.src = '/images/icon_arrowdown.gif';

    if (img3 != null)
        img3.src = '/images/icon_arrowdown.gif';

    if (img7 != null)
        img7.src = '/images/icon_arrowdown.gif';


    if (imgFST != null)
        imgFST.src = '/images/icon_arrowdown.gif';

    if (imgMMB != null)
        imgMMB.src = '/images/icon_arrowdown.gif';

    if (imgSch != null)
        imgSch.src = '/images/icon_arrowdown.gif';

    if (imgPNR != null)
        imgPNR.src = '/images/icon_arrowdown.gif';

    imgobj = document.getElementById(obj);
    divobj = document.getElementById(divid);
    if (divobj.style.display == 'block')
        imgobj.src = '/images/icon_arrowdown.gif';
    else
        imgobj.src = '/images/icon_arrowup.gif';
}
// Toggle images function ends

// Destination Guide Starts
function showDiv(which) {
    for (i = 0; i < numdivs; i++) {
        if (NN4) eval("document.div" + i + ".display='none'")
        if (IE5) eval("document.all.div" + i + ".style.display='none'")
        if (NN6) eval("document.getElementById('div" + i + "').style.display='none'")
    }
    if (NN4) eval("document.div" + which + ".display=''")
    if (IE5) eval("document.all.div" + which + ".style.display=''")
    if (NN6) eval("document.getElementById('div" + which + "').style.display=''")
}

function activateTab(alinkObject) {
    document.getElementById('a1').className = 'scndlvlnav';
    document.getElementById('a2').className = 'scndlvlnav';
    document.getElementById('a3').className = 'scndlvlnav';
    document.getElementById('a4').className = 'scndlvlnav';
    document.getElementById('a5').className = 'scndlvlnav';
    document.getElementById(alinkObject).className = 'txtbold';
}
function selectedCity(frmObj) {
    sd = document.getElementById('destGuideCity');
    if (frmObj == '') document.getElementById('destGuideContent').style.display = 'none';
    else for (i = 0; i < sd.length; i++) if (sd.options[i].text == frmObj) sd.options[i].selected = true;
}
// Destination Guide Ends

function emailThisPage() {
    document.getElementById("thisPage").value = document.location.href + "++" + document.getElementById("thisPageTitle").innerHTML;
    NewWindow('/PopUpPages/EmailThisPage.aspx', 'email', 632, 470, 'yes', 'yes');
}
function printThisPage() {
    document.getElementById("thisPage").value = document.location.href + "++" + document.getElementById("thisPageTitle").innerHTML;
    NewWindow('/PopUpPages/PrintThisPage.aspx', 'print', 648, 470, 'yes', 'yes')
}


// Script to Set Height to put footer in broswer bottom start

function setHeight() {
    elem = document.getElementById("ddlTimeZoneConverterMonth");

    if (elem != '' && elem != null)
        displaySystemDate(document.getElementById('ddlTimeZoneConverterMonth'), document.getElementById('ddlDay'), document.getElementById('ddlYear'), document.getElementById('ddlHour'), document.getElementById('ddlMinutes'));

    var clientH = document.documentElement.clientHeight;
    var scrollH = document.body.scrollHeight;
    var offsetH = document.documentElement.offsetHeight;
    var tdHeader = document.getElementById("tdHeader");
    var tdContentHSet = document.getElementById("tdContentHSet");
    var tdFooterHSet = document.getElementById("tdFooterHSet");


    var getHeaderFooterH = parseInt(tdHeader.clientHeight + tdFooterHSet.clientHeight);

    if (navigator.appName == "Microsoft Internet Explorer") {
        if (offsetH > scrollH) {
            tdContentHSet.style.height = parseInt(offsetH - getHeaderFooterH - 5) + "px";
            tdContentHSet.style.verticalAlign = "top";
        }
    }
    else {
        //if (clientH > scrollH) {
            tdContentHSet.style.height = parseInt(clientH - getHeaderFooterH) + "px";
            tdContentHSet.style.verticalAlign = "top";
        //}
    }
}

// Script to Set Height to put footer in broswer bottom ends here -->

function selectedLink(frmObj) {
	if(document.getElementById("" + frmObj + ""))
	{
    document.getElementById("" + frmObj + "").href = "javascript:void(0);";
    document.getElementById("" + frmObj + "").className = "noLink";
	}
}


/*tool tip start*/

function showToolTip(e, text, arrowposition, dvwidth, element) {

    if (document.all) e = event;



    if (BrowserDetect.browser == "Safari")

        var clientPageYSafari = e.pageY;

    else

        var clientPageYSafari = e.clientY;







    var obj = document.getElementById('bubble_tooltip');

    var obj2 = document.getElementById('bubble_tooltip_content');

    var ttBlueArrowPosLeft = document.getElementById("TTBlueArrowPosLeft");

    var ttBlueArrowPosRight = document.getElementById("TTBlueArrowPosRight");

    var ttBlueArrowPosBottom = document.getElementById("TTBlueArrowPosBottom");

    var dvToolTipBlue = document.getElementById("dvToolTipBlue");







    //	if(arrowposition=="left" && e.clientX >750)

    //	{

    //	arrowposition="right_callouts";

    //    ttBlueArrowPosLeft.style.display = "none";

    //	ttBlueArrowPosRight.style.display = "";

    //	ttBlueArrowPosBottom.style.display = "none";

    //	dvToolTipBlue.style.padding = "0 15px 0 0";

    //	

    //	}

    if (arrowposition == "left") {

        ttBlueArrowPosLeft.style.display = "";

        ttBlueArrowPosRight.style.display = "none";

        ttBlueArrowPosBottom.style.display = "none";

        dvToolTipBlue.style.padding = "0 0 0 15px";

    }

    else if (arrowposition == "right") {

        ttBlueArrowPosLeft.style.display = "none";

        ttBlueArrowPosRight.style.display = "";

        ttBlueArrowPosBottom.style.display = "none";

        dvToolTipBlue.style.padding = "0 15px 0 0";

    }

    else if (arrowposition == "right_webchkin") {

        ttBlueArrowPosLeft.style.display = "none";

        ttBlueArrowPosRight.style.display = "";

        ttBlueArrowPosBottom.style.display = "none";

        dvToolTipBlue.style.padding = "0 15px 0 0";

    }

    else if (arrowposition == "bottom") {

        ttBlueArrowPosLeft.style.display = "none";

        ttBlueArrowPosRight.style.display = "none";

        ttBlueArrowPosBottom.style.display = "";

        dvToolTipBlue.style.padding = "0 0 0 0";

    }



    else if (arrowposition == "bottom_book") {

        ttBlueArrowPosLeft.style.display = "none";

        ttBlueArrowPosRight.style.display = "none";

        ttBlueArrowPosBottom.style.display = "";

        dvToolTipBlue.style.padding = "0 0 0 0";

    }



    else if (arrowposition == "bottom_redeem") {

        ttBlueArrowPosLeft.style.display = "none";

        ttBlueArrowPosRight.style.display = "none";

        ttBlueArrowPosBottom.style.display = "";

        dvToolTipBlue.style.padding = "0 0 0 0";

    }





    if (text != null)

        obj2.innerHTML = text;



    obj.style.width = dvwidth + "px";

    $("#bubble_tooltip").show();

    var st = Math.max(document.body.scrollTop, document.documentElement.scrollTop);

    if (navigator.userAgent.toLowerCase().indexOf('safari') >= 0) st = 0;

    var leftPos = e.clientX - 100;

    if (leftPos < 0) leftPos = 0;



    if (arrowposition == "left") {



        obj.style.left = e.clientX + element.clientWidth - 10 + 'px';

        obj.style.top = clientPageYSafari + st - 80 + "px"; // - obj.offsetHeight/2 + st + 'px';

        obj.style.zIndex = 12;

    }

    else if (arrowposition == "right") {



        obj.style.left = e.clientX - obj.clientWidth - element.clientWidth + 'px';

        obj.style.top = clientPageYSafari + st - 80 + "px"; //- obj.offsetHeight/2 + st + 'px'; 

        obj.style.zIndex = 12;

    }

    else if (arrowposition == "right_webchkin") {



        obj.style.left = e.clientX - obj.clientWidth - element.clientWidth + 'px';

        obj.style.top = clientPageYSafari + st - 80 + "px"; //- obj.offsetHeight/2 + st + 'px'; 

        obj.style.zIndex = 12;

    }



    //  else if(arrowposition=="right_callouts")

    //	 {

    //   

    //    obj.style.width="auto";

    //   obj.style.left = e.clientX - obj.clientWidth - element.clientWidth + 'px';

    //   obj.style.top = clientPageYSafari + st - 80 +"px"; //- obj.offsetHeight/2 + st + 'px'; 

    //   obj.style.zIndex=12;

    //   

    //  }

    else {

        obj.style.left = leftPos + 100 - parseInt(dvwidth / 2) + 'px';

        obj.style.top = clientPageYSafari - element.clientHeight - 4 - obj.offsetHeight + st + 'px';

        obj.style.zIndex = 12;

    }







    if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) { //test for MSIE x.x;

        var ieversion = new Number(RegExp.$1) // capture x.x portion and store as a number

        if (ieversion <= 6) {

            iframeCallOut = document.createElement("IFRAME");

            iframeCallOut.style.position = "absolute";

            iframeCallOut.frameBorder = "0px";

            iframeCallOut.style.zIndex = 11;

            iframeCallOut.style.width = obj.clientWidth - 23 + "px";

            iframeCallOut.style.height = obj.clientHeight - 8 + "px";



            if (arrowposition == "left") {

                //iframeCallOut.style.left=e.clientX + 27 + 'px';
                iframeCallOut.style.left = e.clientX + 16 + 'px';

                //iframeCallOut.style.top= clientPageYSafari - obj.offsetHeight/2 + 4 + st + 'px';
                iframeCallOut.style.top = clientPageYSafari - obj.offsetHeight / 2 + 0 - 8 + 'px';

                // iframeCallOut.style.border="1px solid red";

            }

            else if (arrowposition == "right") {

                iframeCallOut.style.left = e.clientX - obj.clientWidth - 14 + 'px';

                iframeCallOut.style.top = clientPageYSafari - obj.offsetHeight / 2 + 4 + st + 'px';

            }

            else if (arrowposition == "right_webchkin") {

                iframeCallOut.style.left = e.clientX - obj.clientWidth + 0 + 'px';

                iframeCallOut.style.top = clientPageYSafari - obj.offsetHeight / 2 - 15 + st + 'px';







            }



            //   else if(arrowposition=="right_callouts")

            //  {

            //		 iframeCallOut.style.left=e.clientX - obj.clientWidth + 4 + 'px';

            //		 iframeCallOut.style.top= clientPageYSafari - obj.offsetHeight/2 + 15 + st + 'px';

            //		 //iframeCallOut.style.border="1px solid red";

            //		 

            //		

            //  }

            else if (arrowposition == "bottom_book") {



                iframeCallOut.style.left = leftPos + 0 + 'px';

                iframeCallOut.style.top = clientPageYSafari - obj.offsetHeight - 10 + st + 'px';

                iframeCallOut.style.width = obj.clientWidth - 8 + "px";

                iframeCallOut.style.height = obj.clientHeight - 27 + "px";

            }

            else if (arrowposition == "bottom_redeem") {



                iframeCallOut.style.left = leftPos + 13 + 'px';

                iframeCallOut.style.top = clientPageYSafari - obj.offsetHeight - 10 + st + 'px';

                iframeCallOut.style.width = obj.clientWidth - 8 + "px";

                iframeCallOut.style.height = obj.clientHeight - 20 + "px";

            }

            else {

                iframeCallOut.style.left = leftPos - 21 + 'px';

                iframeCallOut.style.top = clientPageYSafari - obj.offsetHeight - 10 + st + 'px';

                iframeCallOut.style.width = obj.clientWidth - 8 + "px";

                iframeCallOut.style.height = obj.clientHeight - 11 + "px";

            }



            document.body.appendChild(iframeCallOut)

        }

    }





}



function hideToolTip() {

    $("#bubble_tooltip").hide();

    if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) { //test for MSIE x.x;

        var ieversion = new Number(RegExp.$1) // capture x.x portion and store as a number

        if (ieversion <= 6) {

            if (iframeCallOut) { iframeCallOut.style.display = "none" };

        }

    }





}






