


//if(window.parent.location.href.indexOf("default.aspx")<0){
//	if(window.parent.window.parent){
//		if(window.parent.window.parent.location.href.indexOf("default.aspx")<0)){
//			location.href="login.aspx"}
//		}
//	}
//}


var menuPageX
var menuPageY
var detLan, lanDir, lanSearch, lanArch
var lanArr = Array("en","fr","nl")
var fMnuName, sMnuName, sMnuSmpTit 
var fMnuFilDir, sMnuFilName, fMnuFilName


//var unkno 
// Menu All menus button bg-color when onmouseover or selected
var fMnuCol = Array('#EFE9FA','#EFE9FA','#EFE9FA','#EFE9FA','#E7E7FD','#F9F6C6','#CEF5DA','#DCF0FB','#F3D2CC','#E6E6E6')

// Menu Main menu button right border color
var sMnuBor = Array('#56338E','#8C6636','#04571C','#0069B3','#E1988C','#666666')

// Title for the sitemap
// var sMnuSmpTit = Array()

var sMnuSmpTit_en = Array(['search database','search by filtering and sorting','search with marine charts','make a report','list of wrecks'], ['','histories','','','vocabulary'], ['tides','conversions WGS84 ED50 OSGB36','distances','the beaufort scale'], ['conditions','sealife','checklist','charters','legal matter'],['weather North Sea','buoys North Sea'], ['download wreck database','upload to wreck database','many thanks to','special requests','last updates'])

var sMnuSmpTit_fr = Array(['chercher données','filtrer et trier','chercher sur carte','faire un rapport','liste épaves'], ['','histoires','','','vocabulaire'], ['marées','conversions WGS84 ED50, OSGB36','distances','échelle beaufort'], ['conditions','faune et flore','checklist','opérateurs','matière légale'],['le temps en Mer du Nord','les bouées Mer du Nord'], ['télécharger la base de données','upload','merci beaucoup','demandes spéciales','dernières mises à jour'])

var sMnuSmpTit_nl = Array(['databank zoeken','zoeken door te filteren en sorteren','zoeken op zeekaart','een rapport maken','lijst van wrakken'], ['','verhalen','','','woordenschat'],['getijden','conversies WGS84 ED50 OSGB36','afstanden','de beaufort schaal'], ['voorwaarden','zee leven','checklist','charters','legale zaken'],['weerbericht Noordzee','boeien noordzee'], ['downloaden van de database','updaten van de database', 'dankwoord', 'speciale aanvragen','laatste wijzigingen'])


// var fMnuName = Array()
var fMnuName_en = Array('home','sitemap','contact us',' links ','search', 'archive', 'tools', 'wreckdiving', 'weather', 'users' )
var fMnuName_fr = Array('home','sitemap','contact',' liens ', 'chercher', 'archive', 'outils', 'plongée', 'météo', 'utilisateurs' )
var fMnuName_nl = Array('home','sitemap','contact',' links ', 'zoeken', 'archief', 'tools', 'wrakduiken', 'weer', 'gebruikers' )

//File when the main buttons are clicked
var fMnuFilName_en = Array('wrecksite.html','wreck-sitemap.html','contact.html','wreck-links.html','wreck-database.html','wreck-archive.html','north-sea-tools.html','wreckdiving.html','north-sea-weather.html','wreckdivers.html')
var fMnuFilName_fr = Array('site-epaves.html','epaves-sitemap.html','contact.html','liens-epaves.html','base-de-donnees-epaves.html','archive-epaves.html','outils-mer-du-nord.html','plongee-epaves.html','meteo-mer-du-nord.html','plongeurs-epaves.html')
var fMnuFilName_nl = Array('wrakkensite.html','wrakken-sitemap.html','contact.html','wrakken-links.html','wrakken-database.html','wrak-archief.html','noordzee-tools.html','wrakduiken.html','weerbericht-noordzee.html','wrakduikers.html')

//Directory where the files are located
var fMnuFilDir_en = Array('wrecksite', 'wrecksite', 'wrecksite', 'wrecksite', 'wreck-database', 'wreck-archive', 'north-sea', 'wreckdiving', 'north-sea-diving', 'wreckdivers')
var fMnuFilDir_fr = Array('site-epaves', 'site-epaves', 'site-epaves', 'site-epaves', 'base-de-donnees-epaves', 'archive-epaves', 'mer-du-nord', 'plongee-epaves', 'plongee-mer-du-nord', 'plongeurs-epaves')
var fMnuFilDir_nl = Array('wrakkensite', 'wrakkensite', 'wrakkensite', 'wrakkensite', 'wrakken-database', 'wrak-archief', 'noordzee', 'wrakduiken', 'noordzeeduiken', 'wrakduikers')

