//  Browser detection
var nVer = navigator.appVersion;
var nAgt = navigator.userAgent;
var browserName  = navigator.appName;
var fullVersion  = ''+parseFloat(navigator.appVersion); 
var majorVersion = parseInt(navigator.appVersion,10);
var nameOffset,verOffset,ix;

// In MSIE, the true version is after "MSIE" in userAgent
if ((verOffset=nAgt.indexOf("MSIE"))!=-1) 
	{
	browserName = "Microsoft Internet Explorer";
	}
// In Opera, the true version is after "Opera" 
else if ((verOffset=nAgt.indexOf("Opera"))!=-1)
	{
	browserName = "Opera";
	}
// In Chrome, the true version is after "Chrome" 
else if ((verOffset=nAgt.indexOf("Chrome"))!=-1)
	{
	browserName = "Chrome";
	}
// In Safari, the true version is after "Safari" 
else if ((verOffset=nAgt.indexOf("Safari"))!=-1)
	{
	browserName = "Safari";
	}
// In Firefox, the true version is after "Firefox" 
else if ((verOffset=nAgt.indexOf("Firefox"))!=-1)
	{
	browserName = "Firefox";
	}
// In most other browsers, "name/version" is at the end of userAgent 
else if ( (nameOffset=nAgt.lastIndexOf(' ')+1) < (verOffset=nAgt.lastIndexOf('/')) ) 
	{
	browserName = nAgt.substring(nameOffset,verOffset);
	if (browserName.toLowerCase()==browserName.toUpperCase()) 
		{
		browserName = navigator.appName;
		}
	}


//	Select browser dependend style sheet
	document.writeln ("<link rel='stylesheet' type='text/css' href='css/munten.css'/>");
	switch (browserName)
		{
		case "Firefox":
			document.writeln ("<link rel='stylesheet' type='text/css' href='css/munten_firefox.css'/>");
		break;
		case "Opera":
			document.writeln ("<link rel='stylesheet' type='text/css' href='css/munten_opera.css'/>");
		break;
		case "Safari":
			document.writeln ("<link rel='stylesheet' type='text/css' href='css/munten_safari.css'/>");
		break;
		case "Chrome":
			document.writeln ("<link rel='stylesheet' type='text/css' href='css/munten_firefox.css'/>");
		break;
		case "Microsoft Internet Explorer":
		default: 
			document.writeln ("<link rel='stylesheet' type='text/css' href='css/munten_ie8.css'/>");
		break;
		}
		
//  Bookmark my homepage
	var bookmarkurl="http://www.rx-webdesign.nl/munten/"
	var bookmarktitle="Erik Coin Collectors page"
	function bookmark() 
		{ 
		if (document.all) //ie
			window.external.AddFavorite(bookmarkurl,bookmarktitle)
		else 
			if (window.sidebar) // firefox
				window.sidebar.addPanel(bookmarktitle, bookmarkurl, "");
//			else 
//				if (window.opera && window.print) //opera
//				    window.external.AddFavorite(bookmarkurl, bookmarktitle) 
//					{
//					document.write(bookmarktitle);
//				    var elem = document.createElement('a');
//				    elem.setAttribute('href',bookmarkurl);
//				    elem.setAttribute('title',bookmarktitle);
//				    elem.setAttribute('rel','sidebar');
//				    elem.click();
//				    }
//				    alert('Opera does not support this function. Please press Ctrl-D to add this page to your bookmarks'); 
				else 
				    alert('Your browser does not support this function. Please press Ctrl-D to add this page to your bookmarks'); 
		}
			
			
//	Disable right mouse click
			function no_rightclick(e)
			{
				if ((document.layers||document.getElementById&&!document.all) && (e.which==2||e.which==3))
				{
				alert_message()
				return false;
				}
			}
			if (document.layers)
				{
				document.captureEvents(Event.MOUSEDOWN);
				document.onmousedown=no_rightclick;
				}	
			document.oncontextmenu=new Function("alert_message();return false");


