// 2.04  make ready for 8 textmenus
// 2.05  append function GetWindowWidthHeight()
// 2.06  width toevoegen aan DisPlayText() zodat bij advanced2a de tekst uitlijnt

// vang rechtmuisklik af down-arrow BRMC();
function BRMC(){
	document.oncontextmenu = function (){ return false;};
}

// get the current width and height of the browserwindow
// return array with myArray[0] = winWidth and myArray[1] = winHeight
// var aWindowWH = GetWindowWidthHeight();
// alert( 'window is ' + aWindowWH[0] + ' x ' + aWindowWH[1] );
function GetWindowWidthHeight(){
	var winW = document.documentElement.clientWidth;
	var winH = document.documentElement.clientHeight;
	var browserName=navigator.appName;

	if (browserName=="Netscape"){
		if (parseInt(navigator.appVersion)>3) {
			if (navigator.appName=="Netscape") {
				winW = window.innerWidth;
				winH = window.innerHeight;
			}
		}
	}else{
		if (browserName=="Microsoft Internet Explorer"){
			winW = document.body.offsetWidth;
			winH = document.body.offsetHeight;
		}
	}
	// array from width and heigt
	var myArray = new Array(2);
	myArray[0] = winW;
	myArray[1] = winH;
	
	return myArray;
}

// dit is zeer handig om te kijken of een id wel bestaat voordat je iets uitvoert
// if( CheckIfIdExists( 'hier_de_id' ) ){ do something; }
function CheckIfIdExists( e ){
		var t=typeof(e);
		if (t == "undefined")
			return 0;
		else if (t == "string")
		{
			var re = document.getElementById( e );
			if (!re)
				return 0;
			else if (typeof(re.appendChild) != "undefined" )
				return re;
			else
				return 0;
		}
		else if (typeof(e.appendChild) != "undefined")
			return e;
		else
			return 0;
}

function initBovenPlaatje() {
	var winW = document.documentElement.clientWidth;
	var winH = document.documentElement.clientHeight;
	var browserName=navigator.appName; 
	
	if (browserName=="Netscape"){ 
		if (parseInt(navigator.appVersion)>3) {
			if (navigator.appName=="Netscape") {
				winW = window.innerWidth;
				winH = window.innerHeight;
			}
		}
	}else{ 
		if (browserName=="Microsoft Internet Explorer"){
			winW = document.body.offsetWidth;
			winH = document.body.offsetHeight;
		}
	}
	if( winH > 600 ){
		document.getElementById('bovenplaatje').style.height = '34px';
	}else{
		document.getElementById('bovenplaatje').style.height = '8px';
	}
}

// ######v###v### javascript BGslideShow functions #####################################
//#####v####v###                           ######v#######v#####v#######v####v######v####v######vv#######v#########
var dCimageHeight = 0.87 * g_CONFIG_imageMAXheight;
var dCimageWidthSmall = 0.3 * g_CONFIG_imageMAXwidth;
var dCimageWidthBig = 0.38 * g_CONFIG_imageMAXwidth;

var gControlImages = "<nobr><img src='images/leeg.gif' onMouseOver=\"this.style.cursor='pointer';this.style.cursor='hand';\" title='klik hier voor de vorige foto' id='prevpic' name='prevpic' height='" + dCimageHeight + "' width='" + dCimageWidthSmall + "' border='0' align='left' onclick='GoToPrevPicture();'><img src='images/leeg.gif' onMouseOver=\"this.style.cursor='pointer';this.style.cursor='hand';\" title='klik hier om de slideshow te starten/stoppen' id='slide' name='slidepic' height='" + dCimageHeight + "' width='" + dCimageWidthBig + "' border=0' align='left' onclick='ToggleSlideShow();'><img src='images/leeg.gif' title='klik hier voor de volgende foto' id='nextpic' onMouseOver=\"this.style.cursor='pointer';this.style.cursor='hand';\" name='nextpic' height='" + dCimageHeight + "' width='" + dCimageWidthSmall + "' border=0' align='left' onclick='GoToNextPicture();'></nobr><br><div id=\"slideshowtext\" class=\"slideshowtext\"></div>";