//The name of the submenu buttons
//var sMnuName = Array()
var sMnuName_en = Array(['database','filter & sort','by seachart','reporting','list'], ['documents','histories','pictures','','vocabulary'], ['tides','conversions','distances','beaufort'], ['conditions','sealife','checklist','charters','legal stuff'],['north sea','buoys north sea'], ['download','update','thanks','requests','updates'])
var sMnuName_fr = Array(['données','filtrer & trier','par carte','rapportage','liste épaves'], ['documents','histoires','images','','vocabulaire'], ['marées','conversions','distances','beaufort'], ['conditions','faune & flore','checklist','opérateurs','choses legales'],['mer du nord','bouées mer du nord'], ['télécharger','uploader','merci','demandes','mise à jours'])
var sMnuName_nl = Array(['databank','filter & sorteer','op zeekaart','rapporten','lijst'], ['documenten','verhalen','fotos','','woordenschat'], ['getijden','conversies','afstanden','beaufort'], ['voorwaarden','zee leven','checklist','charters','legale zaken'],['noordzee','boeien noordzee'], ['downloaden','uploaden','dankwoord','aanvragen','updates'])

//The locations of the submenu files
var sMnuFilName_en = Array(['wreck-database-name.html','wreck-database-filter-sort.html','wreck-database-marine-chart.html','wreck-database-report.html','wreck-list.html'], ['wreck-documents.html','wreck-histories.html','wreck-pictures.html','#','vocabulary-a-e.html'], ['north-sea-tides.html','wgs84-ed50-osgb36.html','distances.html','beaufort.html'], ['north-sea-diving.html','north-sea.html','wreckdiving-checklist.html','wreckdiving-charters.html','wreck-legal.html'], 
['north-sea-weather-be.html','north-sea-weather-uk.html'],['download.html','upload.html','wrecksite-users.html','requests.html','wreck-database-updates.html'])
var sMnuFilName_fr = Array(['base-de-donnees-epaves-nom.html','base-de-donnees-epaves-filtrer-trier.html','base-de-donnees-epaves-carte-nautique.html','rapport-epaves.html','liste-epaves.html'], ['documents-epaves.html','histoires-epaves.html','images-epaves.html','#','vocabulaire-a-e.html'], ['marees-mer-du-nord.html','wgs84-ed50-osgb36.html','distances.html','beaufort.html'], ['plongee-mer-du-nord.html','mer-du-nord.html','plongee-epaves-checklist.html','plongee-epaves-operateurs.html','epaves-justice.html'], 
['meteo-mer-du-nord-be.html','meteo-mer-du-nord-uk.html'],['download.html','upload.html','utilisateurs-site-epaves.html','requests.html','base-de-donnees-epaves.html'])
var sMnuFilName_nl = Array(['wrakken-database-naam.html','wrakken-database-filter-sorteer.html','wrakken-database-zeekaarten.html','wrakken-rapportering.html','wrakken-lijst.html'], ['wrakken-documenten.html','wrakken-histories.html','fotos-wrakke^n.html','#','vocabulary-a-e.html'], ['getij-noordzee.html','wgs84-ed50-osgb36.html','distances.html','beaufort.html'], ['noordzeeduiken.html','noordzee.html','wrakduiker-checklist.html','wrakduiken-charters.html','legale-wrakken.html'], 
['weerbericht-noordzee-be.html','weerbericht-noordzee-uk.html'],['download.html','upload.html','wrakkensite-gebruikers.html','requests.html','wrakken-database.html'])

//The location from the top of the menus
var sMnuTop = Array('220','251','283','315','347','379')
var sMnuHTML 

var fMnuDecoPicName = Array('home.jpg','sitemap.jpg','contact_us.jpg','links.jpg','search.jpg','archive.jpg','tools.jpg','wreckdiving.jpg','barometer.jpg','users.jpg')

var fMnuTitPicName = Array('home_title.gif','sitemap_title.gif','contact_us_title.gif','links_title.gif','search_title.gif','archive_title.gif', 'tools_title.gif','wreckdiving_title.gif','weather_title.gif','users_title.gif')

var mMnuStyle = "mMnu"
var fMnuStyle = "fMnu"
var sMnuStyle = "sMnu"
var mMnuStyleSel = "mMnuSel"
var fMnuStyleSel = "fMnuSel"
var sMnuStyleSel = "sMnuSel"
var leftSubMnu = 75
var lanDir