// Set alert message box when right mouse is clicked
	function alert_message()			
		{
		switch(pagelanguage)
			{
			case "uk":
				alert('This function is disabled by RX-Webdesign');
				break;
			case "nl":
				alert('Deze functie is uitgeschakeld door RX-Webdesign');
				break;
			case "uknl":
				alert('This function is disabled by RX-Webdesign / Deze functie is uitgeschakeld door RX-Webdesign');
				break;
			default:
				alert('This function is disabled by RX-Webdesign / Deze functie is uitgeschakeld door RX-Webdesign');
			}	
		}


// Functions for dropdown menus
	function visiblemenu(elmnt)
	  {
	  document.getElementById(elmnt).style.visibility="visible";
	  }
	function hidemenu(elmnt)
	  {
	  document.getElementById(elmnt).style.visibility="hidden";
	  }


// Set background sounds for lists with duplicates coins
//	if (pagetype == 1) 
//		{
//		if (destination == "dubbelen")
//			{
//			document.writeln("<bgsound src='sound/money.mid' loop=0>")
//			}
//		}

		
//	Goto top of the page
	function GotoTop(theUrl, windowprops)
		{
		var popup = window.open(theUrl, destination);
		}

		
// Sets background image		
	function SetBackGround(bg_img)
			{
			document.body.style.backgroundImage="url('graphics/" + bg_img + ".gif')";

			}

//  Date last modified
	function file_modified_date(filedate)
		{
		var LastModDate = new Date(filedate);
		switch (pagetype)
			{
			case 1:
				document.write("<span id='tekst3'>");
			break;
			case 6:
				document.write("<span id='tekst3rood'>");  
			break;
			default:
				document.write("<span id='tekst3rood'>");
			}
		switch(pagelanguage)
			{
			case "uk":
			case "uknl":
				function initArray()
					{
					this.length = initArray.arguments.length;
					for (var i = 0; i < this.length; i++)
						this[i+1] = initArray.arguments[i];
					}
					var MOYArray = new initArray("January","February","March","April","May","June","July","August","September","October","November","December");
//					var LastModDate = new Date(filedate);
					document.write("Last update: ");
					switch (pagetype)
						{
						case 0:
						break;
						default:
							document.write("<br />"); 
						}	
					document.write(MOYArray[(LastModDate.getMonth()+1)]," ");
					document.write(LastModDate.getDate(),", ",(LastModDate.getFullYear()));
					document.write(".");
				break;
			case "nl":
			    function initArray()
			        {
					this.length = initArray.arguments.length;
						for (var i = 0; i < this.length; i++)
							this[i+1] = initArray.arguments[i];
					}
					var MOYArray = new initArray("januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december");
//					var LastModDate = new Date(filedate);
					document.write("Laatste update: ");
					switch (pagetype)
						{
						case 0:
						break;
						default:
							document.write("<br />"); 
						}
					document.write(LastModDate.getDate()," ");
					document.write(MOYArray[(LastModDate.getMonth()+1)]," ");
					document.write(LastModDate.getFullYear());
					document.write(".");
					break;
			}
		document.write("</span>");
		}

	
//  Jump to named tag in list
	function jmp(newLoc, windowprops)
		{
		var country = newLoc.options[newLoc.selectedIndex].value;
		var popup = window.open(country, destination);
		}


//  Open pop-up window with additional info or image		
	function detail_view(link) 
		{
		var type  = link.slice(0,1);
		var image = link.slice(2)
		var size  = "";
		switch (type)
			{
			case "1": //euro preview
				size = 'width=120,height=120,top=0,left=0';
				link = 'detail_view.htm#1' + image;
			break;
			case "2": // nl preview
				size = 'width=560,height=230,top=0,left=0';
				link = 'detail_view.htm#2' + image;
			break;
			case "3": // nat preview
				size = 'width=500,height=500,top=0,left=0';
				link = 'detail_view.htm#3' + image;
			break;
			case "4": // preselectio
				size = 'width=620,height=125,top=0,left=0';
				link = 'detail_view.htm#4' + image;
			break;
			case "uk_era": // era
			case "nl_era": // era
				size = 'height=180,width=480,top=0,left=0';
			break;
			default:
				size = 'height=100,width=100,top=0,left=0';
				link = '';
			break;
			}
			var bookWindow = window.open(link, "new1", size);
			if (bookWindow.open) 
				{
				bookWindow.close;
				}
			}