// DisPlayText( 'MENU1' ) display in fotoslide DIV but first STOP slideshow
function DisPlayText( p_menu ){
	
	var sNieuweInnerHTML;

	ClearLInks( 0 );

	g_stopslideshow='yes';
	g_SHOWcurrentPicture = 'yes';
	g_NrOfPictureToPlay=0;
	g_ProjectNr=0;
	document.getElementById('fotoslide').style.backgroundImage = 'url( "images/leeg.gif" )';
	
	// look if bovenplaatje height is to big than no toppic image
	if( document.getElementById('bovenplaatje').style.height == '8px' ){
		sTableStart = '<table border="0"><tr><td valign="top"><img src="images/leeg.gif" id="toppic" width="470" height="20" border="0"><br/>';
	}else{
		sTableStart = '<table border="0" width="' + g_CONFIG_imageMAXwidth + '" cellspacing="0" cellpadding="0"><tr><td valign="top">';
	}
	sTableEnd = '</td><td valign="top"><img src="images/leeg.gif" id="overpic" width="5" height="' + g_CONFIG_imageMAXheight + '" border="0"></td</tr></table>';
	
	var str_lengteheight = "  ";
	str_lengteheight = document.getElementById('bovenplaatje').style.height;
	
	if( p_menu=='INTRO' ){
		sNieuweInnerHTML = sTableStart ;
		if( g_intropicture ){
			sNieuweInnerHTML = sNieuweInnerHTML + '<div style=\"text-align:center;width:' + g_CONFIG_imageMAXwidth + ';\"><img src=\"images/' + g_introfotofilename + '\" name=\"intropic\" ></div><p>';
		}
		sNieuweInnerHTML = sNieuweInnerHTML + g_introtext;
	}else{
		// set powered by only with text
		document.getElementById('powered').style.display = 'inline';
	}
	
	if( p_menu=='MENU1' ){
		document.getElementById('menu1').className = 'menuvisited';
		sNieuweInnerHTML = sTableStart + g_menutxt1;
	}
	if( p_menu=='MENU2' ){
		document.getElementById('menu2').className = 'menuvisited';
		sNieuweInnerHTML = sTableStart + g_menutxt2;
	}
	if( p_menu=='MENU3' ){
		document.getElementById('menu3').className = 'menuvisited';
		sNieuweInnerHTML = sTableStart + g_menutxt3;
	}
	if( p_menu=='MENU4' ){
		document.getElementById('menu4').className = 'menuvisited';
		sNieuweInnerHTML = sTableStart + g_menutxt4;
	}
	if( p_menu=='MENU5' ){
		document.getElementById('menu5').className = 'menuvisited';
		sNieuweInnerHTML = sTableStart + g_menutxt5;
	}
	if( p_menu=='MENU6' ){
		document.getElementById('menu6').className = 'menuvisited';
		sNieuweInnerHTML = sTableStart + g_menutxt6;
	}
	if( p_menu=='MENU7' ){
		document.getElementById('menu7').className = 'menuvisited';
		sNieuweInnerHTML = sTableStart + g_menutxt7;
	}
	if( p_menu=='MENU8' ){
		document.getElementById('menu8').className = 'menuvisited';
		sNieuweInnerHTML = sTableStart + g_menutxt8;
	}
	if( p_menu=='TEXTPAGE' ){
		sNieuweInnerHTML = sTableStart + '<div style="padding-right:40px;padding-left:17px;">' + g_textpage + '</div>';
	}
	document.getElementById('fotoslide').style.textAlign = 'left';
	document.getElementById('fotoslide').innerHTML = sNieuweInnerHTML + sTableEnd;
	document.getElementById('navigatielinks').innerHTML = '';
	document.getElementById('navigatierechts').innerHTML = '';
	document.getElementById('fotoslide').style.height = 'auto';
	
	if( p_menu=='leeg' ){
		document.getElementById('fotoslide').innerHTML = '';
	}
	// zorg dat rechtermuis op plaatjes niet werkt
	BRMC();
}