//detect language and get the correct menus
loc = location.href
if((loc.indexOf("/wreck/")!=-1)|(loc.indexOf(".html?en")!=-1)|(loc.indexOf("/epaves/")!=-1)|(loc.indexOf(".html?fr")!=-1)|(loc.indexOf("/wrakken/")!=-1)|(loc.indexOf(".html?nl")!=-1)) {
	if ((loc.indexOf("/wreck/")!=-1)|(loc.indexOf(".html?en")!=-1)) {
		detLan="en";lanDir="wreck";lanSearch="wreck-database";lanArch="wreck-archive";
		fMnuName = fMnuName_en; sMnuName=sMnuName_en; sMnuSmpTit=sMnuSmpTit_en; 
		fMnuFilDir=fMnuFilDir_en; sMnuFilName=sMnuFilName_en; fMnuFilName=fMnuFilName_en;
		}
	if ((loc.indexOf("/epaves/")!=-1)|(loc.indexOf(".html?fr")!=-1)) {
		detLan="fr";lanDir="epaves";lanSearch="base-de-donnees-epaves";lanArch="archive-epaves";
		fMnuName = fMnuName_fr; sMnuName=sMnuName_fr; sMnuSmpTit=sMnuSmpTit_fr; 
		fMnuFilDir=fMnuFilDir_fr;sMnuFilName=sMnuFilName_fr; fMnuFilName=fMnuFilName_fr;
		}
	if ((loc.indexOf("/wrakken/")!=-1)|(loc.indexOf(".html?nl")!=-1)) {
		detLan="nl";lanDir="wrakken";lanSearch="wrakken-database";lanArch="wrak-archief";
		fMnuName = fMnuName_nl; sMnuName=sMnuName_nl; sMnuSmpTit=sMnuSmpTit_nl; 
		fMnuFilDir=fMnuFilDir_nl; sMnuFilName=sMnuFilName_nl; fMnuFilName=fMnuFilName_nl;
		}
	}


else {
	detLan="en";lanDir="wreck";lanSearch="wreck-database";lanArch="wreck-archive";
	fMnuName = fMnuName_en; sMnuName=sMnuName_en; sMnuSmpTit=sMnuSmpTit_en;  	fMnuFilDir=fMnuFilDir_en; sMnuFilName=sMnuFilName_en; fMnuFilName=fMnuFilName_en;
	}

function doThis() {
var sw = window.screen.availWidth
var b = document.getElementsByTagName("body")[0]
var marLeft = (parseInt(sw)-800)/2
b.style.marginLeft = marLeft 
var bHTML = b.innerHTML
bHTML = "<div style='z-index:9; position:relative;top:0px;left:0px;background-color:#FFFFFF;border-left:1px solid #DDDDDD;'>" + bHTML + "</div>"
b.innerHTML = bHTML
b.style.visibility = "visible"
}
//For James
//var jamesLoad;
//For James
//var hexArray = Array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'); 

//For James
//function transHexToDec(v){
//	for(j=0;j<hexArray.length;j++){
//		if(v==hexArray[j]){v=j;}
//	}
//	return v;
//}

//For James
//function transDecToHex(v){
//	for(j=0;j<hexArray.length;j++){
//		if(v==j){v=hexArray[j];}
//	}
//	return v;
//}

//For James
//function hexToDec(m) { 
//	var i, dig ;
//	var res = 0;
//	m = m.toUpperCase()
//	for(i=0;i<m.length;i++){
//		dig=m.slice(i,i+1);
//		res += transHexToDec(dig)*Math.pow(16,m.length-1-i);
//	}
//	return res;
//}

//For James
//function decToHex(m){
//	var dec = parseInt(m);
//	var j = 0;
//	var mp = 0;
//	var f =false;
//	while(!f){
//		if(m/16<1){mp=j;f=true;}
//		else{m=m/16;j++;}
//	}
//	var coefArr=Array();
//	coefArr.length = mp+1;
//	for(i=0;i<mp+1;i++){
//		k=mp-i;
//		coefArr[k]= parseInt(dec/Math.pow(16,k));
//		dec = dec-coefArr[k]*Math.pow(16,k);
//		coefArr[k] = transDecToHex(coefArr[k]);
//	}
//	var res = "'";
//	for(i=0;i<mp+1;i++){
//		k=mp-i
//		res += coefArr[k];
//	}
//	res = res.slice(1,res.length);
//	res = res.toUpperCase()
//	return res;
//}

//For James
//function doFadeAway(){
//	var b = document.getElementById("james");
//	var t = document.getElementById("jam");
//	var m = t.style.color;
//	m = m.slice(1,3);
//	a = m
//	m = hexToDec(m);
	//document.getElementById("me").innerHTML = " hex=" + a + " dec=" + m;
//	m = m+4;
//	if(m>=255){
//		m=255;
//		clearInterval(jamesLoad);
//		document.getElementById("james").style.display = "none"
//	}
//	else{
//		m = decToHex(m);
//		m = "#"+m+m+m;
//		m = m.toUpperCase();
//		t.style.color = m;
//		b.style.borderColor = m;
//	}
//}

