function getPageN() {
	var galleryXml = getPageName();
	var navState = hasNav(galleryXml);
	
	loadFlash(galleryXml, navState);
	changeArrow(galleryXml);
       }


function navi(t) {
document.title = "Lucy Leonardi Photography - " + t;
}

 function loadFlash(galleryXml, navState){
 				var fo = new FlashObject("lucygallery_port.swf", "lucygallery", "500", "422", "7", "#ffffff");
		fo.addVariable("xmlfile", galleryXml + ".xml");
		fo.addVariable("navState", navState);
		fo.write("flashcontent");
        }


//get the page name
function getPageName() {
    var pagePath;
    if (window.location.href.split("#")[1]) {
        pagePath = window.location.href.split("#")[1];
    }
    else { pagePath = "front"; }

    return pagePath;
    }


var lastURL = window.location.href; //last location

//periodically check if the location has changed to change the page if so
function chkURL() {
    if (window.location.href != lastURL) {
        lastURL = window.location.href;
        getPageN();
    }
    window.setTimeout("chkURL()", 100);
}

window.setTimeout("chkURL()", 100);


function changeArrow(chosen1) {
var theOne = chosen1;
switch(theOne){
case "flora":
selectedGal('flora', 'food', 'stilllife', 'lifestyle');
navi('Flora');
break;
case "food":
selectedGal('food', 'flora', 'stilllife', 'lifestyle');
navi('Food');
break;
case "stilllife":
selectedGal('stilllife', 'flora', 'food', 'lifestyle');
navi('Still Life');
break;
case "lifestyle":
selectedGal('lifestyle', 'flora', 'food', 'stilllife');
navi('Lifestyle');
break;
default:
navi('Home');
flora.src='images/spacer.gif';
food.src='images/spacer.gif';
lifestyle.src='images/spacer.gif';
stilllife.src='images/spacer.gif';
}
}

function hasNav(chosen2){
switch(chosen2){
case "flora":
return "true";
break;
case "food":
return "true";
break;
case "stilllife":
return "true";
break;
case "lifestyle":
return "true";
break;
default:
return "false";
}
}



function selectedGal(selGal, other1, other2, other3) {
var oneTochange = selGal;
document.getElementById(oneTochange).src='images/arrow.gif';
document.getElementById(other1).src='images/spacer.gif';
document.getElementById(other2).src='images/spacer.gif';
document.getElementById(other3).src='images/spacer.gif';
}