var callGallery = false;

// Start Gallery
function startGallery() {
    var flashvars = {XMLFile: "sub/facility-gallery.xml"}
    var params = {bgcolor: "#FFD700", allowFullScreen: "true"};
    swfobject.embedSWF("lib/ArtFlashGallery.swf", "myAlternativeContent", "100%", "350px", "9.0.0", false, flashvars, params);
}

// Ajax event handler
function state_Change() {
// if xmlhttp shows "loaded"
    if (xmlhttp.readyState==4) {
    // if "OK"
        if (xmlhttp.status==200) {
            loadXML(xmlhttp.responseText);
        } else {
            alert("Problem retrieving XML data:" + xmlhttp.statusText);
        }
    }
}

function processResult() {
    // xmlDoc, in this function, is merely a text string - not an XML Document
    if(xmlDoc) {
        var innerDoc = document.createElement('div');
//        innerDoc.innerHTML = xmlDoc; //alert(innerDoc.childNodes[1].attributes.length);
//        var divContent = document.getElementById(innerDoc.childNodes[1].getAttribute('location'));
//        var divContent = document.getElementById(innerDoc.childNodes[1]);
//        alert(divContent.attributes.length);
        var divContent = document.getElementById('centerContent');
        divContent.style.visibility = 'hidden';
        divContent.innerHTML = xmlDoc;
        divContent.style.visibility = 'visible';
        
        if(callGallery) { startGallery(); }
    }
}
    
function show(content) {
    if(content == 'sub/facility.xml') { callGallery = true; } else { callGallery = false; }
    loadXMLDoc(content);
}

function showNew(content) {
    window.open(content,"FAAView","width=1000,height=750");
}

function showHome() {
    $('centerHome').style.display = '';
    $('centerRates').style.display = 'none';
    $('leftContent').style.display = 'block';
    $('leftPhoto').style.display = 'none';
    $('rightContent').style.display = 'block';
    $('rightPhoto').style.display = 'none';
}

function showRates() {
    $('centerHome').style.display = 'none';
    $('centerRates').style.display = 'block';
    $('leftPhoto').style.display = 'block';
    $('leftContent').style.display = 'none';
    $('rightContent').style.display = 'none';
    $('rightPhoto').style.display = 'block';
}

function $(obj) {
    return document.getElementById(obj);
}


