function startTheShow()
{
    self.moveTo(0, 0);
//    self.resizeTo(1200, 1080);
    initThumbImageNames();
    preload();
    hide("thumbnailDiv", false);
    initRandomFiles();
    showRandomPic();
    
}

function doAStatement()
{
    
    var str = "blobbo";
    if(!currentGalleryName)
    {
        return;
    }
    var popWidth = 1000;
    var popHeight = 800;
    
    switch(currentGalleryName)
    {
 
        case AMERICAN_PORTRAITS: 
        case CORPORATE: 
        case VENICE: 
        case WESTERN_CANADA:         
        return;
        break
        case ASCENSION: 
        str = "ascension";
        popWidth = 880;
        popHeight = 670;
        break
        case BIG_TOP_AMERICA: 
        str = "bigTop";
        break
        case BRITISH_LANDSCAPES: 
        popWidth = 870;
        popHeight = 650;
        str = "british";
        break
        case BRITISH_PORTRAITS:
        popWidth = 870;
        popHeight = 650;
        str = "british";
        break
        case CUBA: 
        str = "cuba"; 
        break
        case ISRAEL: 
        popWidth = 800;
        popHeight = 350;
        str = "israel"; 
        break
        case NEW_YORK:
        popWidth = 860;
        str = "newYork";
        break
        case NIGHT_ON_EARTH: 
        popWidth = 750;
        popHeight = 590;
        str = "nightOnEarth";
        break
  
        default: 
        break
    } 
   var url = "statements/statement-" + str + ".html";
    
   popUrl(url, popWidth, popHeight);
   
   
//    doStatement(str);
}

function popUrl(str, x, y)
{
    var features = "scrollbars=yes,width=";
    features += x;
    features += ",height=";
    features += y;
    features += ",menubar=no,toolbar=no,status=no,resizable=no";
    //alert(features);
    window.open(str,"duh", features);
	
}


function doStatement(stmnt)
{
    var s = stmnt + "StatementDiv";
//    alert("doStatement looking for " + s);
    var ob = document.getElementById("theBody");
    ob.style.backgroundColor = "#fff";
    ob = document.getElementById(s);
//    alert("doStatement found this ob " + ob);
    hide(s, true);
}

function closeStatement(stmnt)
{
    var s = stmnt + "StatementDiv";
    var ob = document.getElementById("theBody");
    ob.style.backgroundColor = "#444";
    ob = document.getElementById(s);
    hide(s, false);
}

function doPurchase()
{
//   var ob = document.getElementById("theBody");
//   ob.style.backgroundColor = "#fff";
   hide("contactDiv", true);

}

function closePurchase()
{
//  var ob = document.getElementById("theBody");
//   ob.style.backgroundColor = "#444";
   hide("contactDiv", false);

}

function doNews()
{
   var ob = document.getElementById("theBody");
   ob.style.backgroundColor = "#fff";
   hide("newsDiv", true);

}

function closeNews()
{
   var ob = document.getElementById("theBody");
   ob.style.backgroundColor = "#444";
   hide("newsDiv", false);

}

function closeBio()
{
   var ob = document.getElementById("theBody");
   ob.style.backgroundColor = "#444";
   hide("bioDiv", false);
}

function openBio()
{
   var ob = document.getElementById("theBody");
   ob.style.backgroundColor = "#fff";
   hide("bioDiv", true);
}


function areAllShowsPicturesLoaded()
{

// Logic: We will be on the first show page, for now every first thumbset is filled

 
 var ret = true;
 for (var i = 0; i < thumbImageNames.length; i++) 
 {
//   alert("clearAllThumbs() handling " + thumbImageNames[i]);
//    alert(document.images[thumbImageNames[i]].src);
    var chk = document.images[thumbImageNames[i]].src;
    if(chk.indexOf("clear") != -1)
    {       
        ret = false;
        break;
    }        
  } 
//  alert("areAllShowsPicturesLoaded returning " + ret);
  return ret;
}


function startLoadingAnim()
{
    hide("loadingDiv", true);
    loadingTextsPlaceInArray = 0;
    loadingTimeout = setTimeout("doLoadingAnim()", 500);
    fireStopLoadingAnim();
}

