//p = "../../";
	p = "";

	var popUpUrlArray = new Array(0);
	var popUpWidthArray = new Array(0);
	var popUpHeightArray = new Array(0);

function showPopUp() {
	var n = getRandomNumber();
	//alert("n: "+n);
	if( n == -1 ){
		return;
	}
	if( document.location.href.indexOf("general/home/index_en") == -1 ){
		return;
	}
	var now = new Date();
	var lastShown = getLastPopUpShowTime();

	//alert("now: "+now.getDate());
	//alert("lastShown: "+lastShown);
	if(now.getDate() != lastShown){
 		var end = new Date(now.getTime() + 1000*60*60*24*365);
 		document.cookie = "popupshowtime="+now+"; expires="+end.toGMTString()+";";
		openPopUp(popUpUrlArray[n],popUpWidthArray[n],popUpHeightArray[n]);
	}
}

function getRandomNumber(){
	if(popUpUrlArray && popUpUrlArray.length > 0){
		x = Math.round(Math.random() * popUpUrlArray.length) - 1;
		if(x <0){
			x=0;
		}
		return x;
	}else{
		return -1;
	}
}

function getLastPopUpShowTime(n) {
 	var d = "";
 	if(document.cookie) {
 	var start = document.cookie.indexOf("=") + 1;
 	var end = document.cookie.indexOf(";");
 	if (end == -1)
 		end = document.cookie.length;
 		d = new Date(document.cookie.substring(start,end)).getDate();

 	}
 	return d;
}

function check()
{
	checkBrowserVer('','older_browser.html');
	MM_checkPlugin('Shockwave Flash','','no_flash.html',true);
}

function preLoad (imgfile)
{
	Cache = new Image();
	eval ("Cache.src = \"" + p + "img/" + imgfile+"\"");
}

function init()
{
	NS4 = (document.layers);
	IE4 = (document.all);
	nummenus = 11;
	NS4 = (document.layers);
	IE4 = (document.all);

 if (NS4)
		{
			widthCheck = window.innerWidth;
			heightCheck = window.innerHeight;
			window.onResize = resizeFix;
 }

	/*preLoad ('void_uv.gif');
	preLoad ('go_on_uv.gif');
	preLoad ('go2_on_uv.gif');
	preLoad ('n_adv_search_on_en.gif');*/

	showPopUp();
}

function resizeFix()
{
	if (widthCheck != window.innerWidth || heightCheck != window.innerHeight)
	self.location.reload();
}

function SwitchImage(imgSource,imgName)
{
	if (document.images[imgName])
	{
		document.images[imgName].src = imgSource;
		return true;
	}
}

function checkBrowserVer(four,notfour)
{
	if (navigator.appVersion.indexOf('4.') != -1)
	{
		if (four) location.href = four;
	}
	else
	{
		if (notfour) location.href = p + notfour;
	}
}

function MM_checkPlugin(plugin, theURL, altURL, IEGoesToURL)
{ //v2.0
	if ((navigator.plugins && navigator.plugins[plugin]) || //if NS, or
	(IEGoesToURL && //if flag set, and MSIE browser for Win95/NT (ActiveX)
	navigator.appName.indexOf('Microsoft') != -1 &&
	navigator.appVersion.indexOf('Mac') == -1 &&
	navigator.appVersion.indexOf('3.1') == -1))
	{
		if (theURL.length>2) window.location = theURL;
	}
	else
	{
		if (altURL.length>2) window.location = altURL;
	}
	document.MM_returnValue = false;
}

function checkIt()
{
	if (navigator.appVersion.indexOf("(X11") != -1 || navigator.appVersion.indexOf("(Mac") != -1) return 1
 else return 0
}

function closed()
{
	return true;
}

// var checkOpenWindow = false;

function openMiniWin(src,type) {
 switch (type) {
 case "1": {
 H = 350;
 W = 420;
 break;
 }
 case "2": {
 H = 380;
 W = 650;
 break;
 }
 case "3": {
 H = 460;
 W = 650;
 break;
 }
 case "4": {
 H = 460;
 W = 550;
 break;
 }
 case "5": {
 H = 570;
 W = 650;
 break;
 }
 case "6": {
 H = 570;
 W = 800;
 break;
 }
 case "7": {
 H = 600;
 W = 480;
 break;
 }
 case "8": {
 H = 440;
 W = 680;
 break;
 }
 case "9": {
 H = 600;
 W = 550;
 break;
 }
 case "10": {
 H = 600;
 W = 680;
 break;
 }
 }
// alert(MiniWin);
// if (checkOpenWindow==true) MiniWin.close();
// else checkOpenWindow = true;
 MiniWin=window.open( src , 'toolbar','toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=no,width='+W+',height='+H);
}

function openMiniWin2(src,W,H) {
 MiniWin=window.open( src , 'toolbar','toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=no,width='+W+',height='+H);
}

function openMiniWin3(src,W,H) {
 MiniWin=window.open( src , 'toolbar','toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=no,resizable=no,copyhistory=no,width='+W+',height='+H);
}
function openMiniWinStandard(src,W,H)
{
	MiniWin=window.open( src ,'toolbar','toolbar=no,location=no,directories=no,status=yes,menubar=yes,scrollbars=no,resizable=yes,copyhistory=no,width='+W+',height='+H);
}

function openMiniWinStanAdv(src,W,H)
{
	if (document.all && document.styleSheets)
	{
		H = H -19;
	}
	MiniWin=window.open( src ,'toolbar','toolbar=no,location=no,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=no,left=0,top=0,screenX=0,screenY=0,width='+W+',height='+H);
}

function openPopUp(src,W,H)
{
	if (document.all && document.styleSheets)
	{
		H = H -19;
	}
	MiniWin=window.open( src ,'toolbar','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no,copyhistory=no,left=0,top=0,screenX=0,screenY=0,width='+W+',height='+H);
}

function quickCheck(form, pos)
{
	if (form.elements[pos].value == "")
	{
		alert ("Please enter a search query!");
		form.elements[pos].focus();
	}
	else
		form.submit();
}

function showPDF(u1, u2) {
	var pdfUrl = u1 + ';' + u2;
	window.open(pdfUrl);
}
