var moz;
var mynum;
var resortid;
function getGallery2(picnum, id) {
alert("jai");

    var bodyTag = document.getElementsByTagName('body').item(0);
    var spanTag = document.createElement('span');
    spanTag.setAttribute('id', 'dghotels_ctl1_spbtnimages');
    spanTag.style.display = 'none';
    bodyTag.appendChild(spanTag);

    resortid = id;

    mynum = picnum;
    importXML2("../Common_Inc/photoessay.xml");
    if (moz == 1) {
        //Mozilla
        var idraj = "id" + eval(mynum - 1).toString();
        initLightbox();
        Lightbox.start(eval(idraj));
    }
    else {
        //IE
        var idraj = "id" + eval(mynum - 1).toString();
        initLightbox();
        Lightbox.start(eval(idraj));

    }
    window.scrollTo(200,200);

}




// Functions below is used to call photo gallery.
function importXML2(file) {
    if (window.ActiveXObject && /Win/.test(navigator.userAgent)) {
        oLoadedXML = new ActiveXObject("Msxml.DOMDocument");
        oLoadedXML.async = false;
        oLoadedXML.onreadystatechange = function() {
            if (oLoadedXML.readyState == 4) parseXML2();
        }
        oLoadedXML.load(file);
    }
    else if (document.implementation && document.implementation.createDocument) {
        oLoadedXML = document.implementation.createDocument("", "", null);
        oLoadedXML.async = false;
        var loaded = oLoadedXML.load(file);
        moz = 1;
        if (loaded) {
            parseXML2();
        }
    }
    else {
        alert("Your browser can\'t handle this script");
        return;
    }
}


function parseXML2() {
    var currURL = window.location.href;
    var posi = currURL.indexOf("picnum")
    if (posi == 0 || posi == -1) {
        //
    }
    else {
        var picstr1;
        picstr1 = currURL.substring(posi)
        picstr2 = picstr1.split("=");
        mynum = picstr2[1];
    }

    var mystr = "";
    var j = 0;
    strTitle = oLoadedXML.getElementsByTagName("location")[0];
    for (var i = 0; i < strTitle.getElementsByTagName('gallery').length; i++) {
        if (strTitle.getElementsByTagName('gallery')[i].getAttribute("resort") == resortid) {
			

            if (j == (mynum - 1)) {              
                mystr += "<a id='id" + j + "' name='" + j + "'  href='Images/Slideshow/"  + strTitle.getElementsByTagName('gallery')[i].getAttribute("mainpic") + "' rel='lightbox[shahenil]' title='" + (strTitle.getElementsByTagName('gallery')[i].getAttribute("imgtitle") == null ? "" : strTitle.getElementsByTagName('gallery')[i].getAttribute("imgtitle")) + "'></a>";              
            }
            else {                
                mystr += "<a  href='Images/Slideshow/" + strTitle.getElementsByTagName('gallery')[i].getAttribute("mainpic") + "' rel='lightbox[shahenil]' title='" + (strTitle.getElementsByTagName('gallery')[i].getAttribute("imgtitle") == null ? "" : strTitle.getElementsByTagName('gallery')[i].getAttribute("imgtitle")) + "'></a>"
               
            }
            
            j++;
        }
    }
  
    dghotels_ctl1_spbtnimages.innerHTML = mystr;

}



