	if ( navigator.appVersion.indexOf("2.") != -1 ) check = false;
	if (( navigator.appVersion.indexOf("3.") != -1 ) && ( navigator.appName.indexOf("Explorer") != -1 )) check = false; else check = true;
	
	function money_format(amount) {
		var amount;
		amount = amount*100;
		amount = Math.round(amount);
		if ( isNaN(amount) )
			amount = 0.00;
		if ( amount > 99999999999 ) 
			return "NaN";
		
		cen = amount%100;
		if ( cen < 0 )
			cen = ".00";
		else if ( cen < 10 )
			cen = ".0" + cen;
		else if ( cen < 100 )
			cen = "." + cen;
		else
			cen = cen;
		
		amount = parseInt(amount/100);
		hun = amount - ( ( parseInt(amount/1000) ) * 1000 );
		if ( hun > 0 && hun < 1000 )
			hun = hun;
		else if ( hun == 0 && amount >= 1000 )
			hun = '000';
		else
			hun = '';
	
		amount = parseInt(amount/1000);
		tho = amount -( ( parseInt(amount/1000) ) * 1000 );
		if ( tho > 0 && tho < 1000 )
			tho = tho + ",";
		else if ( tho == 0 && amount >= 1000 )
			tho = '000,';
		else
			tho = '';
	
		amount = parseInt(amount/1000);
		mil = amount - ( ( parseInt(amount/1000) ) * 1000 );
		if ( mil > 0 && mil < 1000 )
			mil = mil + ",";
		else
			mil = '';
	
		return mil+tho+hun+cen;
	}
	
	function runBar(pos,len) {
		if ( pos == -1 ) { // stop running
			clearTimeout(timerID);
			return;
		}
		if ( pos == len ) {
			for ( x = 1; x <= len; x++ ) {
				$id('b'+x+'w').style.display = "";
				$id('b'+x+'f').style.display = "none";
			}
			timerID = setTimeout("runBar(0,"+len+")",500);
		}
		pos++;
		if ( $id('b'+pos+'w') )
			$id('b'+pos+'w').style.display = "none";
		if ( $id('b'+pos+'f') )
			$id('b'+pos+'f').style.display = "";
		timerID = setTimeout("runBar("+pos+","+len+")",500);
	}
	
	function writeBar(len){
		path = "http://"+top.location.host+"/ws/images/progressbar/";
		document.write('<img src="'+path+'pble.gif" id="b1w"><img src="'+path+'pblf.gif" id="b1f" style="display:none">');
		for ( x = 2; x < len; x++ )
			document.write('<img src="'+path+'pbme.gif" id="b'+x+'w"><img src="'+path+'pbmf.gif" id="b'+x+'f" style="display:none">');
		document.write('<img src="'+path+'pbre.gif" id="b'+len+'w"><img src="'+path+'pbrf.gif" id="b'+len+'f" style="display:none">');
	}
	
	function startVideo(lang,file,title) {
		if ( file ) window.open("http://www.nph.org/ws/about/showvideo.php?lang="+lang+"&vid="+file+"&ttl="+title+"&w=640&h=480","","toolbar=no,directories=no,location=no,status=yes,menubar=no,resizable=yes,scrollbars=no,width=680,height=590");
	}
	
	function isInteger(s) {
		return (s.toString().search(/^-?[0-9]+$/) == 0);
	}
	
	function validEmail(adr) {
		var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		return ( filter.test(adr) ? true : false );
	}
	
	function $id(id) {
		if ( document.getElementById(id) )
			return document.getElementById(id);
		else
			return false;
	}
	
	function $name(id) {
		if ( document.getElementsByName(id) )
			return document.getElementsByName(id);
		else
			return false;
	}
	
	function in_array (needle, haystack, argStrict) {
		var key = '', strict = !!argStrict;
		
		if ( strict ) {
			for ( key in haystack )
				if ( haystack[key] === needle )
					return true;
		} else {
			for ( key in haystack )
				if ( haystack[key] == needle )
					return true;
		}
		return false;
	}
	
	function changeLanguage() {
		setCookie('language-v2', document.langform.sellang.value, 1800);
		loc_href = document.langform.request_uri.value.replace('lang=xx','lang='+document.langform.sellang.value);
		top.location.href = loc_href;
	}
	
	function changeOrganization (protocol, subdomain) {
		top.location.href = protocol + "://" + subdomain + "." + document.langform.weborg.value;
	}
	
	function changeWebsiteType (protocol, subdomain, host, urlink) {
		top.location.href = protocol + "://" + subdomain + host + urlink;
	}
	
	function addSlashes(str) {
		return (str + '').replace(/[\\"']/g, '\\$&').replace(/\u0000/g, '\\0');
	}
	
	// blinking text script
	var i = 0;
	function Blink(layerID) {
		if ( i%2 == 0 )
			$id(layerID).style.visibility = "visible";
		else
			$id(layerID).style.visibility = "hidden";
		if ( i < 1 ) {
			i++;
			setTimeout("Blink('"+layerID+"')",600);
		} else {
			i--;
			setTimeout("Blink('"+layerID+"')",200);
		}
	}
	
	function showStats() {
		var stats = $id('webstats');
		if ( stats.style.display == '' )
			stats.style.display = "none";
		else
			stats.style.display = "";
		window.scrollBy(0,200);
	}
	
	function writeFlatMenu() {
		stretch = 8;
		lastcol = $id('flatmenu').innerHTML;
		menu = '<table width="90%"><tr><td valign="top"><table cellspacing="' + stretch + '">';
		navboxtitle = "";
		navboxlinks = "";
		
		for ( x = 1; x < NoOffFirstLineMenus; x++  ) {
			mnulnk = eval("Menu"+x+"[1]");
			mnutxt = eval("Menu"+x+"[0]");
			mnuhil = eval("Menu"+x+"[6]") == '#FF6600' ? true : false;
			msubnr = eval("Menu"+x+"[3]");
			
			menu += '<tr><td class="footmenuheader">';
			menu += mnulnk ? '<a href="' + mnulnk + '" class="' + ( mnuhil ? 'footerselected' : 'footer' ) + '">' + mnutxt + '</a>' : mnutxt;
			menu += '</td></tr>';
			
			if ( $id('navbox') && SetMenu == x ) {
				navboxtitle = mnutxt;
				navboxlinks = '<ul>';
			}
			
			for ( y = 1; y < msubnr; y++ ) {
				mnulnk = eval("Menu"+x+"_"+y+"[1]");
				mnutxt = eval("Menu"+x+"_"+y+"[0]");
				mnuhil = eval("Menu"+x+"_"+y+"[6]") == '#FF6600' ? true : false;
				
				if ( mnulnk ) {
					menu += '<tr><td class="footmenu"><a href="' + mnulnk + '" class="' + ( mnuhil ? 'footerselected' : 'footer' ) + '">' + mnutxt + '</a></td></tr>';
					if ( $id('navbox') && SetMenu == x )
						navboxlinks += '<li class="' + ( mnuhil ? 'red' : 'white' ) + '"><a href="' + mnulnk + '" class="white">' + mnutxt + '</a></li>';
				}
			}
			
			if ( msubnr > 0 && x < NoOffFirstLineMenus-1 )
				menu += '</table></td><td valign="top"><table cellspacing="' + stretch + '">';
		}
		
		menu += lastcol + '</tr></table>';
		
		if ( $id('navbox') ) {
			navboxlinks += '</ul>';
			$id('navbox_title').innerHTML = navboxtitle;
			$id('navbox_links').innerHTML = navboxlinks;
		}
		
		$id('flatmenu').innerHTML = menu;
		
		if ( $id('howtohelpbox') )
			writeHowToHelpBox();
	}
	
	function writeHowToHelpBox() {
		menu = '<ul>';
		msubnr = eval("Menu5[3]");
		
		for ( x = 1; x < msubnr; x++  ) {
			mnulnk = eval("Menu5_"+x+"[1]");
			mnutxt = eval("Menu5_"+x+"[0]");
			mnuhil = eval("Menu5_"+x+"[6]") == '#FF6600' ? true : false;
			
			menu += '<li class="' + ( mnuhil ? 'red' : 'white' ) + '">';
			menu += '<a href="' + mnulnk + '" class="white">' + mnutxt + '</a>';
			menu += '</li>';
		}
		
		menu += '</ul>';
		
		$id('howtohelpbox').innerHTML = menu;
	}
	
	function writeMobileMenu() {
		menu = '<br><table class="mobmen" align="center">';
		
		for ( x = 1; x < NoOffFirstLineMenus; x++  ) {
			mnulnk = eval("Menu"+x+"[1]");
			mnutxt = eval("Menu"+x+"[0]");
			msubnr = eval("Menu"+x+"[3]");
			mnuid = mnutxt.replace(/ /g,"_");
			
			if ( typeof SetMenu == 'undefined' )
				mnuhil = false;
			else
				mnuhil = SetMenu == x ? true : false;
			
			menu += '<tr onClick="'+( mnulnk ? 'gotoLink(\''+mnulnk+'\')' : 'openMobMenu(\''+mnutxt+'\')' )+'">'
						+'<td class="mobmen'+( mnuhil ? "sel" : "" )+'" id="'+mnuid+'">'+mnutxt+'</td>'
						+'<td class="mobmen'+( mnuhil ? "sel" : "" )+'" align="center" id="mp-'+mnutxt+'">&gt;</td>'
					+'</tr>'
					+'<tr id="mm-'+mnutxt+'" style="display:none">'
						+'<td colspan="2" align="center">'
							+'<table class="mobsubmen">';
			
			for ( y = 1; y < msubnr; y++ ) {
				mnulnk = eval("Menu"+x+"_"+y+"[1]");
				mnutxt = eval("Menu"+x+"_"+y+"[0]");
				mnuhil = eval("Menu"+x+"_"+y+"[6]") == '#FF6600' ? true : false;
				
				if ( mnulnk )
					menu += '<tr><td class="mobsubmen'+( mnuhil ? "sel" : "" )+'" onClick="gotoLink(\''+mnulnk+'\',\''+mnutxt+'\')" id="submen-'+mnutxt+'">'+mnutxt+'</td></tr>';
			}
			
			if ( msubnr > 0 && x < NoOffFirstLineMenus-1 )
				menu += '</table></td></tr>';
		}
		
		menu += '</table><br>';
		
		$id('mcontab').innerHTML = menu;
	}
	
	function closeMobMenu() {
		for ( x = 1; x < NoOffFirstLineMenus; x++  ) {
			mnutxt = eval("Menu"+x+"[0]");
			if ( $id('mp-'+mnutxt).innerHTML == 'V' ) {
				$id('mm-'+mnutxt).style.display = "none";
				$id('mp-'+mnutxt).innerHTML = "&gt;";
			}
		}
	}
	
	function scrollUp() {
		setTimeout(function() { window.scrollTo(0,1) }, 100);
	}
	
	function showMobContent() {
		$id('msrctab').style.display = "none";
		if ( $id('mcontab').style.display == '' )
			closeMobMenu();
		$id('mcontab').style.display = $id('mcontab').style.display == 'none' ? "" : "none";
	}
	
	function showMobSearch() {
		closeMobMenu();
		$id('mcontab').style.display = "none";
		$id('msrctab').style.display = $id('msrctab').style.display == 'none' ? "" : "none";
		if ( $id('msrctab').style.display == '' )
			$id('q').focus();
	}
	
	function openMobMenu(id) {
		var openmenu = $id('mm-'+id).style.display == '' ? false : true;
		closeMobMenu();
		if ( openmenu ) {
			$id('mm-'+id).style.display = "";
			$id('mp-'+id).innerHTML = "V";
			//window.location.hash = id;
			mnuid = id.replace(/ /g,"_");
			goToByScroll(mnuid);
		}
	}
	
	function gotoLink(lnk,mnutxt) {
		$id('submen-'+mnutxt).className = "mobsubmensel";
		self.location.href = "http://"+window.location.hostname+"/ws/"+lnk;
	}
	
	function goToByScroll(id) { // jQuery
		$('html,body').animate({scrollTop: $("#"+id).offset().top},'slow');
	}
	
	function wait(ms) {
		var start = new Date().getTime();
		var cur = start;
		while ( cur - start < ms )
			cur = new Date().getTime(); 
	}