function doLoadingAnim()
{
    loadingTimeout = setTimeout("doLoadingAnim()", 500);
    var ob = document.getElementById("loadingDiv");
    ob.innerHTML = loadingTexts[loadingTextsPlaceInArray];
    loadingTextsPlaceInArray += 1;
    if(loadingTextsPlaceInArray == 6)
    {
        loadingTextsPlaceInArray = 0;
    }
}

function stopLoadingAnim()
{
    clearTimeout(loadingTimeout);
    clearTimeout(stopLoadingTimeout);
    hide("loadingDiv", false);
}

function fireStopLoadingAnim()
{
  if(areAllShowsPicturesLoaded())
  {
      stopLoadingTimeout = setTimeout("stopLoadingAnim()", 10);
      clearTimeout(fireStopLoadingTimeout);
  }
  else
  {
    fireStopLoadingTimeout = setTimeout("fireStopLoadingAnim()", 1000);
  }
  
}



function preload()
{
    var im = new Image();
    var i;
    for(i = 0; i < firstPictures.length; i++)
    {
        im.src = firstPictures[i];
    }
    
}


function test()
{
   // alert("test()");
 //  loadXMLDoc("http://www.fluencyllc.com/pictures.xml");
    mainWindow = window;
   initThumbImageNames();
   parseXmlFromString();
   pictureArray[0].show();
   setTitle(pictureArray[0].category);
   doTheArrows();
//   initTheMenu();
   //doBouquets();  
//   initRandomFiles();
   frontPageMode();
   decideSmallOrLarge();
   
   // only called when I need to check ellens xml
  // fixPictures();

  // goIntoThumbnailMode(true);
}

function decideSmallOrLarge()
{
    if(screen.availHeight > 768)
    {
    
        padForLargeScreen();
    }
}

function padForLargeScreen()
{
    var ob;
    var names = new Array(
    "overallDiv",
    "ellensFancyArt",
    "mainmenu",
    "siteTitle",
    "caption",
    "controlsDiv",
    "thumbnailDiv",
    "stageDiv2");
    for(var i = 0; i < names.length; i++)
    {
        ob = document.getElementById(names[i]);
        if(ob)
        {
            ob.style.padding = "8px";
        }
        
    }
    
    window.resizeTo(1024, 900);

}



function showStatement()
{
 hide("statement", true);
}

function hideStatement()
{
 // alert("hideStatement");
 hide("statement", false);
}

function showContact()
{
 hide("contactDiv", true);
}

function hideContact()
{
 // alert("hideStatement");
 hide("contactDiv", false);
}



function initRandomFiles()
{
     randomFilePictureObjects[0] = new picture(600, 395,  "", randomFileNames[0], "", -1); // americanPortraits/01.jpg
     randomFilePictureObjects[1] = new picture(600, 400,  "", randomFileNames[1], "", -1); // americanPortraits/d-day-memorial.jpg
     randomFilePictureObjects[2] = new picture(600, 399,  "", randomFileNames[2], "", -1); // ascension/39.jpg
     randomFilePictureObjects[3] = new picture(599, 398,  "", randomFileNames[3], "", -1); //  nightOnEarth/004.jpg
     randomFilePictureObjects[4] = new picture(600, 392,  "", randomFileNames[4], "", -1); //  britishLandscapes/03.jpg
     randomFilePictureObjects[5] = new picture(407, 600,  "", randomFileNames[5], "", -1); //  cuba/01.jpg
     randomFilePictureObjects[6] = new picture(495, 396,  "", randomFileNames[6], "", -1); //  israel/04.jpg
     randomFilePictureObjects[7] = new picture(600, 347,  "", randomFileNames[7], "", -1); //  newYork/01.jpg
}

function showRandomPic()
{
    var pick = Math.round(Math.random() * 8);
    //alert(pick);
    var pic = randomFilePictureObjects[pick];  

    if(pic == null)
    {
        showRandomPic();  // recurse!    
    }
    
    
    var stage = document.getElementById(STAGE_IMAGE);
    try {

	    stage.width = pic.width;
	    stage.height = pic.height;
	    stage.src = pic.filename; 
	
	} catch (e) {}
	
	    try {
//        alert(pic.report());
    } catch (e) {}
    
}



