function shadowBox( type, sSrc, sTitle, sDesc, sWidth, sHeight ) {
    Shadowbox.clearCacheObj();
    if ( type == "img" ) {
        Shadowbox.open({
            player:     'img',
            title:      sTitle,
            infoText:   sDesc,
            content:    sSrc
        });
    }else if ( type == "gallery" ) {
        importXML(sSrc, sTitle, sDesc);
    }else if ( type == "swf" ) {
        Shadowbox.open({
            player:     'swf',
            title:      sTitle,
            infoText:   sDesc,
            content:    sSrc,
            width:      sWidth,
            height:     sHeight
        });
    }else if ( type == "flv" ) {
        Shadowbox.open({
            player:     'flv',
            title:      sTitle,
            infoText:   sDesc,
            content:    sSrc,
            width:      sWidth,
            height:     sHeight
        });
    }else if ( type == "mov" ) {
        Shadowbox.open({
            player:     'qt',
            title:      sTitle,
            infoText:   sDesc,
            content:    sSrc,
            width:      sWidth,
            height:     sHeight
        });
    }else if ( type == "wmv" ) {
        Shadowbox.open({
            player:     'wmp',
            title:      sTitle,
            infoText:   sDesc,
            content:    sSrc,
            width:      sWidth,
            height:     sHeight
        });
    }
}

var xmlDoc = null;
var GalleryTitle = "";
var StartGallery = 0;

function importXML( sContentID, sTitle, iStart ) {
    GalleryTitle = sTitle;
    if ( iStart != "" )
        StartGallery = iStart;
    
    if (window.ActiveXObject) //IE
        xmlDoc = new ActiveXObject("Microsoft.XMLHTTP");
    else if (window.XMLHttpRequest) //other
        xmlDoc = new XMLHttpRequest();
    else
        alert("your browser does not support AJAX");

    xmlDoc.open("GET", "/images/gallery/" + sTitle + "/gallery.xml");
    xmlDoc.setRequestHeader("Cache-Control", "no-cache");
    xmlDoc.setRequestHeader("Pragma", "no-cache");
    xmlDoc.setRequestHeader("Content-Type", "text/xml; charset=utf-8");

    xmlDoc.onreadystatechange = function() {
        if (xmlDoc.readyState == 4)
        {
            if (xmlDoc.status == 200)
            {
                if (xmlDoc.responseText != null)
                    LoadImages();
                else
                {
                    alert("Failed to receive the file from the server - file not found.");
                    return false;
                }
            }
            else
                alert("Error code " + xmlDoc.status + " received: " + xmlDoc.statusText);
        }
    }

    xmlDoc.send(null);
}

function LoadImages() {
    var x = xmlDoc.responseXML.getElementsByTagName('photo');
    if ( x.length ) {
        for (i=0; i<x.length; i++) {
            Shadowbox.buildCustomCacheObj({
                player:     'img',
                title:      '<strong>' + GalleryTitle + '</strong><br/>' + x[i].childNodes[1].firstChild.nodeValue,
                infoText:   x[i].childNodes[2].firstChild.nodeValue,
                content:    '/images/gallery/' + GalleryTitle + '/' + x[i].childNodes[0].firstChild.nodeValue,
                gallery:    'SurroundGallery'
            });
        }
        Shadowbox.open({
            player:     'img',
            title:      '',
            infoText:   '',
            content:    '',
            gallery:    'SurroundGallery'
        },null,--StartGallery);
    }
}

// Open a Window for a tour

function OpenTour(TourUrl, TourName) {
  {
    TourWin = window.open(TourUrl,TourName,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=790,height=590');
    TourWin.focus()
  }
}

