
// load framapage if this page is not loaded in frameset
// load framapage if this page is not loaded in frameset
if (top.frames.length==0)
{
var doc_name = location.pathname
document.write('<div class="footer"><span id="noframes">This page is part of a frameset. You will be redirected in 1 second so you can use the menu navigation, or click <A href = "http://www.lisette-fotografie.nl">here</A> to go now.</span></div>');
setTimeout('go_there("http://www.lisette-fotografie.nl")',1000);
}

function go_there(frame_location)
{
 top.location=frame_location;
}



//store name of page in string, this name is used to find associated menu-item. id of menu-item should have this name
// in case name is name of document e.g. home.htm
//var pageName = window.location.href.substring(window.location.href.lastIndexOf("/") + 1);

// in case name is name of folder+folder+documentname
var withoutDocName = window.location.href.substring(0,window.location.href.lastIndexOf("/"));   
var withoutDocnameAndFolder = window.location.href.substring(0,withoutDocName.lastIndexOf("/"));

var pageName = window.location.href.substring(withoutDocnameAndFolder.lastIndexOf("/")+1); // e.g. contents1/submaphome/home.htm
var folderName = pageName.substring(0, pageName.indexOf("/")); // e.g. contents1

//when page loads, find element in parent with name of document (menu-item) and assign class of selected menu-item
function theOnLoadFunction() 
{  
  // alert(pageName); // for debugging, show pagename
  changeParentElemClass(pageName,"MenuSelected");
  changeParentElemClass(folderName,"expanded");
  //alert('load' + pageName + folderName);
  window.focus();
}

//when page unloads, find element in parent with name of document (menu-item) and assign class of normal menu-item
function theOnUnLoadFunction() 
{  
  changeParentElemClass(pageName,"Menu");
  changeParentElemClass(folderName,"collapsed");
  //alert('onload');
}


function changeParentElemClass(Elem, myClass) 
{
   if (parent)
   {
      var elem;
      if(parent.menu.document.getElementById) 
      {
	 elem = parent.menu.document.getElementById(Elem);
      } 
      else if (parent.menu.document.all)
      {
	 elem = parent.menu.document.all[Elem];
      }
	  
      if (elem)
      {
	     elem.className = myClass;
		 //alert(elem.className);
      }
   }            
}

function addLoadEvent(func) { 
	  var oldonload = window.onload; 
	  if (typeof window.onload != 'function') { 
	    window.onload = func; 
	  } else { 
	    window.onload = function() { 
	      if (oldonload) { 
	        oldonload(); 
	      } 
	      func(); 
	    } 
	  } 
	} 

addLoadEvent(theOnLoadFunction);

window.onunload=theOnUnLoadFunction;