//For James
//function init_james(){
//jamesLoad = setInterval("doFadeAway()",100)
//}

function initMenu(){
if(location.href.indexOf("wgs84")<0)
{
location.href="http://www.wrecksite.eu/wrecksite.aspx";
}
//For James//var james = "<div id='james' style='display:none;z-index:1000;position:absolute;left:800px;top:150px;width:250px;height:200px;border:1px solid #333333;font-family:verdana;font-size:10px;background-color:#FFFFFF;color:#333333;'><table><tr><td id='jam' style='padding:15px;color:#333333;'><br /><b>James</b>,<br /><br /><br />Mijn beste vriend,<br /><br />Je was als een vader voor mij,<br />je begreep mij,<br />je hebt me leren duiken en lachen,<br />je bent nu weg,<br />je laat een onzinnige leegte achter.<br /><br />Ik zal je herinnering diep koesteren.<br /><br />Vaar-wel,<br />Duik-wel,<br />Mijn beste vriend,<br /><br /><br />Jan<span id='me'></span></td></tr></table></div>"



//to cope with the history of the wrecksite, redirect old links:
var loc
var dirOarr = Array("/html/","/_en/","/_fr/","/_nl/")
var dirNarr = Array("/wreck/","/wreck/","/epaves/","/wrakken/")
for (i=0;i<dirOarr.length;i++)
	{
	if(location.href.indexOf(dirOarr[i])!=-1)
		{
		loc = location.href.split(dirOarr[i]);
		location.href=loc[0]+dirNarr[i]+loc[1];
		}
	}


//detect page
menuPageX = menuPage.split('-')[0]
menuPageY = menuPage.split('-')[1]

//if the menu-page is a "homepage", use less colors 
if ((menuPageY==0)&&(menuPageX<4)) {sMnuBor = Array('#DDDDDD','#DDDDDD','#DDDDDD','#DDDDDD','#DDDDDD','#DDDDDD')}

//For James
//if (menuPage=="0-0"){
//	var d = document.getElementsByTagName("body")[0]
//	d.innerHTML = d.innerHTML + james
//	b = document.getElementById("james");
//	b.style.display = "block";
//	setTimeout("init_james()",20000);
//	}

//Array('#56338E','#8C6636','#04571C','#0069B3','#E1988C','#666666')

//For Statistics Homepage
if (menuPage=="0-0"){
	var rs
	rs = document.getElementById("stat").recordset
	rs.moveFirst()
	document.getElementById("noWk").innerText =  rs.fields('noWk').value;
	document.getElementById("noHist").innerText = rs.fields('noHist').value;
	document.getElementById("noPic").innerText = rs.fields('noPic').value;
	document.getElementById("noStor").innerText = rs.fields('noStor').value;
}


if (navigator.appName=="Microsoft Internet Explorer") {
	var agt=navigator.userAgent.toLowerCase();
	var broVer=agt.indexOf("msie 5.0")
		if (broVer!=-1) {
			mMnuStyle += 5;fMnuStyle += 5;sMnuStyle += 5;
			mMnuStyleSel += 5;fMnuStyleSel += 5;sMnuStyleSel += 5
			leftSubMnu += 13
			}
}


//Arrays to be filled up depending on the page
//pages 0-3 load different urls than pages 4-9
var fMnuLink = Array()
var fMnuPic = Array()
var fMnuTit = Array()

for (i=0;i<10;i++)
		{
		//funct nav pages in funct nav menu
		fMnuLink[i] = "../" + fMnuFilDir[i] +"/"+ fMnuFilName[i];
		// nav pictures in funct nav menu
		fMnuPic[i] = "../../img/nav/" + fMnuDecoPicName[i]
		fMnuTit[i] = "../../img/nav/" + fMnuTitPicName[i]
		}

//the page itself is an exception
fMnuLink[menuPageX] = fMnuFilName[menuPageX]



//  Create the Functional Navigation Buttons
//==========================================

var fMnuHTML 
fMnuHTML  = "<div style='z-index:7; position:absolute; left:450px; top:26px;'>"
fMnuHTML += "<table cellspacing='0'><tr>";
for (i=0;i<4;i++)
	{
	if (i == menuPageX)
		{
		fMnuHTML += "<td class='" + fMnuStyleSel + "' style=\"background-color:" + fMnuCol[i] + "\">"
		fMnuHTML += "<a href='" + fMnuLink[i] + "' style=\"background-color:" + fMnuCol[i] + ";\">"
		}
	else 
		{
		fMnuHTML += "<td class='" + fMnuStyle + "' onmouseover=\" this.style.background='" + fMnuCol[i] 
		fMnuHTML += "'\"  onmouseout=\"this.style.background='#FFFFFF'\"><a href='" + fMnuLink[i] + "'>" 
		}
	fMnuHTML += fMnuName[i] + "</a></td>";
	}
fMnuHTML += "</tr></table></div>";

//  Create the Language Selection Buttons
//==========================================

var lan = "<div style='z-index:7; position:absolute; left:650px; top:2px;'><table><tr><td onclick=\"change_lan('en')\" onmouseover='hiLan()' onmouseout='unhiLan()' id='en' class='lang'>EN</td><td class='langdum'>&nbsp;</td><td onclick=\"change_lan('nl')\" onmouseover='hiLan()' onmouseout='unhiLan()' id='nl' class='lang'>NL</td><td class='langdum'>&nbsp;</td><td onclick=\"change_lan('fr')\" onmouseover='hiLan()' onmouseout='unhiLan()' id='fr' class='lang'>FR</td></tr></table></div>"


fMnuHTML += lan
document.getElementById('fMenu').innerHTML = fMnuHTML;
for(i=0;i<lanArr.length;i++)
	{
	var tdd = document.getElementById(lanArr[i])
	if(lanArr[i]!=detLan){tdd.className = "lang"}else{tdd.className = "unlang"}
	}


//  Create the Modular Navigation Buttons
//========================================

var mMnuHTML 
mMnuHTML   = "<div style='z-index:17; position:absolute; left:2px; top:169px'>"
mMnuHTML  += "<table cellspacing='0' cellpadding='0' border='0' ><tr><td class='mMnuEmp'>&nbsp;</td></tr>"
for (i=4;i<10;i++)
	{
	if (i == menuPageX)
		{
		mMnuHTML += "<tr><td class='" + mMnuStyleSel + "' style=\"background-color:" + fMnuCol[i] + "\">"
		mMnuHTML += "<a href='" + fMnuLink[i] + "' style=\"background-color:" + fMnuCol[i] + ";\">"
		}
	else 
		{
		mMnuHTML += "<td class='" + mMnuStyle + "' onmouseover=\" this.style.background='" + fMnuCol[i] 
		mMnuHTML += "'\"  onmouseout=\"this.style.background='#FFFFFF'\"><a href='" + fMnuLink[i] + "'>" 
		}
	mMnuHTML += fMnuName[i] + "</a></td></tr>";
	}

mMnuHTML += "<tr><td class='mMnuEmp'>&nbsp;</td></tr>"
mMnuHTML += "<tr><td class='mMnuEmp'>&nbsp;</td></tr>"
mMnuHTML += "<tr><td class='mMnuEmp'>&nbsp;</td></tr>"
mMnuHTML += "<tr><td class='mMnuEmp'><img src='spacer.gif' height='1px' width='72px' alt=''/></td></tr>"
mMnuHTML += "</table></div>"
document.getElementById('mMenu').innerHTML = mMnuHTML;




//  Create the Sub-Modular Navigation Buttons
//============================================

if (menuPageX > 3)
{
var sMnuN = sMnuName[menuPageX-4]
var sMnuF = sMnuFilName[menuPageX-4]
sMnuHTML  = "<div style='z-index:19; position:absolute; left:" + leftSubMnu + "px; top:" + sMnuTop[menuPageX-4] + "px'>"
sMnuHTML  += "<table cellspacing='0' cellpadding='0' border='0'>"
for (i=0;i<sMnuN.length;i++)
	{
	if (i == menuPageY-1)
		{
		sMnuHTML += "<tr><td style=\"border-left:4px solid " + sMnuBor[menuPageX-4]  
		sMnuHTML += "; background-color:" + fMnuCol[menuPageX] + ";\" class='"
		sMnuHTML += sMnuStyleSel + "'>"
		sMnuHTML += "<a href='../" + fMnuFilDir[menuPageX]+"/" + sMnuF[i] + "'>" 
		}
	else 
		{
		sMnuHTML += "<tr><td style=\"border-left:4px solid " + sMnuBor[menuPageX-4] + ";\" class='"
		sMnuHTML += sMnuStyle + "' onmouseover=\" this.style.background='" + fMnuCol[menuPageX]
		sMnuHTML += "' \" onmouseout=\"this.style.background='#FFFFFF'\">" 
		sMnuHTML += "<a href='../" + fMnuFilDir[menuPageX] +"/"+ sMnuF[i] + "'>"
		}
	sMnuHTML += sMnuN[i] + "</a></td></tr>";
	}
sMnuHTML += "<tr><td style=\"border-left:4px solid " + sMnuBor[menuPageX-4] + ";\" class='sMnuEmp'>&nbsp;</td></tr>"
sMnuHTML += "</table></div>"
document.getElementById('sMenu').innerHTML = sMnuHTML;
}
else
{
sMnuHTML  = "<div style='z-index:19; position:absolute; left:" + leftSubMnu + "px; top:210px'>"
sMnuHTML += "<table cellspacing ='0'>"
for (i=0;i<sMnuBor.length;i++)
	{
	sMnuHTML += "<tr><td width='4' class='sMnuSel' style='padding-bottom:0px; border-left:4px solid " + sMnuBor[i] 
	sMnuHTML += ";background-color:" + sMnuBor[i] + "'>&nbsp;</td></tr>" 	
	sMnuHTML += "<tr><td class='sMnuEmp'>&nbsp;</td></tr>"
	}
sMnuHTML += "</table></div>"
document.getElementById('sMenu').innerHTML = sMnuHTML
}

//  Setup other Decorations
//======================================
var fMnuPicHTML 
fMnuPicHTML  = "<div style='z-index:-1;left: 0px; position: absolute; top: 0px;'>"
fMnuPicHTML += "<a href='http://users.pandora.be/tree'><img style='border:0px' src='"
fMnuPicHTML += fMnuPic[menuPageX] + "' alt='The wrecksite' /></a></div>"
document.getElementById('fMenuPic').innerHTML = fMnuPicHTML;


var fMnuTitHTML
fMnuTitHTML  = "<div style='z-index: 7; left: 170px; position: absolute; top: 10px;'><img src='"
fMnuTitHTML += fMnuTit[menuPageX] + "' alt='The Wrecksite' /></div>"
document.getElementById('fMenuTit').innerHTML = fMnuTitHTML;


//  Format other Navigation buttons
//======================================

var backHTML =""
backHTML  = "<div style='z-index:9; position:absolute; top:55px; left:660px;'>"
backHTML += "<a href='javascript:history.go(-1);'>"
if (menuPageX<4)
	{backHTML += "<img style=\"border-left:1px solid " + sMnuBor[0] 
	 backHTML += "; border-bottom:0px solid " + sMnuBor[0] 
	 backHTML += "; background-color:" + fMnuCol[menuPageX] + ";\" src='../../img/nav/"}
else
	{backHTML += "<img style=\"border-left:1px solid " + sMnuBor[menuPageX-4]
	 backHTML += "; border-bottom:0px solid " + sMnuBor[menuPageX-4]  
	 backHTML += "; background-color:" + fMnuCol[menuPageX] + ";\" src='../../img/nav/"}


backHTML += "button_back_mnu.gif' alt='back' /></a></div>"

document.getElementById('backBut').innerHTML = backHTML;


var img = document.getElementsByTagName("img")
for (i=0;i<img.length;i++)
{
if ((img[i].id == "print")||(img[i].id == "info")||(img[i].id == "calc")||(img[i].id == "map")
||(img[i].id == "zoom_min")||(img[i].id == "wreck"))
{
img[i].style.borderLeft = "1px solid " + sMnuBor[menuPageX-4];
//img[i].style.borderBottom = "1px solid " + sMnuBor[menuPageX-4]
}
else {}
}
}