function getHeightOfStageDivClear(b)
{
    if(b == undefined)
    {
        b = false;    
    }
    var x = 4;  // vertical
    if(b)
    {
        x = 43;    
    }
   // alert("getHeightOfStageDivClear returning "+ x);
    return x;
}

function getHeightOfStageDivClearForThumbView(b)
{
    if(b == undefined)
    {
        b = false;    
    }
    var x = 0;  // vertical
    if(b)
    {
        x = 50;    
    }
   // alert("getHeightOfStageDivClear returning "+ x);
    return x;
}


function isClearThumb(indx)
{
    
    try {
    
        var imgname = getThumbnailImageName(indx);
        var img = document.images[imgname];
        if(img.src.indexOf("clear") != -1)
        {
            return true;
    
        }
    
   } catch (e) {}
    return false;
}

function areAnyThumbsClear()
{

     for (var i = 0; i <= 8; i++) 
     {
        if(isClearThumb(i))
        {
//             alert("areAnyThumbsClear() returns true");
            return true;

        }
     }
//       alert("areAnyThumbsClear() returns false");
     return false;
}

function areThereLowerPicturePlacesInArrayThanTumbnailZeroePlaceInArray()
{

//  alert("areThereLowerPicture... getFirstThumbsPlaceInShow() " + getFirstThumbsPlaceInShow() + ". Is That GreaterThan 0?");
  return (getFirstThumbsPlaceInShow() > 0);

}



function showRightArrow()
{
    //return isThereAnotherThumbset(getFirstThumbsPlaceInShow(), true);
    if(areAnyThumbsClear())
    {
        return false;
    }
    if(pictureArray.length == 9 || (FIRST_THUMB_PLACE_IN_ARRAY == 9 && pictureArray.length == 18))
    {
        return false;
    }
    
    return true;
}

// arg increment or decrement true is increemnt
function isThereAnotherThumbset(placeInArrayOfFirstThumbPic, increment)
{
    var ret = true;
    if(increment)  // increment
    {
     
        var nextThumbSetZero = placeInArrayOfFirstThumbPic + SECOND_THUMB_SET_FIRST_POSITION;
        if(nextThumbSetZero <= SLIDESHOW_SIZE)
        {
            return ret;
        }
    } else  // decrement
    {

         if(placeInArrayOfFirstThumbPic == FIRST_THUMB_SET_FIRST_POSITION)
         {
            return false;
         } 
    }
    
    return ret;
}

function showLeftArrow()
{

   // return isThereAnotherThumbset(getFirstThumbsPlaceInShow(), false);
   return areThereLowerPicturePlacesInArrayThanTumbnailZeroePlaceInArray();
}



function getFirstThumbsPlaceInShow()
{
    var indx = 0;
    try {
            var im = document.images["thumbnail1"];
            var pic = getPictureWhosePathIs(im.src);
            indx = pic.placeInArray;
        } catch (e) {}
    return indx;    
}


function initThumbImageNames()
{
     for (var i = 0; i <= 8; i++) {
        thumbImageNames[i] = getThumbnailImageName(i);
     }
}

function getThumbnailImageName(x)
{
    return "thumbnail" + (x + 1);
}

function setPictureFromThumbnail(x)
{
    try {
  
        var im = document.getElementById(getThumbnailImageName(x));
      //  alert("im " + im + "\nim.src\n" + im.src);
        var pic = getPictureWhosePathIs(im.src);
        if(pic)
        {
          //  alert("pic " + pic.report()); 
        } else
        {
           // alert("pic " + pic);        
        }

        pic.show();
    
  } catch (e) {
 // alert("setPictureFromThumbnail catch");
  
  }
}

// TODO this wont work -- MAIN_IMAGE_FOLDER no longer applies

function getPictureWhosePathIs(str)
{
//   alert("getPictureWhosePathIs: " + str);
   if(str != null && str != undefined) 
   {
   
       for (var i = 0; i < pictureArray.length; i++) 
       {        
//            str = str.substring(str.indexOf(MAIN_IMAGE_FOLDER));
            
                //alert(slideshowArray[i].constructPath());
            if(str.indexOf(pictureArray[i].filename) != -1)
            {   
                return pictureArray[i];
            }
        }      
    }
   return null;
}


