	function highlight(td, prefix, i) {
		var IE = document.all ? 1 : 0;
		var ns = document.layers ? 1 : 0;
		var agent=navigator.userAgent;
		var opera=agent.indexOf("Opera")>-1;

		if (prefix) {
			if (IE && !opera){
				var country_h = document.all["country"+prefix+"_h"+i];
				country_h.style.display = "block";
				var country = document.all["country"+prefix+i];
				country.style.display = "none";
				td.style.cursor = "hand";
			} else if (ns) {
				var country_h = document.layers["country"+prefix+"_h"+i];
				country_h.display = "block";
				var country = document.layers["country"+prefix+i];
				country.display = "none";
				td.style.cursor = "pointer";
			} else {
				var country_h = document.getElementById("country"+prefix+"_h"+i);
				country_h.style.display = "block";
				var country = document.getElementById("country"+prefix+i);
				country.style.display = "none";
				td.style.cursor = "hand";
			}
		} else {
			if (IE && !opera){
				var cont_h = document.all["cont_h"+i];
				cont_h.style.display = "block";
				var cont = document.all["cont"+i];
				cont.style.display = "none";
				td.style.cursor = "hand";
			} else if (ns) {
				var cont_h = document.layers["cont_h"+i];
				cont_h.display = "block";
				var cont = document.layers["cont"+i];
				cont.display = "none";
				td.style.cursor = "pointer";
			} else {
				var cont_h = document.getElementById("cont_h"+i);
				cont_h.style.display = "block";
				var cont = document.getElementById("cont"+i);
				cont.style.display = "none";
				td.style.cursor = "hand";
			}
		}
	}

	function unhighlight(td, prefix, i) {
		var IE = document.all ? 1 : 0;
		var ns = document.layers ? 1 : 0;
		var agent=navigator.userAgent;
		var opera=agent.indexOf("Opera")>-1;

		if (prefix) {
			if (IE && !opera){
				var country_h = document.all["country"+prefix+"_h"+i];
				country_h.style.display = "none";
				var country = document.all["country"+prefix+i];
				country.style.display = "block";
			} else if (ns) {
				var country_h = document.layers["country"+prefix+"_h"+i];
				country_h.display = "none";
				var country = document.layers["country"+prefix+i];
				country.display = "block";
			} else {
				var country_h = document.getElementById("country"+prefix+"_h"+i);
				country_h.style.display = "none";
				var country = document.getElementById("country"+prefix+i);
				country.style.display = "block";
			}
			td.style.borderBottom = "dashed #808080 1px";
		} else {
			if (IE && !opera){
				var country_h = document.all["cont_h"+i];
				country_h.style.display = "none";
				var country = document.all["cont"+i];
				country.style.display = "block";
			} else if (ns) {
				var country_h = document.layers["cont_h"+i];
				country_h.display = "none";
				var country = document.layers["cont"+i];
				country.display = "block";
			} else {
				var country_h = document.getElementById("cont_h"+i);
				country_h.style.display = "none";
				var country = document.getElementById("cont"+i);
				country.style.display = "block";
			}
		}
	}

	function highlightMenu(block) {
		var IE = document.all ? 1 : 0;
		var ns = document.layers ? 1 : 0;
		var agent=navigator.userAgent;
		var opera=agent.indexOf("Opera")>-1;

		if (block==1) {
			if (IE && !opera){
				var map1 = document.all["map1"];
				map1.style.display = "block";
				var map2 = document.all["map2"];
				map2.style.display = "none";
				var td = document.all["menu2"];
				td.style.cursor = "hand";
			} else if (ns) {
				var map1 = document.layers["map1"];
				map1.display = "block";
				var map2 = document.layers["map2"];
				map2.display = "none";
				var td = document.layers["menu2"];
				td.style.cursor = "pointer";
			} else {
				var map1 = document.getElementById("map1");
				map1.style.display = "block";
				var map2 = document.getElementById("map2");
				map2.style.display = "none";
				var td = document.getElementById("menu2");
				td.style.cursor = "hand";
			}

		} else {
			if (IE && !opera){
				var list1 = document.all["list1"];
				list1.style.display = "block";
				var list2 = document.all["list2"];
				list2.style.display = "none";
				var td = document.all["menu1"];
				td.style.cursor = "hand";
			} else if (ns) {
				var list1 = document.layers["list1"];
				list1.display = "block";
				var list2 = document.layers["list2"];
				list2.display = "none";
				var td = document.layers["menu1"];
				td.style.cursor = "pointer";
			} else {
				var list1 = document.getElementById("list1");
				list1.style.display = "block";
				var list2 = document.getElementById("list2");
				list2.style.display = "none";
				var td = document.getElementById("menu1");
				td.style.cursor = "hand";
			}

		}
		unhighlightMenu(block%2+1);
	}

	function unhighlightMenu(block) {
		var IE = document.all ? 1 : 0;
		var ns = document.layers ? 1 : 0;
		var agent=navigator.userAgent;
		var opera=agent.indexOf("Opera")>-1;

		if (block==1) {
			if (IE && !opera){
				var map1 = document.all["map1"];
				map1.style.display = "none";
				var map2 = document.all["map2"];
				map2.style.display = "block";
			} else if (ns) {
				var map1 = document.layers["map1"];
				map1.display = "none";
				var map2 = document.layers["map2"];
				map2.display = "block";
			} else {
				var map1 = document.getElementById("map1");
				map1.style.display = "none";
				var map2 = document.getElementById("map2");
				map2.style.display = "block";
			}
		} else {
			if (IE && !opera){
				var list1 = document.all["list1"];
				list1.style.display = "none";
				var list2 = document.all["list2"];
				list2.style.display = "block";
			} else if (ns) {
				var list1 = document.layers["list1"];
				list1.display = "none";
				var list2 = document.layers["list2"];
				list2.display = "block";
			} else {
				var list1 = document.getElementById("list1");
				list1.style.display = "none";
				var list2 = document.getElementById("list2");
				list2.style.display = "block";
			}
		}
	}

	function showBlock(id) {
		var IE = document.all ? 1 : 0;
		var ns = document.layers ? 1 : 0;
		var agent=navigator.userAgent;
		var opera=agent.indexOf("Opera")>-1;

		hideLayer();
		highlightMenu(id);
		if (IE && !opera){
			document.all["block"+id].style.display = "block";
			document.all["block"+(id%2+1)].style.display = "none";
		} else if (ns) {
			document.layers["block"+id].display = "block";
			document.layers["block"+(id%2+1)].display = "none";
		} else {
			document.getElementById("block"+id).style.display = "block";
			document.getElementById("block"+(id%2+1)).style.display = "none";
		}
	}

	function setPos() {
		var IE = document.all ? 1 : 0;
		var ns = document.layers ? 1 : 0;
		var agent=navigator.userAgent;
		var opera=agent.indexOf("Opera")>-1;
		var mozilla=agent.indexOf("Mozilla")>-1;

		if (IE && !opera){
			x = findPosX(document.all['flash_id']);
			y = findPosY(document.all['flash_id']);
			var flag = document.all["block2"];
			if (flag && (flag.style.display=="block")) {
				x = findPosX(document.all['anotherpos']);
				y = findPosY(document.all['anotherpos']);
			}
		} else if (ns) {
			x = findPosX(document.layers['flash_id']);
			y = findPosY(document.layers['flash_id']);
			if ((x==0) || (y==0)) {
				x = findPosX(document.layers['anotherpos']);
				y = findPosY(document.layers['anotherpos']);
			}
		} else if (mozilla) {
			x = findPosX(document.getElementById('flash_id'));
			y = findPosY(document.getElementById('flash_id'));
			if ((x==0) || (y==0)) {
				x = findPosX(document.getElementById('anotherpos'))+4;
				y = findPosY(document.getElementById('anotherpos'));
			}
			x = x+'px'; y = y+'px';
		} else {
			x = findPosX(document.getElementById('flash_id'));
			y = findPosY(document.getElementById('flash_id'));
			if ((x==0) || (y==0)) {
				x = findPosX(document.getElementById('anotherpos'));
				y = findPosY(document.getElementById('anotherpos'));
			}
			x = x+'px'; y = y+'px';
		}
		document.positionform.posx.value = x;
		document.positionform.posy.value = y;
	}

	function showLayer() {
		var IE = document.all ? 1 : 0;
		var ns = document.layers ? 1 : 0;
		var agent=navigator.userAgent;
		var opera=agent.indexOf("Opera")>-1;

		var x = document.positionform.posx.value;
		var y = document.positionform.posy.value;
		if (IE && !opera){
			document.all['div_id'].style.pixelLeft = x;
			document.all['div_id'].style.pixelTop = y;
			document.all['div_id'].style.display = "block";
		} else if (ns) {
			document.layers['div_id'].style.left = x;
			document.layers['div_id'].style.top = y;
			document.layers['div_id'].display = "block";
		} else {
			document.getElementById('div_id').style.left = x;
			document.getElementById('div_id').style.top = y;
			document.getElementById('div_id').style.display = "block";
		}
	}

	function hideLayer() {
		var IE = document.all ? 1 : 0;
		var ns = document.layers ? 1 : 0;
		var agent=navigator.userAgent;
		var opera=agent.indexOf("Opera")>-1;

		setPositionWaitBlock();
		if (IE && !opera) {
			document.all['div_id'].style.display = "none";
		} else if (ns) {
			document.layers['div_id'].display = "none";
		} else {
			document.getElementById('div_id').style.display = "none";
		}
		//hideWaitBlock();
	}

	function setPositionWaitBlock() {
		var IE = document.all ? 1 : 0;
		var ns = document.layers ? 1 : 0;
		var agent=navigator.userAgent;
		var opera=agent.indexOf("Opera")>-1;

		var x = document.positionform.posx.value;
		var y = document.positionform.posy.value;
		if (IE && !opera){
			document.all['waitblock'].style.pixelLeft = x;
			document.all['waitblock'].style.pixelTop = y;
		} else if (ns) {
			document.layers['waitblock'].style.left = x;
			document.layers['waitblock'].style.top = y;
		} else {
			document.getElementById('waitblock').style.left = x;
			document.getElementById('waitblock').style.top = y;
		}
	}

	function findPosX(obj) {
		var curleft = 0;
		if(obj.offsetParent)
			while(1) {
				curleft += obj.offsetLeft;
				if(!obj.offsetParent)
					break;
				obj = obj.offsetParent;
			}
		else if(obj.x)
			curleft += obj.x;
		return curleft;
	}

	function findPosY(obj) {
		var curtop = 0;
		if(obj.offsetParent)
			while(1) {
				curtop += obj.offsetTop;
				if(!obj.offsetParent)
					break;
				obj = obj.offsetParent;
			}
		else if(obj.y)
			curtop += obj.y;
		return curtop;
	}

	function getInfo(page, continent, scountry, dcountry, rcountry, fcountry, cncountry) {
		var IE = document.all ? 1 : 0;
		var ns = document.layers ? 1 : 0;
		var agent=navigator.userAgent;
		var opera=agent.indexOf("Opera")>-1;

		if (IE && !opera)
			document.all['infoText'].innerHTML = "";
		else if (ns)
			document.layers['infoText'].innerHTML = "";
		else{
			document.getElementById('infoText').innerHTML = "";
		}

		var ResponseText = '';
		var xmlHttpReq = false;
		var self = this;
		// Mozilla/Safari
		if (window.XMLHttpRequest) {
			self.xmlHttpReq = new XMLHttpRequest();
		}
		// IE
		else if (window.ActiveXObject) {
			self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
		} else {
			WriteToLayer('infoText', 'Can\'t validate');
			return false;
		}

		URL = '/map/getRateInfo.php?page='+page+'&continent='+continent+'&scountry=' + scountry + '&dcountry=' + dcountry + '&rcountry=' + rcountry + '&fcountry=' + fcountry+'&cncountry=' + cncountry;

		self.xmlHttpReq.open('GET', URL, true);
		self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		self.xmlHttpReq.onreadystatechange = function() {
			if (self.xmlHttpReq.readyState == 4) {
				ResponseText = self.xmlHttpReq.responseText;
				if (IE && !opera)
					document.all['infoText'].innerHTML = ResponseText;
				else if (ns)
					document.layers['infoText'].innerHTML = ResponseText;
				else{
					document.getElementById('infoText').innerHTML = ResponseText;
				}
			}
		}
		self.xmlHttpReq.send(URL);
	}

	function openNewInfo(page, continent, scountry) {
		var dcountry = "";
		if (document.infoform.dcountry) dcountry=document.infoform.dcountry.value;
		var rcountry = "";
		if (document.infoform.rcountry) rcountry = document.infoform.rcountry.value;
		var fcountry = "";
		if (document.infoform.fcountry) fcountry = document.infoform.fcountry.value;
		var cncountry = "";
		if (document.infoform.cncountry) cncountry = document.infoform.cncountry.value;
		openInfo(page, continent, scountry, dcountry, rcountry, fcountry, cncountry); showLayer();
	}

	function showWaitBlock(continent) {
		var IE = document.all ? 1 : 0;
		var ns = document.layers ? 1 : 0;
		var agent=navigator.userAgent;
		var opera=agent.indexOf("Opera")>-1;
		var h;
		if (continent=='Europe') h = "870";
		else if (continent=='Asia') h = "770";
		else h = "670";

		if (IE && !opera) {
			document.all['waitblock'].style.display = "block";
			document.all['waitblock'].style.height = "770";
		} else if (ns) {
			document.layers['waitblock'].display = "block";
			document.layers['waitblock'].height = h;
		} else {
			document.getElementById('waitblock').style.display = "block";
			document.getElementById('waitblock').style.height = h+"px";
		}
	}

	function hideWaitBlock() {
		var IE = document.all ? 1 : 0;
		var ns = document.layers ? 1 : 0;
		var agent=navigator.userAgent;
		var opera=agent.indexOf("Opera")>-1;

		if (IE && !opera)
			document.all['waitblock'].style.display = "none";
		else if (ns)
			document.layers['waitblock'].display = "none";
		else{
			document.getElementById('waitblock').style.display = "none";
		}
	}

	function openInfo(page, continent, scountry, dcountry, rcountry, fcountry, cncountry) {
		setPos();
		setPositionWaitBlock();
		showWaitBlock(continent);
		if (scountry) {
			getInfo(page, continent, scountry, dcountry, rcountry, fcountry, cncountry);
			showLayer();
		}
		setTimeout("hideWaitBlock()",2000);
	}