//  Used in pic.html
//======================================

function prot()
{
var picId, pic, piwi, pihe, name, subname, wreck, src, srcRef
picId = location.search.substring(1);
picId = picId.split("?")
picId = picId[0]
var rs = pic_details.recordset
rs.moveFirst()
for (i=0;i<rs.recordCount;i++)
	{
	if ( picId == rs.fields('PicId').value )
		{
		pic = rs.fields('PicName').value
		pic = "../../img/wrecks/" + pic + ".jpg"
		pic = "<img id='pi' src='" + pic + "' alt='' />"
		wreck = rs.fields('WreckId').value
		name = rs.fields('Name').value
		src = rs.fields('SourceName').value
		srcRef = rs.fields('SourceLink').value
		}
	rs.moveNext()
	}
document.getElementById('pic_details').filter = "(WreckID = " + wreck + ")"
document.getElementById('pic_details').sort = "+PicName"
document.getElementById('pic_details').reset() 
var txtpic= "more pictures : "
if (detLan=="fr"){txtpic="plus d'images : "}
if (detLan=="nl"){txtpic="meer fotos : "}
var rsnew = pic_details.recordset
var nrPic = rsnew.recordCount
var navHTML = ""
if (nrPic !== 1)
	{
	navHTML = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+txtpic
	for (i=0;i<nrPic;i++)
		{
		if (rsnew.fields('PicId').value == picId)
			{
			navHTML += "<span style='color:333333;'"
			navHTML += " onmouseover=\"this.style.cursor='';\">"}
		else
			{
			navHTML += "<span style='color:999999;'"
			navHTML += " onmouseover=\"this.style.cursor='hand';this.style.color='#333333';window.status='"
			navHTML += rsnew.fields('PicShortName') + "';\" "
			navHTML += " onmouseout=\"this.style.cursor='';this.style.color='#999999';window.status='';\" "
			navHTML += " onclick=\"javascript:window.location.href = 'pic.html?" + rsnew.fields('PicId') + "';\">"
			}
		navHTML += "[" + (i+1) + "]&nbsp;</span>" 
		rsnew.moveNext()
		}
	navHTML += ""
	}
else 
	{navHTML = ""}
var lnk = "<a href='../../db/wreckdetails/detail_query.html?filter="+wreck+"'>"
document.getElementById('navpic').innerHTML = navHTML
document.getElementById('picture').innerHTML = pic
document.getElementById('name').innerHTML = lnk + name + "</a>"
var dsource = document.getElementById('source')
if (src=="") 
	{dsource.innerHTML = ""}
else 
	{
	var d, ref
	d  = "<span style='font-size:7pt; color:#666666; font-family:verdana;"
	d += "background-color:#FFFFFF;border:0px solid #000000;padding:0px'>"
	if(srcRef=="")
		{ref=src}
	else
		{ref="<a href='" + srcRef + "' target='_blank' class='ext'>" + src + "</a>" }  
	d += "&nbsp;Source:&nbsp;" + ref + "&nbsp;</span>"
	dsource.innerHTML = d

	piwi = document.getElementById('pi').width
	pihe = document.getElementById('pi').height
	document.getElementById('frame').width = piwi + 10
	document.getElementById('frame').height = pihe + 10
	}
}

