	var z = 0;
	var points = [];
	var markers = [];
	var counter = 0;
	var marker_html = [];
	var map = null;
	var a = new Array;
	var defaltas = new Image();
	var dicon = '';
	var api = '';
	var zoomm = 0;
	var aukstis = 0;
	var plotis = 0;
	var x = 0;
	var y = 0;
	var defsize2 = 0;
	var defsize1 = 0;
	var icon = new GIcon(G_DEFAULT_ICON);
function pradzia() {
	$.getJSON("include/gmap.php",{action: 'take1', page: page}, function(j){
		dicon = j[0].icon;
		api = j[0].api;
		zoomm = j[0].zoom;
		aukstis = j[0].aukstis;
		plotis = j[0].plotis;
		x = j[0].x;
		y = j[0].y;
		take();
	})
}
function take() {
	$.getJSON("include/gmap.php",{action: 'take2', page: page}, function(j){
		for (z = 0; z < j.length; z++) {

			a[z] = [j[z].name, j[z].x, j[z].y, j[z].icon, j[z].iconh, j[z].iconw, j[z].icon2, j[z].text];
		}
		defaltas.src = dicon;
		initialize()
	})
}

function initialize() {
	canvas = document.getElementById('map_canvas');
	canvas.style.width = plotis;
	canvas.style.height = aukstis;
	zoomm = parseInt(zoomm);
	x = parseFloat(x);
	y = parseFloat(y);
	map = new GMap(document.getElementById("map_canvas"));
	map.setCenter(new GLatLng(x, y), zoomm, G_NORMAL_MAP);
	map.addControl(new GSmallZoomControl());
	setTimeout('ikons()', 1000);
}	
function ikons() {
	defsize2 = defaltas.height;
	defsize1 = defaltas.width;
	var i = 0;
	while (i != z) {
		if (a[i][3] !== "") {
			icon.image = a[i][3];
			icon.iconSize = new GSize(a[i][4], a[i][5]);
			var heig = (a[i][4] / 2);
			var wid = (a[i][5] / 2);
			icon.iconAnchor = new GPoint(heig, wid);
			icon.shadow = '';
		} else if (dicon !== ""){
			icon.image = dicon;
			icon.iconSize = new GSize(defsize1, defsize2);
			//alert(icon.iconSize);
			var heig = (defsize1 / 2);
			var wid = (defsize2 / 2);
			icon.iconAnchor = new GPoint(heig, wid);
			icon.shadow = 'http://www.google.com/mapfiles/shadow50.png';
			
		} else {
			icon.image = "http://www.google.com/mapfiles/marker.png";
			icon.shadow = 'http://www.google.com/mapfiles/shadow50.png';
		}
		var icon1 = a[i][3];
		var icon2 = a[i][6];
		var point = new GLatLng(a[i][1], a[i][2]);
		var name = a[i][0];
		var ilgis = name.length * 6;
		var text = a[i][7];
		var lati = point.lat();
		var lngi = point.lng();
		var bla1 = "<b>"+name+ "</b>" +  "<hr width='" + ilgis + "px' align='left'>" + text;
		var bla = "<b>"+name+ "</b>" +  "<hr width='" + ilgis + "px' align='left'>" + text+ "<a href='"+location.href+"#' onclick='zoom("+ lati +", "+lngi+", "+counter+")' > Priartinti</a>";
		var tooltip = name;
		var marker = createMarker(point, name, bla, icon, tooltip, icon1, icon2);
		map.addOverlay(marker);
		i++;
	}
}
function zoom(lati, lngi, count) {
	map.setCenter(new GLatLng(lati, lngi), 15, G_NORMAL_MAP);
	map.closeInfoWindow();
	marker1 = markers[count];
	html = marker_html[count];
	marker1.openInfoWindowHtml(html);
}
function createMarker(point, title, html, icon, tooltip, ic1, ic2) {
	tooltip = tooltip.replace(/&quot;/g, '"');
var marker = new GMarker(point,{'icon': icon, 'title': tooltip });

GEvent.addListener(marker, "click", function() { 
	marker.openInfoWindowHtml(html);
});
GEvent.addListener(marker, "mouseover", function() {
	marker.setImage(ic2);
});
GEvent.addListener(marker, "mouseout", function() {
	marker.setImage(ic1);
});
points[counter] = point;
markers[counter] = marker;
marker_html[counter] = html;
counter++;
return marker;
}