function hide(str, isVisible)
{
   
    var elem = document.getElementById(str);
    //alert("hide " + str + "  isVisible " + isVisible + " elem " + elem);
    try {
    
        if(!isVisible)
        {
            elem.style.display = NONE;
        }
        else
        {
            elem.style.display = BLOCK;
        }
        
    } catch (e) {}
}

function hideInline(str, isVisible)
{
    //alert("hideInline " + str + "  will be Visible " + isVisible);
    var elem = document.getElementById(str);
    try {
    
        if(!isVisible)
        {
            elem.style.display = NONE;
        }
        else
        {
            elem.style.display = INLINE;
        }
        
    } catch (e) {}
}

function thumbnailSize(x)
{
    return Math.round(x * THUMBNAIL_REDUCTION);
}



function fillThumbnailsFromCurrentShow()
{
//   alert("fillThumbnailsFromCurrentShow");
   clearAllThumbs();
   for (var i = 0; i < pictureArray.length; i++) {
        setAThumbnailImage(i, pictureArray[i]);
   }  
}


function incrementThumbs()
{
    
    setNextThumbStartPlace(true);
//    alert("incrementThumbs FIRST_THUMB_PLACE_IN_ARRAY " + FIRST_THUMB_PLACE_IN_ARRAY);
    fillThumbnailsFromCurrentShow2();
    doTheArrows();
}

function doTheArrows()
{
    hideInline("leftArrow", showLeftArrow());
    if(showLeftArrow())
    {
       document.images["leftArrow"].src = "images/leftArrow.gif";
    } else 
    {
    
       document.images["leftArrow"].src = "images/blankArrow.gif";
    }
    hideInline("rightArrow", showRightArrow());
}

function fillThumbnailsFromCurrentShow2()
{
   clearAllThumbs();
   var indx = FIRST_THUMB_PLACE_IN_ARRAY;
   for (var i = 0; i <= 8; i++) 
   {
      try
      {
      
        var img = document.images[thumbImageNames[i]];
        var pic = pictureArray[indx];
        img.src = pic.filename + JPEG;
        img.width = thumbnailSize(pic.width);
        img.height = thumbnailSize(pic.height);
        indx += 1;
        
      } catch (e) {}

   }
}

function decrementThumbs()
{
    setNextThumbStartPlace(false);
    fillThumbnailsFromCurrentShow2();
    doTheArrows();
}

// boolean increment or decrement
function setNextThumbStartPlace(b)
{
    if(b)  // increment
    {
        FIRST_THUMB_PLACE_IN_ARRAY += NUMBER_OF_THUMBS;    
    }
    else
    {   //  decreemnt
        FIRST_THUMB_PLACE_IN_ARRAY -= NUMBER_OF_THUMBS;  
        if(FIRST_THUMB_PLACE_IN_ARRAY < 0)
        {
            FIRST_THUMB_PLACE_IN_ARRAY = 0;
        }
    }
}


function setAThumbnailImage2(x, pic)
{
   // document.images.[2] - document.images.[10] 
   //var thumbnail = "thumbnail";
  //  var thumbIndex = x; // + THUMB_START_INDEX;
  // // var img;
  alert("setAThumbnailImage x " + x + " pic.constructPath() " + pic.constructPath());
  var y = 0;
   // alert("setAThumbnailImage\nx " + x + " pic " + pic.report());
   //var pic = slideshowArray[x];
    try {
    
    
    for (var i = 0; i < document.images.length; i++) {
    var img = document.images[i];
        if(img.id == thumbImageNames[y])
        {
        alert("found a thumbnail to set img.id " + img.id);
            img.width = thumbnailSize(pic.width);
            img.height = thumbnailSize(pic.height);
            img.src = pic.constructPath();
        }
        else
        {
            y++;
        }
    }

        
    } catch (e) {}
}