//  Display disclaimer
	function disclaimer()
		{
		document.write("<span id='tekst3rood'>");
		switch(pagelanguage)
			{
			case "uk":
			case "uknl":
				document.write("Disclaimer: All hyperlinks on this page are checked before they were placed. However I can not except any liability for their proper functioning or the content of the related websites.");
			break;
			case "nl":	
				document.write("Disclaimer: Alle links op deze pagina zijn gecontroleerd voordat zij vermeld werden. Ik aanvaard echter geen aansprakelijkheid voor de werking of de inhoud van de betreffende sites.");
				break;
			}	
		document.write("</span>");
		}



//	Link page header
	function linkpage_header(header_label)
		{
		document.write("<tr><td class='pagina_rij1'>");
		document.write("<table class='links_header'><tr><td class='header_links>");
		file_modified_date(document.lastModified);
		document.write("</td><td class='header_midden'>");
		document.write("<span id='tekst1rood'>");
		document.write(header_label);
		document.write("</span></td><td class='header_rechts'>&nbsp;</td></tr></table>");
		disclaimer();
		document.write("</td></tr>");
		}
		
		
//  Display page header
	function display_header(header_label_1, header_label_2, page_language)
		{
		document.write  ("<tr><td class='pagina_rij1'>");
		document.write  ("<table class='links_header' border=0>");
		document.write  ("<tr><td class='header_links'><span id='tekst3rood'>");
		file_modified_date(document.lastModified);
		document.write  ("</span></td><td class='header_midden'><span id='tekst1rood'>");
		document.write  (header_label_1);
		if (header_label_2 == "disclaimer")
			{
			document.write("<br />");
			disclaimer();
			header_label_2 = ""			;
			}
		document.write  ("</span></td><td class='header_rechts'>");
		document.write  (header_label_2);
		document.write  ("</td></tr></table></td></tr>");
		}


// Display right part of duplicates header
	function display_duplicates_header(TopOfPage, pagelanguage)
		{
		filename = "excelfiles/"+TopOfPage.slice(0,TopOfPage.indexOf(".htm"))+".xls";
		switch(pagelanguage)
			{
			case "uk":
				download = "Download as Excel file";
				monitor  = "Monitor this page for changes";
				button   = "Monitor changes";
				images   = "Download overview of images";
			break;
			case "nl":
				download = "Download als Excel bestand";
				monitor  = "Monitor deze pagina voor wijzigingen";
				button   = "Monitor wijzigingen";
				images   = "Download afbeeldingen";
			break;
			}
		document.writeln("<td class='header2' rowspan='3'>");
		file_modified_date(document.lastModified);
		if (TopOfPage.slice(0,TopOfPage.indexOf(".htm")) == "tokens")
			{
			document.writeln("</td><td class='header3' rowspan='3'>");
			document.writeln("<table><tr>");
			document.writeln("<td align='center' valign='top'><a target='_new' href="+filename+"><img src='graphics/excel.gif' alt='"+download+"'></a>");
			document.writeln("<span id='tekst3'>"+download+"</span></td>");
			document.writeln("<td align='center' valign='top'><a target='_new' href='graphics/tokens/tokens.jpg'><img src='graphics/images.jpg' alt='"+images+"'></a>");
			document.writeln("<span id='tekst3'>"+images+"</span></td>");
			document.writeln("</tr></table>");
			}
//		if (TopOfPage.slice(0,TopOfPage.indexOf(".htm")) == "tokens")
		else
			{
			document.writeln("</td><td class='header3' rowspan='3'><a target='_new' href="+filename+"><img src='graphics/excel.gif' alt='"+download+"'></a>");
			document.writeln("<br /><span id='tekst3'>"+download+"</span>");
			}
		document.writeln("</td><td class='header4'>");
//      <!-- Begin ChangeDetection.com Panel HTML -->
		document.writeln("<!-- ChangeDetection.com id=d8jkmqzvdq -->");
		document.writeln("<span id='tekst3'>"+monitor+"</span></td></tr>");
		document.writeln("<tr><td class='header4'><form action='http://www.ChangeDetection.com/detect.html' method='get' target=ChangeDetectionWiz>");
		document.writeln("<input type='submit' name='enter' value='"+button+"' onclick='window.open('','ChangeDetectionWiz','resizable=yes,scrollbars=yes,width=624,height=460');return true'>");
		document.writeln("</td></tr>");
		document.writeln("<tr><td class='header4'><span id='tekst3'>");
		document.writeln("<a href='http://www.ChangeDetection.com/privacy.html' target=ChangeDetectionPrivacy onclick='window.open('http://www.ChangeDetection.com/privacy.html', 'ChangeDetectionPrivacy', 'resizable=yes,scrollbars=yes,width=624,height=400');return false'>");
		document.write   ("it's private");
		document.writeln("</a>&nbsp;by&nbsp;<a href='http://www.ChangeDetection.com/' target=_blank>ChangeDetection</a></span></td></tr></form>");
//      <!-- End ChangeDetection.com Panel HTML -->
		document.writeln ("</tr></table>");
		} 

