﻿    	var lang = "<?php print $lang ?>";    
		var map;
		function mapinit() {					//inicializálás
			if (GBrowserIsCompatible()) {
				map = new GMap2(document.getElementById("divMap"));
			}
		}
		
		function mapset(obj) {			//pontra pozicionálás
			if (!obj.zoom) obj.zoom = 6;
			if (!obj.lat || !obj.lng) {obj.lat = 47; obj.lng = 19;};
			map.setCenter(new GLatLng(obj.lat,obj.lng),obj.zoom,obj.type);
		}
		
		function mapcontrol(obj) { //kontrolok
			if (obj.large) {map.addControl(new GLargeMapControl());}
			if (obj.small) {map.addControl(new GSmallMapControl());}
			if (obj.smallzoom) {map.addControl(new GSmallZoomControl());}
			if (obj.scale) {map.addControl(new GScaleControl());}
			if (obj.overview) {map.addControl(new GOverviewMapControl());}
			if (obj.typenormal || obj.typesat || obj.typehybrid) {
				if (!obj.typenormal) {map.removeMapType(G_NORMAL_MAP);}
				if (!obj.typesat) {map.removeMapType(G_SATELLITE_MAP);}
				if (!obj.typehybrid) {map.removeMapType(G_HYBRID_MAP);}
				if (obj.typephysical) {map.addMapType(G_PHYSICAL_MAP);}
				map.addControl(new GMapTypeControl());
			}
		}
		
		function mapaddmarker(obj) {
			if (!obj.lat || !obj.lng) {obj.lat = 47; obj.lng = 19;};
			point = new GLatLng(obj.lat,obj.lng);
			var oicon = new GIcon();
			if (!obj.img) {
				omarker = new GMarker(point,{title: obj.title,clickable: obj.click,draggable: obj.drag});
				if (obj.click && obj.content) GEvent.addListener(omarker,"click",function () {omarker.openInfoWindowHtml(obj.content);});
				map.addOverlay(omarker);
				return omarker;
			}
			else if (obj.img != "") {
				if (!obj.imgx) obj.imgx = 20;
				if (!obj.imgy) obj.imgy = 20;
				oicon.image = obj.img;
				oicon.iconSize = new GSize(obj.imgx,obj.imgy);
				if (!obj.imgax || !obj.imgay) {obj.imgax = 0; obj.imgay = 0};
				oicon.iconAnchor = new GPoint(obj.imgax,obj.imgay);
				oicon.infoWindowAnchor = new GPoint(obj.imgax,obj.imgay);
				omarker = new GMarker(point,{title: obj.title,clickable: obj.click,draggable: obj.drag,icon: oicon});
				if (obj.click && obj.content) GEvent.addListener(omarker,"click",function () {omarker.openInfoWindowHtml(obj.content);});
				map.addOverlay(omarker);
				return omarker;
			}
		}

		function mappline(obj) {
			var str = "new GPolyline([";
			for (i = 0; i < obj.points.length; i++) {
				str = str + "new GLatLng(" + obj.points[i].lat + "," + obj.points[i].lng + "),";
			}
			str = str.substring(0,str.length - 1) + "],\"" + obj.color + "\"," + obj.weight + "," + obj.opacity + ")";
			var polyline = eval(str);
			map.addOverlay(polyline);
			return polyline;
		}

	/************************** KÉPERNYŐ FELBONTÁS ************************************/
	
		var xtotal = screen.width;
		var ytotal = screen.height;
		var xmax = screen.availWidth;
		var ymax = screen.availHeight;
		var colortotal = screen.colorDepth;
	
	/************************** AJAX INICIALIZÁLÁS ************************************/

		var zXml = {
			useActiveX: (typeof ActiveXObject != "undefined"),
			useXmlHttp: (typeof XMLHttpRequest != "undefined")};

		zXml.ARR_XMLHTTP_VERS = ["MSXML2.XmlHttp.6.0","MSXML2.XmlHttp.3.0"];

		function zXmlHttp() {}

		zXmlHttp.createRequest = function () {

		    if (zXml.useXmlHttp) { //natív XMLHttpRequest ág
				return new XMLHttpRequest();
			}
			else if (zXml.useActiveX) { //IE < 7.0 ág
				if (!zXml.XMLHTTP_VER) {
					for (var i=0; i < zXml.ARR_XMLHTTP_VERS.length; i++) {
						try {
							new ActiveXObject(zXml.ARR_XMLHTTP_VERS[i]);
							zXml.XMLHTTP_VER = zXml.ARR_XMLHTTP_VERS[i];
							break;
						} catch (oError) {}
					}
				}
				if (zXml.XMLHTTP_VER) {
					return new ActiveXObject(zXml.XMLHTTP_VER);
				}
				else {
					throw new Error("Nem tudtam XML HTTP kérést inicializálni.");
				}
			}
			else {
				throw new Error("A böngésző nem támogatja az XML HTTP kérést.");
			}
		}
		
	/************************** ASZINKRON AJAX FÜGGVÉNY ************************************/

		function ajax_aszinkron(url,target,data) {
			var oxhr = zXmlHttp.createRequest();
			oxhr.open("post",url,true);
			oxhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			oxhr.setRequestHeader("Content-length", data.length);
			oxhr.onreadystatechange = function () {
				if (oxhr.readyState == 4) {
					if (oxhr.status == 200 || oxhr.status == 304) {
						if (oxhr.responseText.substr(0,8) == 'function') {
							var meghiv = oxhr.responseText;
							eval(meghiv);
						}
						else {
							document.getElementById(target).innerHTML = oxhr.responseText;
						}
					}
					else {
						alert(oxhr.statusText);
					}
				}
			}
			oxhr.send(data);
		scroll(0,0);	
	}
		
	/************************** SZINKRON AJAX FÜGGVÉNY ************************************/

		function ajax_szinkron(url,target,data) {
			var oxhr = zXmlHttp.createRequest();
			oxhr.open("post",url,false);
			oxhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			oxhr.setRequestHeader("Content-length", data.length);
			oxhr.send(data);
			if (oxhr.status == 200 || oxhr.status == 304) {
				if (oxhr.responseText.substr(0,8) == 'function') {
					var meghiv = oxhr.responseText;
					eval(meghiv);
				}
				else {
					document.getElementById(target).innerHTML = oxhr.responseText;
				}
			}
			else {
				alert(oxhr.statusText);
			}
		}
		
	/************************** HINT FÜGGVÉNY ************************************/

		var HINTS_CFG = {
			'wise'       : true, // don't go off screen, don't overlap the object in the document
			'margin'     : 0, // minimum allowed distance between the hint and the window edge (negative values accepted)
			'gap'        : -10, // minimum allowed distance between the hint and the origin (negative values accepted)
			'align'      : 'bctl', // align of the hint and the origin (by first letters origin's top|middle|bottom left|center|right to hint's top|middle|bottom left|center|right)
			'css'        : 'hintsClass', // a style class name for all hints, applied to DIV element (see style section in the header of the document)
			'show_delay' : 0, // a delay between initiating event (mouseover for example) and hint appearing
			'hide_delay' : 50, // a delay between closing event (mouseout for example) and hint disappearing
			'follow'     : false, // hint follows the mouse as it moves
			'z-index'    : 100, // a z-index for all hint layers
			'IEfix'      : false, // fix IE problem with windowed controls visible through hints (activate if select boxes are visible through the hints)
			'IEtrans'    : ['blendTrans(DURATION=.0)', 'blendTrans(DURATION=.0)'], // [show transition, hide transition] - nice transition effects, only work in IE5+
			'opacity'    : 100 // opacity of the hint in %%
		};

		// text/HTML of the hints
		var HINTS_ITEMS = ['','',''];

		var myHint = new THints (HINTS_ITEMS, HINTS_CFG);