function hiLan() {
var we = window.event.srcElement
if (we.id!=detLan){we.style.color="#333333";we.style.border="1px solid #666666" ;we.style.cursor="hand"; }
}

function unhiLan() {
var we = window.event.srcElement
if (we.id!=detLan){we.style.color="#999999";we.style.border="1px solid #FFFFFF" }
}

function change_lan(lan) {
if (lan!=detLan)
	{
	if(lan=="en"){lanDir="wreck";   fMnuFilDir = fMnuFilDir_en; sMnuFilName=sMnuFilName_en; fMnuFilName=fMnuFilName_en } 
	if(lan=="fr"){lanDir="epaves";  fMnuFilDir = fMnuFilDir_fr; sMnuFilName=sMnuFilName_fr; fMnuFilName=fMnuFilName_fr } 
	if(lan=="nl"){lanDir="wrakken"; fMnuFilDir = fMnuFilDir_nl; sMnuFilName=sMnuFilName_nl; fMnuFilName=fMnuFilName_nl } 
	if (menuPageX > 3){
		var loc = "../../" + lanDir + "/" + fMnuFilDir[menuPageX] + "/"
		if (menuPageY==0)	{
			location.href = loc + fMnuFilName[menuPageX]}
		else	{
			location.href = loc + sMnuFilName[menuPageX-4][menuPageY-1]	}
		}
	else	{
		location.href ="../../" + lanDir + "/" + fMnuFilDir[menuPageX] + "/" + fMnuFilName[menuPageX]}
	}

//to make an easy change from language while in detail_query
var l = location.href
if(l.indexOf("detail_query")!==-1)
	{
	var l1 = l.split("tree/")[0]
	var l2 = l.split("?filter=")[1]
	if(lan=="en"){location.href="../../wreck/wreck-database/detail_query.html?filter=" + l2}
	if(lan=="nl"){location.href="../../wrakken/wrakken-database/detail_query.html?filter=" + l2}
	if(lan=="fr"){location.href="../../epaves/base-de-donnees-epaves/detail_query.html?filter=" + l2}
	}

	

}

