var current_page = 0;
var show_teller=1;
var show_wait=20;
var timer1Running = false;
var timer1ID = null ;


function hideMenu(node)
{
	node.style.background="none";
}

function showMenu(node)
{
	node.style.background="none";
}

function refresh(menu,page)
{
	if (menu == "top") {
		window.document.home.src='images/menu/topmenu_item1_n.gif'
		window.document.programma.src='images/menu/topmenu_item2_n.gif'
		window.document.impressie.src='images/menu/topmenu_item3_n.gif'
		window.document.kaartverkoop.src='images/menu/topmenu_item4_n.gif'
		window.document.sponsors.src='images/menu/topmenu_item5_n.gif'
		window.document.contact.src='images/menu/topmenu_item6_n.gif'

		if (current_page == 1) window.document.home.src='images/menu/topmenu_item1_s.gif'
		if (current_page == 2) window.document.programma.src='images/menu/topmenu_item2_s.gif'
		if ((current_page == 3) || (current_page == 31) || (current_page == 32) || (current_page == 33)) {
			    window.document.impressie.src='images/menu/topmenu_item3_s.gif'
		}
		if (current_page == 4) window.document.kaartverkoop.src='images/menu/topmenu_item4_s.gif'
		if (current_page == 5) window.document.sponsors.src='images/menu/topmenu_item5_s.gif'
		if (current_page == 6) window.document.contact.src='images/menu/topmenu_item6_s.gif'
		
		if (page == 1) window.document.home.src='images/menu/topmenu_item1_h.gif'
		if (page == 2) window.document.programma.src='images/menu/topmenu_item2_h.gif'
		if (page == 3) window.document.impressie.src='images/menu/topmenu_item3_h.gif'
		if (page == 4) window.document.kaartverkoop.src='images/menu/topmenu_item4_h.gif'
		if (page == 5) window.document.sponsors.src='images/menu/topmenu_item5_h.gif'
		if (page == 6) window.document.contact.src='images/menu/topmenu_item6_h.gif'
	}
	if (menu == "impressie") {
		window.document.impressie1a.src='images/menu/impressie-1n.png'
		window.document.impressie1b.src='images/menu/impressie-1n.png'
		//window.document.impressie2a.src='images/menu/impressie-2n.png'
		//window.document.impressie2b.src='images/menu/impressie-2n.png'
		window.document.impressie3a.src='images/menu/impressie-3n.png'
		window.document.impressie3b.src='images/menu/impressie-3n.png'
		window.document.impressie4a.src='images/menu/impressie-4n.png'
		window.document.impressie4b.src='images/menu/impressie-4n.png'
		window.document.impressie5a.src='images/menu/impressie-5n.png'
		window.document.impressie5b.src='images/menu/impressie-5n.png'

		if (current_page == 31) { window.document.impressie1a.src='images/menu/impressie-1s.png' ; window.document.impressie1b.src='images/menu/impressie-1s.png' }
		//if (current_page == 32) { window.document.impressie2a.src='images/menu/impressie-2s.png' ; window.document.impressie2b.src='images/menu/impressie-2s.png' }
		if (current_page == 33) { window.document.impressie3a.src='images/menu/impressie-3s.png' ; window.document.impressie3b.src='images/menu/impressie-3s.png' }
		if (current_page == 34) { window.document.impressie4a.src='images/menu/impressie-4s.png' ; window.document.impressie4b.src='images/menu/impressie-4s.png' }
		if (current_page == 35) { window.document.impressie5a.src='images/menu/impressie-5s.png' ; window.document.impressie5b.src='images/menu/impressie-5s.png' }

		if (page == 1) { window.document.impressie1a.src='images/menu/impressie-1h.png' ; window.document.impressie1b.src='images/menu/impressie-1h.png' }
		//if (page == 2) { window.document.impressie2a.src='images/menu/impressie-2h.png' ; window.document.impressie2b.src='images/menu/impressie-2h.png' }
		if (page == 3) { window.document.impressie3a.src='images/menu/impressie-3h.png' ; window.document.impressie3b.src='images/menu/impressie-3h.png' }
		if (page == 4) { window.document.impressie4a.src='images/menu/impressie-4h.png' ; window.document.impressie4b.src='images/menu/impressie-4h.png' }
		if (page == 5) { window.document.impressie5a.src='images/menu/impressie-5h.png' ; window.document.impressie5b.src='images/menu/impressie-5h.png' }
	}
	if (menu == "bottom") {
		window.document.route.src='images/menu/bottommenu_item1_n.gif'
		window.document.media.src='images/menu/bottommenu_item2_n.gif'
		window.document.leden.src='images/menu/bottommenu_item3_n.gif'
		window.document.pers.src='images/menu/bottommenu_item4_n.gif'
		window.document.concordia_1.src='images/menu/bottommenu_item5_n.gif'

		if (current_page == 11) window.document.route.src='images/menu/bottommenu_item1_s.gif'
		if (current_page == 12) window.document.media.src='images/menu/bottommenu_item2_s.gif'
		if (current_page == 13) window.document.leden.src='images/menu/bottommenu_item3_s.gif'
		if (current_page == 14) window.document.pers.src='images/menu/bottommenu_item4_s.gif'
		if (current_page == 15) window.document.concordia_1.src='images/menu/bottommenu_item5_s.gif'

		if (page == 1) window.document.route.src='images/menu/bottommenu_item1_h.gif'
		if (page == 2) window.document.media.src='images/menu/bottommenu_item2_h.gif'
		if (page == 3) window.document.leden.src='images/menu/bottommenu_item3_h.gif'
		if (page == 4) window.document.pers.src='images/menu/bottommenu_item4_h.gif'
		if (page == 5) window.document.concordia_1.src='images/menu/bottommenu_item5_h.gif'
	}
}