function setAThumbnailImage(x, pic)
{
   // document.images.[2] - document.images.[10] 
   //var thumbnail = "thumbnail";
  //  var thumbIndex = x; // + THUMB_START_INDEX;
  // // var img;
  // alert("setAThumbnailImage x " + x + " slideshowArray[x].constructPath() " + slideshowArray[x].constructPath());
   // alert("setAThumbnailImage\nx " + x + " pic " + pic.report());
   var pic = pictureArray[x];
    try {
    
    
    for (var i = 0; i < document.images.length; i++) {
    var img = document.images[i];
        if(img.id == thumbImageNames[x])
        {
        //  alert("found a thumbnail to set img.id " + img.id);
            img.width = thumbnailSize(pic.width);
            img.height = thumbnailSize(pic.height);
            img.src = pic.filename + ".jpg";
        }
    }
        
    } catch (e) {}
}


function clearAllThumbs()
{
 for (var i = 0; i < thumbImageNames.length; i++) {
//   alert("clearAllThumbs() handling " + thumbImageNames[i]);
        document.images[thumbImageNames[i]].src = "images/clear.gif";
   }  
}





function parsePictureXmlArray()
{
   pictureXmlArray = picturesXml.responseXML.getElementsByTagName("picture");
   SLIDESHOW_SIZE = pictureXmlArray.length -1;
  // alert("SLIDESHOW_SIZE " + SLIDESHOW_SIZE);
   for (var i = 0; i < pictureXmlArray.length; i++) {
        var pic = createPictureFromXml(pictureXmlArray[i], i);
        pictureArray[i] = pic;
   } 
//   slideshowArray = pictureArray;
}

function determineWhichShowToLoad(str)
{
    var show;
    switch(str)
    {
        case AMERICAN_PORTRAITS: 
        show = americanPortraitsPics;
        break
        case ASCENSION: 
        show = ascensionPics;
        break
        case BIG_TOP_AMERICA: 
        show = bigTopAmericaPics;
        break
        case BRITISH_LANDSCAPES: 
        show = britishLandscapesPics;
        break
        case BRITISH_PORTRAITS: 
        show = britishPortraitsPics;
        break
        case CORPORATE: 
        show = corporatePics;
        break
        case CUBA: 
        show = cubaPics;
        break
        case ISRAEL: 
        show = israelPics;
        break
        case NEW_YORK: 
        show = newYorkPics;
        break
        case NIGHT_ON_EARTH: 
        show = nightOnEarthPics;
        break
        case STREETWISE: 
        show = streetwiseAmericaPics;
        break
        case VENICE: 
        show = venicePics;
        break
        case WESTERN_CANADA: 
        show = westernCanadaPics;
        break        
        default: 
        break
    }   
    
    return show;
}


function parseXmlFromString(str) {

//   alert("parseXmlFromString");
    var holder = determineWhichShowToLoad(str);

   if (window.DOMParser) {
      try { 
         pictureDom = (new DOMParser()).parseFromString(holder, "text/xml"); 
      } 
      catch (e) { 
        pictureDom = null; 
        alert("error here! " + e);
      }
   }
   else if (window.ActiveXObject) {
      try {
          pictureDom = new ActiveXObject('Microsoft.XMLDOM');
          pictureDom.async = false;
         if (!pictureDom.loadXML(holder)) // parse error ..
            window.alert(pictureDom.parseError.reason + pictureDom.parseError.srcText);
      } 
      catch (e) { pictureDom = null; }
   }
   
  // alert(pictureDom);
   
   parsePictureXmlArrayDom();
}

function nullOutPictureArray()
{
    pictureArray.length = 0;
}

function parsePictureXmlArrayDom()
{
  
  nullOutPictureArray();
  pictureXmlArray = pictureDom.getElementsByTagName("picture");

   SLIDESHOW_SIZE = pictureXmlArray.length -1;
  // alert(" SLIDESHOW_SIZE "  + SLIDESHOW_SIZE);
  // alert("SLIDESHOW_SIZE " + SLIDESHOW_SIZE);
   for (var i = 0; i < pictureXmlArray.length; i++) {
        var pic = createPictureFromXml(pictureXmlArray[i], i);
        pictureArray[i] = pic;
//        pic.report();
   } 
//   slideshowArray = pictureArray;
}