//  Display page header and body
	function display_header_body(TopOfPage)
		{
		document.writeln("<tr><td class='pagina_rij1'  style='height: 530px'>");
		document.writeln("<iframe class='midden' allowtransparency='1' frameborder='0' name='header' scrolling='no' target='inhoud'");
		document.writeln("src=" + TopOfPage.slice(0,TopOfPage.indexOf("#"))+ ">");
		document.writeln("</iframe>");
		document.writeln("</td></tr>");
		}
		
		
//  Display page body
	function display_body(TopOfPage)
		{
		document.writeln("<tr><td class='pagina_rij2'>");
		document.writeln("<iframe class='midden' allowtransparency='1' frameborder='0' name='dubbelen' scrolling='auto' target='inhoud'");
		document.writeln("src=" + TopOfPage.slice(0,TopOfPage.indexOf("#"))+ ">");
		document.writeln("</iframe>");
		document.writeln("</td></tr>");
		}
		
		
//  Display buttons
	function display_buttons(pagelanguage)
		{
		document.writeln("<tr><td class='pagina_rij3'>");
		document.writeln("<iframe class='onder' allowtransparency='1' frameborder='0' name='knoppen' scrolling='no'");
		switch(pagelanguage)
			{
			case "uknl":
			case "uk":
				document.writeln("src='buttons.htm'");
			break;
			case "nl":
				document.writeln("src='knoppen.htm'");
			break;
			}
		document.writeln("target='inhoud'></iframe></td></tr>");
		}
		
		
// Display Euro commemoratives overview		
	function display_comm_overview()
		{
		coin_data = coin_data.sort()
		for (i=0;i<coin_data.length;i++)
			{
			document.write("<tr>");
       		document.write("<td class='eurocomm1' height='100'>"+ coin_data[i][0] + "</td>");
			for (j=1;j<coin_data[i].length;j++)
				{
				if ( coin_data[i][j] == "&nbsp")
					{
	       			document.write("<td class='eurocomm2'>" + coin_data[i][j] + "</td>");
					}
				else
					{	
	       			if (coin_data[i][j].indexOf("|") > -1)
	       				{
	       				if (coin_data[i][j].indexOf("|") == 0)
	       					{
	       					document.write("<td class='eurocomm3' style='text-align:right'>");
	       					}
	       				else
	       					{	
	       					document.write("<td class='eurocomm3'>");
	       					document.write("<img src='graphics/commemoratives/" + coin_data[i][j].substr(0,coin_data[i][j].indexOf("|")) + "'>") ;
	       					}
	       				document.write("<img src='graphics/commemoratives/" + coin_data[i][j].substr(coin_data[i][j].indexOf("|")+1) + "'>") ;
	       				document.write("</td>");
	       				}
	       			else
	       				{
	       				document.write("<td class='eurocomm2'><img src='graphics/commemoratives/"+ coin_data[i][j] + "'></td>");
	       				}
	       			}
	       		}
       		document.write("</tr>");
			}
		}