function stopclock()
{
	if(timer1Running) clearTimeout(timer1ID);
	timer1Running = false;
}

function shownext()
{
	if (show_wait > 0) {
		show_wait-- ;
	} else {
		show_teller++;
		if (show_teller>(14)) show_teller=1;

		showartiest(show_teller) ; 
		show_wait = 6 ;
	}

	timer1ID = setTimeout("shownext()",1000);
	timer1Running = false;
}


function startclock(page)
{
	if (page == "Home")            { current_page = 1; refresh("top",0); }
	if (page == "Programma")       { current_page = 2; refresh("top",0); }
	if (page == "Impressie2006")   { current_page = 31; refresh("top",0); refresh("impressie",0); }
	if (page == "DeWegNaarCMN2006"){ current_page = 32; refresh("top",0); refresh("impressie",0); }
	if (page == "Artiesten")       { current_page = 33; refresh("top",0); refresh("impressie",0); }
	if (page == "DeWegNaarCMN2010"){ current_page = 34; refresh("top",0); refresh("impressie",0); }	
	if (page == "Impressie")       { current_page = 35; refresh("top",0); refresh("impressie",0); }
	if (page == "Kaartverkoop")    { current_page = 4; refresh("top",0); }
	if (page == "Toegangskaarten") { current_page = 4; refresh("top",0); }
	if (page == "Dvdverkoop")      { current_page = 4; refresh("top",0); }
	if (page == "MusicNightDVD")   { current_page = 4; refresh("top",0); }
	if (page == "Sponsors")        { current_page = 5; refresh("top",0); }
	if (page == "Contact")         { current_page = 6; refresh("top",0); }

	if (page == "Route")           { current_page = 11; refresh("bottom",0); }
	if (page == "Media")           { current_page = 12; refresh("bottom",0); }
	if (page == "Leden")           { current_page = 13; refresh("bottom",0); }
	if (page == "Pers")            { current_page = 14; refresh("bottom",0); }
	
	if (page == "Artiesten")
	{
		stopclock();
		showartiest(show_teller)
		shownext();
	}
}