// ClearLInks() clear link style: reset the styles of the divs from the menu's
function ClearLInks( p_notthis ){
	
	if( g_nr_of_menus>=1 && CheckIfIdExists( 'menu1' ) )	document.getElementById('menu1').className= 'menu';
	if( g_nr_of_menus>=2 && CheckIfIdExists( 'menu2' ) )	document.getElementById('menu2').className= 'menu';
	if( g_nr_of_menus>=3 && CheckIfIdExists( 'menu3' ) )	document.getElementById('menu3').className= 'menu';
	if( g_nr_of_menus>=4 && CheckIfIdExists( 'menu4' ) )	document.getElementById('menu4').className= 'menu';
	if( g_nr_of_menus>=5 && CheckIfIdExists( 'menu5' ) )	document.getElementById('menu5').className= 'menu';
	if( g_nr_of_menus>=6 && CheckIfIdExists( 'menu6' ) )	document.getElementById('menu6').className= 'menu';
	if( g_nr_of_menus>=7 && CheckIfIdExists( 'menu7' ) )	document.getElementById('menu7').className= 'menu';
	if( g_nr_of_menus>=8 && CheckIfIdExists( 'menu8' ) )	document.getElementById('menu8').className= 'menu';

	if( p_notthis != 1 && 1 <= g_nr_of_projects ){
		document.getElementById( 'projtext1' ).className = 'projectmenu';
	}
	if( p_notthis != 2 && 2 <= g_nr_of_projects ){
		document.getElementById( 'projtext2' ).className = 'projectmenu';
	}
	if( p_notthis != 3 && 3 <= g_nr_of_projects ){
		document.getElementById( 'projtext3' ).className = 'projectmenu';
	}
	if( p_notthis != 4 && 4 <= g_nr_of_projects ){
		document.getElementById( 'projtext4' ).className = 'projectmenu';
	}
	if( p_notthis != 5 && 5 <= g_nr_of_projects ){
		document.getElementById( 'projtext5' ).className = 'projectmenu';
	}
	if( p_notthis != 6 && 6 <= g_nr_of_projects ){
		document.getElementById( 'projtext6' ).className = 'projectmenu';
	}
	if( p_notthis != 7 && 7 <= g_nr_of_projects ){
		document.getElementById( 'projtext7' ).className = 'projectmenu';
	}
	if( p_notthis != 8 && 8 <= g_nr_of_projects ){
		document.getElementById( 'projtext8' ).className = 'projectmenu';
	}
	if( p_notthis != 9 && 9 <= g_nr_of_projects ){
		document.getElementById( 'projtext9' ).className = 'projectmenu';
	}
	if( p_notthis != 10 && 10 <= g_nr_of_projects ){
		document.getElementById( 'projtext10' ).className = 'projectmenu';
	}
	if( p_notthis != 11 && 11 <= g_nr_of_projects ){
		document.getElementById( 'projtext11' ).className = 'projectmenu';
	}
	if( p_notthis != 12 && 12 <= g_nr_of_projects ){
		document.getElementById( 'projtext12' ).className = 'projectmenu';
	}
	if( p_notthis != 13 && 13 <= g_nr_of_projects ){
		document.getElementById( 'projtext13' ).className = 'projectmenu';
	}
	if( p_notthis != 14 && 14 <= g_nr_of_projects ){
		document.getElementById( 'projtext14' ).className = 'projectmenu';
	}
	if( p_notthis != 15 && 15 <= g_nr_of_projects ){
		document.getElementById( 'projtext15' ).className = 'projectmenu';
	}
	if( p_notthis != 16 && 16 <= g_nr_of_projects ){
		document.getElementById( 'projtext16' ).className = 'projectmenu';
	}
	if( p_notthis != 17 && 17 <= g_nr_of_projects ){
		document.getElementById( 'projtext17' ).className = 'projectmenu';
	}
	if( p_notthis != 18 && 18 <= g_nr_of_projects ){
		document.getElementById( 'projtext18' ).className = 'projectmenu';
	}
	if( p_notthis != 19 && 19 <= g_nr_of_projects ){
		document.getElementById( 'projtext19' ).className = 'projectmenu';
	}
	if( p_notthis != 20 && 20 <= g_nr_of_projects ){
		document.getElementById( 'projtext20' ).className = 'projectmenu';
	}
	if( p_notthis != 21 && 21 <= g_nr_of_projects ){
		document.getElementById( 'projtext21' ).className = 'projectmenu';
	}
	if( p_notthis != 22 && 22 <= g_nr_of_projects ){
		document.getElementById( 'projtext22' ).className = 'projectmenu';
	}
	if( p_notthis != 23 && 23 <= g_nr_of_projects ){
		document.getElementById( 'projtext23' ).className = 'projectmenu';
	}
	if( p_notthis != 24 && 24 <= g_nr_of_projects ){
		document.getElementById( 'projtext24' ).className = 'projectmenu';
	}
	if( p_notthis != 25 && 25 <= g_nr_of_projects ){
		document.getElementById( 'projtext25' ).className = 'projectmenu';
	}
}

// ClearText( p_notthis ) clear display in fotoslide DIV but first STOP slideshow
function ClearText( p_notthis ){	
	ClearLInks( p_notthis );
	document.getElementById('fotoslide').innerHTML = gControlImages;
	document.getElementById('fotoslide').style.height = g_CONFIG_imageMAXheight + 'px';
	document.getElementById('navigatielinks').innerHTML = '<a href="javascript:GoToPrevPicture();" class="navigation">&lt;&lt;</a>';
	document.getElementById('navigatierechts').innerHTML = '<a href="javascript:GoToNextPicture();" class="navigation">&gt;&gt;</a>';
}