//to avoid unsollicitated spam:
function initContact() {
var malHTML = "<a href='mailto:wrecksite@"
malHTML += "pandora.be?subject=suggestions-comments on the wrecksite' " 
malHTML += "onmouseout=\"self.status=''; return true;\" onmouseover=\"window.status='Wrecksite "
malHTML += "Brukersebaan 11 1790 Affligem';return true;\">wrecksite@"
malHTML += "pandora.be</a>"
document.getElementById("mal").innerHTML = malHTML
}

// Direct link to chart and wreck
function openup(chId,dir,wk){
var width = screen.width
if(wk.length>0){wk="?wkId="+wk}else{wk=""}
var newWindow = window.open(dir + "chart.html?chartId="+chId+wk,"seacharts","toolbar=no,location=no,status=no,menubar=no,top=0,left=0,scrollbars=no,resizable=yes,maximized=1,taskbar=yes,top=0,left=0,width=" + screen.availWidth + ",height=" + screen.availHeight);
newWindow.focus()
}

// for netscape, opera, mozilla etc, to be better done
function NS_Mac_Warning() 
{
if (navigator.appName=="Netscape")
 {
  alert("  Sorry. This website will not function  \n" + "  properly with Netscape.  \n" + "  Please, use Internet Explorer 	5.0 or higher.  ")
 }
var width = screen.width
width = parseInt(width)
if (width < 1024)
{alert("Your screen resolution is : " + screen.width + " x " +
screen.height + "\n" + "We recommend 1024 x 768.");}
}