// retrieve text of an XML document element, including
// elements using namespaces
function getElementTextNS(prefix, local, parentElem, index) {
    var result = "";
    if (prefix && isIE) {
        // IE/Windows way of handling namespaces
        result = parentElem.getElementsByTagName(prefix + ":" + local)[index];
    } else {
        // the namespace versions of this method 
        // (getElementsByTagNameNS()) operate
        // differently in Safari and Mozilla, but both
        // return value with just local name, provided 
        // there aren't conflicts with non-namespace element
        // names
        result = parentElem.getElementsByTagName(local)[index];
    }
    if (result) {
        // get text, accounting for possible
        // whitespace (carriage return) text nodes 
        if (result.childNodes.length > 1) {
            return result.childNodes[1].nodeValue;
        } else {
            return result.firstChild.nodeValue;    		
        }
    } else {
        return "n/a";
    }
}





function showFirstPicture()
{
   // alert("showFirstPicture slideshowArray.length " + slideshowArray.length);
    var pic = pictureArray[0];
  //  alert("showFirstPicture pic " + pic);
    //pic.report();
    if(pic != null)
    {
       pic.show();
    }
    else
    {
        alert("showFirstPicture pic is null");
    }

}





function blankOutStage()
{
    
    var stage = document.getElementById("stage2");
    stage.src = "images/clear.gif";

}

function preInitShow()
{
    FIRST_THUMB_PLACE_IN_ARRAY = 0;
    doTheArrows();
//    hide("mainmenu", true);
}

function typicalShowStuff()
{
    fillThumbnailsFromCurrentShow();
    showFirstPicture();
    preInitShow();

}

function doAmericanPortraits()
{
//   startLoadingAnim();
   isAscension = false;
   blankOutStage();
   hide("siteSubTitle", false);
   hide("thumbnailDiv", true);
   parseXmlFromString(AMERICAN_PORTRAITS);
   setTitle(AMERICAN_PORTRAITS);
   currentGalleryName = AMERICAN_PORTRAITS;
   typicalShowStuff();

}

function doAscension()
{

   isAscension = true;
   blankOutStage();
   hide("siteSubTitle", true);
   hide("thumbnailDiv", true);
   parseXmlFromString(ASCENSION);
   setTitle(ASCENSION);
   setSubTitle(ASCENSION_SUB_TITLE);
   currentGalleryName = ASCENSION;
   typicalShowStuff();

}

function doBigTopAmerica()
{

   isAscension = false;   
   blankOutStage();
   hide("siteSubTitle", false);
   hide("thumbnailDiv", true);
   parseXmlFromString(BIG_TOP_AMERICA);
   setTitle(BIG_TOP_AMERICA);
   currentGalleryName = BIG_TOP_AMERICA;
   typicalShowStuff();

}


function doBritishLandscapes()
{
   isAscension = false;   
   blankOutStage();
   hide("siteSubTitle", false);
   hide("thumbnailDiv", true);
   parseXmlFromString(BRITISH_LANDSCAPES);
   setTitle(BRITISH_LANDSCAPES);
   currentGalleryName = BRITISH_LANDSCAPES;
   typicalShowStuff();

}

function doBritishPortraits()
{
   isAscension = false;
   blankOutStage();
   hide("siteSubTitle", false);
   hide("thumbnailDiv", true);
   parseXmlFromString(BRITISH_PORTRAITS);
   setTitle(BRITISH_PORTRAITS);
   currentGalleryName = BRITISH_PORTRAITS;
   typicalShowStuff();

}

function doCorporate()
{
   isAscension = false;
   blankOutStage();
   hide("siteSubTitle", false);
   hide("thumbnailDiv", true);
   parseXmlFromString(CORPORATE);
   setTitle(CORPORATE);
   currentGalleryName = CORPORATE;
   typicalShowStuff();

}

function doCuba()
{
   isAscension = false;
   blankOutStage();
   hide("siteSubTitle", false);
   hide("thumbnailDiv", true);
   parseXmlFromString(CUBA);
   setTitle(CUBA);
   currentGalleryName = CUBA;
   fillThumbnailsFromCurrentShow();
   showFirstPicture();
   preInitShow();

}

