// JavaScript Document
function inicializarmenu(){		
	/* funcion marcar menu*/
	switch (nivel){//comprobamos si la opcion pulsada es de un nivel la cual tendria un index.php o es segundo nivel con un nombre.
		case 1 :
			document.getElementById(padre).className="menuseleccionado";//marcamos el texto	en azul	
			if(document.getElementById(padre+"ul")!=null){document.getElementById(padre+"ul").style.display="block";}
		break;
		case 2 :
			document.getElementById(padre+"ul").style.display="block";
			document.getElementById(hijo).className="menu1seleccionado";//marcamos el texto	en azul	
			if(document.getElementById(hijo+"ul")!=null)document.getElementById(hijo+"ul").style.display="block";
		break;
		case 3 :
			document.getElementById(padre+"ul").style.display="block";
			document.getElementById(hijo+"ul").style.display="block";
			document.getElementById(nieto).className="menu2seleccionado";//marcamos el texto	en azul	
		break;
		
	}
	//inicializamos el mapa del mundo
	document.getElementById("europa").onmouseover=function(){document.getElementById("mapamundo").src="/img/mapaeuropa.gif"};
	document.getElementById("europa").onmouseout=function(){document.getElementById("mapamundo").src="/img/mapa.gif"};
	document.getElementById("asia").onmouseover=function(){document.getElementById("mapamundo").src="/img/mapaasia.gif"};
	document.getElementById("asia").onmouseout=function(){document.getElementById("mapamundo").src="/img/mapa.gif"};
	document.getElementById("africa").onmouseover=function(){document.getElementById("mapamundo").src="/img/mapaafrica.gif"};
	document.getElementById("africa").onmouseout=function(){document.getElementById("mapamundo").src="/img/mapa.gif"};
	document.getElementById("americanorte").onmouseover=function(){document.getElementById("mapamundo").src="/img/mapaamericanorte.gif"};
	document.getElementById("americanorte").onmouseout=function(){document.getElementById("mapamundo").src="/img/mapa.gif"};
	document.getElementById("americasur").onmouseover=function(){document.getElementById("mapamundo").src="/img/mapaamericasur.gif"};
	document.getElementById("americasur").onmouseout=function(){document.getElementById("mapamundo").src="/img/mapa.gif"};
	document.getElementById("oceania").onmouseover=function(){document.getElementById("mapamundo").src="/img/mapaoceania.gif"};
	document.getElementById("oceania").onmouseout=function(){document.getElementById("mapamundo").src="/img/mapa.gif"};
}	

function addEvent(obj, evType, fn) {
	if (obj.addEventListener) {
		obj.addEventListener(evType, fn, false);
		return true;
	} else if (obj.attachEvent) {
		var r = obj.attachEvent('on' + evType, fn);
		return r;
	} else {
		return false;
	}
}

//lanzamos la funcion para inicializar el menu
addEvent(window, 'load', inicializarmenu);

//Add to favourites
function CreateBookmarkLink() {

 title = "Boarding School Directory"; 
 url = "http://www.boarding-school-directory.com/";
 
	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title); }
	else if(window.opera && window.print) { // Opera Hotlist
		return true; }
 }

// Link to us copy function
function fCopyToClipboard(rSource){
	rSource.select();
	if(window.clipboardData) {
		var r=clipboardData.setData('Text',rSource.value);
		return 1;
	}else {
		alert("This feature works in Internet Explorer only. Please copy de code manually.");
		return 0;
	}
}

//imgae gallery schools
function setImage(path)
{
	var img = document.getElementById('mainpic');
	img.setAttribute('src', path);
}