function addBookMark()
{
if(detLan=="en"){f = "wreck/wrecksite/wrecksite.html"; 	t= "Wrecksite, wreck database"; }
if(detLan=="nl"){f = "epaves/siteepaves/siteepaves.html"; 	t= "Wrakkensite, wrakken database"; }
if(detLan=="fr"){f = "wrakken/wrakkensite/wrakkensite.html";t= "Site Epaves, base de données épaves"; }
f = "http://users.pandora.be/tree/" + f
if (document.all) {window.external.AddFavorite(f,t)}
else {alert("Sorry, not possible with \n your browser")}
}


//  For the Quick position find 
//======================================

var latq, lonq

function validate() {
latq = document.getElementById("latq").value
lonq = document.getElementById("lonq").value
if((latq.indexOf("°")==-1)||(latq.indexOf(",")==-1)||(latq.indexOf(",")==-1)||((latq.indexOf("N")==-1)&&(latq.indexOf("S")==-1)))
	{alert("Enter valid format for latitude: XX°YY,ZZZN or XX°YY,ZZZS")}
else
	{
	if((lonq.indexOf("°")==-1)||(lonq.indexOf(",")==-1)||(lonq.indexOf(",")==-1)||((lonq.indexOf("E")==-1)&&(lonq.indexOf("W")==-1)))
	{alert("Enter valid format for longitude XX°YY,ZZZE or XX°YY,ZZZW ")}
	else{openupPos()}
	}
}

function openupPos() {
dir=""
if(location.href.indexOf("wrecksite.html")!==-1){dir="../wreck-database/"}
if(location.href.indexOf("site-epaves.html")!==-1){dir="../base-de-donnees-epaves/"}
if(location.href.indexOf("wrakkensite.html")!==-1){dir="../wrakken-database/"}
var al1, al2, al3, al4
var errMsg = ""
if(detLan=="en")
	{
	al1 = "No marine charts available for this position."
	al2 = "Minutes must be smaller or equal to 59."
	al3 = "Latitude must be smaller than 90°." 
	al4 = "Longitude must be smaller than 180°." 
	}
if(detLan=="fr") 
	{
	al1 = "Pas de carte nautique disponible pour cette position."
	al2 = "Entrez des minutes qui sont moins ou égal à 59."
	al3 = "Latitudes doivent être moins que 90°." 
	al4 = "Longitudes doivent être moins que 180°." 
	}
if(detLan=="nl") 
	{
	al1 = "Geen zeekaart gevonden voor deze positie."
	al2 = "Minuten moeten kleiner of gelijk zijn aan 59."
	al3 = "Latitudes moeten kleiner zijn dan 90°." 
	al4 = "Longitudes moeten kleiner zijn dan 180°." 
	}

latdir=""
londir=""
latdeg = parseFloat(latq.split("°")[0])
latmin = parseFloat(latq.split("°")[1].split(",")[0])
latsec = parseFloat(latq.split("°")[1].split(",")[1])
latdir = latq.slice(latq.length-1)
if(latdir=="N"){latdir=""}else{latdir="-"}
lat = latdir + latdeg + "." + latmin + "." + latsec 
londeg = parseFloat(lonq.split("°")[0])
lonmin = parseFloat(lonq.split("°")[1].split(",")[0])
lonsec = parseFloat(lonq.split("°")[1].split(",")[1])
londir = lonq.slice(lonq.length-1)
if(londir=="E"){londir=""}else{londir="-"}
lon = londir + londeg + "." + lonmin + "." + lonsec 
var width = screen.width
if((latdeg>=60)||(latdeg<=45)||(londeg>=15)||(latdir=="-"))
	{errMsg = al1}
if (latdeg>=90)
	{if(errMsg==""){errMsg +=al3;}else{errMsg +="\n" +al3}}
if (londeg>=180)
	{if(errMsg==""){errMsg +=al4;}else{errMsg +="\n" +al4}}
if((latmin>=60)||(lonmin>=60))
	{if(errMsg==""){errMsg +=al2;}else{errMsg +="\n" +al2}}
if(errMsg=="")
	{
var newWindow = window.open(dir + "chart.html?lat=" + lat + "?lon=" + lon + "?div=100", "seacharts","toolbar=no,location=no,status=no,menubar=no,top=0,left=0,scrollbars=no,resizable=yes,maximized=1,taskbar=yes,top=0,left=0,width=" + screen.availWidth + ",height=" + screen.availHeight);
newWindow.focus()
	}
else {alert(errMsg)}
}