function doIsrael()
{
   isAscension = false;
   blankOutStage();
   hide("siteSubTitle", false);
   hide("thumbnailDiv", true);
   parseXmlFromString(ISRAEL);
   setTitle(ISRAEL);
   currentGalleryName = ISRAEL;
   typicalShowStuff();

}

function doNewYork()
{
   isAscension = false;
   blankOutStage();
   hide("siteSubTitle", false);
   hide("thumbnailDiv", true);
   parseXmlFromString(NEW_YORK);
   setTitle(NEW_YORK);
   currentGalleryName = NEW_YORK;
   typicalShowStuff();

}

function doNightOnEarth()
{
   isAscension = false;
   blankOutStage();
   hide("siteSubTitle", false);
   hide("thumbnailDiv", true);
   parseXmlFromString(NIGHT_ON_EARTH);
   setTitle(NIGHT_ON_EARTH);
   currentGalleryName = NIGHT_ON_EARTH;
   typicalShowStuff();

}

function doStreetwiseAmerica()
{
   isAscension = false;
   blankOutStage();
   hide("siteSubTitle", false);
   hide("thumbnailDiv", true);
   parseXmlFromString(STREETWISE);
   setTitle(STREETWISE);
   currentGalleryName = STREETWISE;
   typicalShowStuff();

}

function doVenice()
{
   isAscension = false;
   blankOutStage();
   hide("siteSubTitle", false);
   hide("thumbnailDiv", true);
   parseXmlFromString(VENICE);
   setTitle(VENICE);
   currentGalleryName = VENICE;
   typicalShowStuff();
}

function doWesternCanada()
{
   isAscension = false;
   blankOutStage();
   hide("siteSubTitle", false);
   hide("thumbnailDiv", true);
   parseXmlFromString(WESTERN_CANADA);
   setTitle(WESTERN_CANADA);
   currentGalleryName = WESTERN_CANADA;
   typicalShowStuff();
}

function doAmericanPortraitsAdmin()
{

   parseXmlFromString(AMERICAN_PORTRAITS);
 

}

function doAscensionAdmin()
{

   parseXmlFromString(ASCENSION);


}

function doBigTopAmericaAdmin()
{


   parseXmlFromString(BIG_TOP_AMERICA);


}


function doBritishLandscapesAdmin()
{

   parseXmlFromString(BRITISH_LANDSCAPES);

}

function doBritishPortraitsAdmin()
{

   parseXmlFromString(BRITISH_PORTRAITS);


}

function doCorporateAdmin()
{

   parseXmlFromString(CORPORATE);

}

function doCubaAdmin()
{

   parseXmlFromString(CUBA);

}

function doIsraelAdmin()
{

   parseXmlFromString(ISRAEL);

}

function doNewYorkAdmin()
{

   parseXmlFromString(NEW_YORK);


}

function doNightOnEarthAdmin()
{

   parseXmlFromString(NIGHT_ON_EARTH);


}

function doStreetwiseAmericaAdmin()
{

   parseXmlFromString(STREETWISE);


}

function doVeniceAdmin()
{

   parseXmlFromString(VENICE);

}

function doWesternCanadaAdmin()
{

   parseXmlFromString(WESTERN_CANADA);

}





function createPictureFromXml(xmlOb, placeInArray)
{
    var pic = null;
    //alert("createPictureFromXml xmlOb " + xmlOb);
//    var framewidth = xmlOb.getAttribute("framewidth");
//    var frameheight = xmlOb.getAttribute("frameheight");
    var width = xmlOb.getAttribute("width");
    var height = xmlOb.getAttribute("height");
    var title = getElementTextNS("", "title", xmlOb, 0);
    var filename = getElementTextNS("", "filename", xmlOb, 0);
    var category = getElementTextNS("", "category", xmlOb, 0);
                
    pic = new picture( width, height, title, filename, category, placeInArray);
   // alert("createPictureFromXml " + pic.report());
    
    return pic;
}


function setSubTitle(str)
{
    var title = document.getElementById("siteSubTitle");
    title.innerHTML = str;
}


function setTitle(str)
{
    var title = document.getElementById("siteTitle");
    title.innerHTML = str;
}

