/*
** Site function script file
**
**  @uthor : DaRamirez
**  email : webmaster@ettyhillesumlyceum.nl
**  Date : 15 november 2004
**
*/


function LastUpdate(){// Returns last date that file has been edited
	var page = new Date(document.lastModified);
	var update = page.getDate()+"/"+(page.getMonth()+1)+"/"+page.getFullYear();
	document.write(update);
}

function GetLocation(){// Splits up a href string
	var page = location.pathname.substr(1,location.pathname.length-1).split("/");
	return page;
}

function trail(page,selected){ // creates a crum for back browsing
	var trail = '<div id="trail">';
	var snip = '';
	var name = '';
	for(i=0;i<page.length;i++){
		if(i>0 && i!=(page.length -1))snip += page[i]+"/";
		if(i!=0) trail += " / ";
		if(page[i].indexOf(".html") > -1 || page[i]== "" ){
			if(selected != "")trail += '<a href="'+selected.url+'" tile="informatie :'+selected.name+'">'+selected.name+'</a>';
		}else{
			switch (page[i]){// Change directory name to the correct school name
			case 'borgele':
			  name = 'Home';
			  break;
			case 'vlier':
			  name = 'home';
			  break;
			case 'stormink':
			  name = 'Home';
			  break;
			case 'boerhaavelaan':
			  name = 'Home';
			  break;
			case 'arkelstein':
			  name = 'Home';
			  break;
			case 'keurkamp':
			  name = 'Home';
			  break;
			case 'boerhaavelaan':
			  name = 'Home';
			  break;
			case 'centraal':
			  name = 'Etty Hillesum Lyceum';
			  break;
			default:
				name = page[i].substr(0,1).toUpperCase()+page[i].substr(1,page[i].length-1);
			}
			trail += '<a href="'+snip+'" tile="informatie :'+name+'">'+name+'</a>';
		}
	}
	trail += '</div>';
	document.write(trail);
}

function selected(site,location){// returns selected page out of the defined object
	var selected = new Array();
	var sub = "";
	selected[0] = "site";  // menu object
	selected[1]	= "";      // page object

	for(i=1; i < location.length;i++){
		if(location[i].indexOf(".html") < 0 && location[i] != "" && location[i] != null){
		selected[0] += '.submenu["'+location[i]+'"]';
		sub += location[i]+"/";
		}else{
			selected[0] = eval(selected[0]);
			if(location[i] == "") location[i] = "index.html";
			for(key in selected[0].submenu){
				if(selected[0].submenu[key].url == sub+location[i]) selected[1] = selected[0].submenu[key];
			}

		}
	}
	return selected;
}
// function for including automatic
function including(snip){
	document.write(snip);
}