function highlight(image,state)
{
	if (state == 0) {
		if (image == "toegangskaarten") window.document.toegangskaarten.src='content/images/koop_nu_je_kaarten.jpg' ;
		if (image == "musicnightdvd") window.document.musicnightdvd.src='content/images/koop_nu_je_dvd.jpg' ;
	}
	if (state == 1) {
		if (image == "toegangskaarten") window.document.toegangskaarten.src='content/images/koop_nu_je_kaarten_gesloten.jpg' ;
		if (image == "musicnightdvd") window.document.musicnightdvd.src='content/images/koop_nu_je_dvd_gesloten.jpg' ;
	}
	if (state == 2) {
		if (image == "toegangskaarten") window.document.toegangskaarten.src='content/images/koop_nu_je_kaarten_h.jpg' ;
		if (image == "musicnightdvd") window.document.musicnightdvd.src='content/images/koop_nu_je_dvd_h.jpg' ;
	}
}

function launchImageWin(imagesrc, omschrijving , width, height) {
	Y = screen.height/2 - height/2;
	X = screen.width/2 - width/2;
	str = "width=" + width + ",height=" + height + ",left=" + X + ",top=" + Y;
	imagealt = "Concordia Music Night " + " - " + omschrijving + ""

	popup = window.open("", "Image", 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1 ,' + str + '');
	popup.document.writeln("<html><head><title>" + imagealt +"</title></head>");
	popup.document.writeln("<body><img src=" + imagesrc + " width='100%' height='100%' border='0'></body>");
	popup.document.close();
	popup.focus();
}

function launchImageWin2(imagesrc, omschrijving , width, height) {
	Y = screen.height/2 - height/2;
	X = screen.width/2 - width/2;
	str = "width=" + width + ",height=" + height + ",left=" + X + ",top=" + Y;
	imagealt = "Concordia Music Night " + " - " + omschrijving + "";

	popup = window.open("", "Image", 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1 ,' + str + '');
	popup.document.writeln("<html><head><title>" + imagealt +"</title></head>");
	popup.document.writeln("<body><img src=" + imagesrc + " width='100%' border='0'></body>");
	popup.document.close();
	popup.focus();
}

function launchTekstWin(titel, tekst, width, height) {
	Y = screen.height/2 - height/2;
	X = screen.width/2 - width/2;
	str = "width=" + width + ",height=" + height + ",left=" + X + ",top=" + Y;
	titelbar = "Concordia Music Night " + " - " + titel + "";

	popup = window.open("", "Image", 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0 ,' + str + '');
	popup.document.writeln("<html><head><title>" + titelbar +"</title></head>");
	popup.document.writeln("<body><h3>" + titel + "</h3>" + tekst + "</body>");
	popup.document.close();
	popup.focus();
}

function launchHyperlinkWin(hyperlink) {
	Y = 0; 
	X = screen.width*4/10;
	width = screen.width - X;
	height = screen.height;
	str = "width=" + width + ",height=" + height + ",left=" + X + ",top=" + Y;

	popup = window.open(hyperlink, "Hyperlink", 'toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1 ,' + str + '');
}

function display_fotoboek_item(foto,titel,zichtbaar)
{
	var info = "" ;
	
	if (fotoboek_hoofdstuk <= (10-1) ) {
		info =  "<a href=\"content/fotos/" + fotoboek_folder + "/" + foto + ".jpg\"" +
				"rel=\"lightbox[fotoboek-" + fotoboek_hoofdstuk + "]\"" + 
				"title=\"" + titel +"\">" ;
				
		if (zichtbaar == 1)
		{
			fotoboek_foto++ ;
			if (((fotoboek_hoofdstuk <= (10-2) ) && (fotoboek_foto <= 6)) || ((fotoboek_hoofdstuk > (10-2) ) && (fotoboek_foto <= (10-1)))) {
				info = info + "<img class=\"fotobox1\" src=\"content/fotos/" + fotoboek_folder + "/thumbnails-small/" + foto + ".png\">";
			}
		}
		info = info + "</a>";

		window.document.write(info);
	} else {
		if ((zichtbaar == 1) && (fotoboek_foto == 0)) 
		{
			info =  "<h5>" + 
					"<a href=\"content/fotos/" + fotoboek_folder + "/" + foto + ".jpg\"" +
					"rel=\"lightbox[fotoboek-" + fotoboek_hoofdstuk + "]\"" + 
					"title=\"" + titel +"\">" + fotoboek_header + "</h5>" +
					"</a>";
			fotoboek_foto++ ;
		} else {
			info =  "<a href=\"content/fotos/" + fotoboek_folder + "/" + foto + ".jpg\"" +
					"rel=\"lightbox[fotoboek-" + fotoboek_hoofdstuk + "]\"" + 
					"title=\"" + titel +"\">" + 
					"</a>";
		}
		window.document.write(info);
	}
}

function display_fotoboek_item_jpg(foto,titel,zichtbaar)
{
	var info = "" ;
	
	if (fotoboek_hoofdstuk <= (10-1) ) {
		info =  "<a href=\"content/fotos/" + fotoboek_folder + "/" + foto + ".jpg\"" +
				"rel=\"lightbox[fotoboek-" + fotoboek_hoofdstuk + "]\"" + 
				"title=\"" + titel +"\">" ;
				
		if (zichtbaar == 1)
		{
			fotoboek_foto++ ;
			if (((fotoboek_hoofdstuk <= (10-2) ) && (fotoboek_foto <= 6)) || ((fotoboek_hoofdstuk > (10-2) ) && (fotoboek_foto <= (10-1)))) {
				info = info + "<img class=\"fotobox1\" src=\"content/fotos/" + fotoboek_folder + "/thumbnails-small/" + foto + ".jpg\">";
			}
		}
		info = info + "</a>";

		window.document.write(info);
	} else {
		if ((zichtbaar == 1) && (fotoboek_foto == 0)) 
		{
			info =  "<h5>" + 
					"<a href=\"content/fotos/" + fotoboek_folder + "/" + foto + ".jpg\"" +
					"rel=\"lightbox[fotoboek-" + fotoboek_hoofdstuk + "]\"" + 
					"title=\"" + titel +"\">" + fotoboek_header + "</h5>" +
					"</a>";
			fotoboek_foto++ ;
		} else {
			info =  "<a href=\"content/fotos/" + fotoboek_folder + "/" + foto + ".jpg\"" +
					"rel=\"lightbox[fotoboek-" + fotoboek_hoofdstuk + "]\"" + 
					"title=\"" + titel +"\">" + 
					"</a>";
		}
		window.document.write(info);
	}
}

function display_fotoboek_header(folder,header)
{
	var info = "" ;

	fotoboek_hoofdstuk++ ;
	fotoboek_folder = folder ;
	fotoboek_header = header ;
	fotoboek_foto = 0 ;
	info = "" ;
	
	if ((fotoboek_hoofdstuk % 2) == 1) {
		info = "<div class=normaal></div><div class=links>";
	} else {
		info = "<div class=rechts>";
	}
	
	if (fotoboek_hoofdstuk == 10) {
		info = info + "<h3>fotos<hr></h3>" ;
	}
	if (fotoboek_hoofdstuk  <= (10-1) ) {
		info = info + "<b>" + fotoboek_hoofdstuk + ")</b> " + header + "<br>";
	}

	window.document.write(info);
}

function display_fotoboek_footer()
{
	if (fotoboek_hoofdstuk <= (10-1) ) {
		info =  "<br></div>" ;
		window.document.write(info);
	}
}
