function showtoplist(){
omenu = document.getElementById("overtoplist");
omenu.style.visibility = "visible";
};

function hidetoplist(){
omenu = document.getElementById("overtoplist");
omenu.style.visibility = "hidden";
};

$(function() {
	$('#hide').hide();
});

function un_hide(divek,act,text,text2) {
	var uhdiv = document.getElementById(divek);
	var acdiv = document.getElementById(act);
	if (uhdiv.style.display == 'none') {
		uhdiv.style.display = 'block';
		acdiv.innerHTML = '<a href="#" title="'+text+'" onclick="return un_hide(\''+divek+'\',\''+act+'\',\''+text2+'\',\''+text+'\')">'+text+'</a>';
	}
	else {
		uhdiv.style.display = 'none';
		acdiv.innerHTML = '<a href="#" title="'+text+'" onclick="return un_hide(\''+divek+'\',\''+act+'\',\''+text2+'\',\''+text+'\')">'+text+'</a>';
	}
	return false;
};

var date = {
	push: function(id){
		var datedata = {
			id: id
		};
		date.dbin[date.dbin.length] = datedata;
		return datedata;
	},
	showDate: function(){
		if (typeof(datedit) == 'undefined'){
			return false;
		}
		for (var i = 0; i < date.dbin.length; i++)
		{
			var datedata = date.dbin[i];
			date.placeDate(date.dbin[i]);
		}
	},
	placeDate: function(datedata){
		datedit(datedata.id,'d.m.yyyy');
	},
	dbin: []
};

var gmap = {
	push: function(id, zoom, type, sign, lat, lng, text){
		var mapdata = {
			id: id,
			type: type,
			sign: sign,
			zoom: zoom,
			lat: lat,
			lng: lng,
			text: text
		};
		gmap.gbin[gmap.gbin.length] = mapdata;
		return mapdata;
	},
	showMaps: function(){
		if (typeof(google) == 'undefined'){
			return false;
		}
		for (var i = 0; i < gmap.gbin.length; i++)
		{
			var mapdata = gmap.gbin[i];
			gmap.placeMap(gmap.gbin[i]);
		}
	},
	placeMap: function(mapdata){
		var myLatlng = new google.maps.LatLng(mapdata.lat,mapdata.lng);
		if(mapdata.type == '1'){
			var myOptions = {
				zoom: mapdata.zoom,
				center: myLatlng,
				mapTypeId: google.maps.MapTypeId.ROADMAP,
				navigationControl: true,
				navigationControlOptions: {
				style: google.maps.NavigationControlStyle.SMALL
				},
				scaleControl: false,
				scrollwheel: false,
				disableDoubleClickZoom: true,
				disableDefaultUI: false
			};
		}
		else{
			var myOptions = {
				zoom: mapdata.zoom,
				center: myLatlng,
				mapTypeId: google.maps.MapTypeId.SATELLITE,
				navigationControl: true,
				navigationControlOptions: {
				style: google.maps.NavigationControlStyle.SMALL
				},
				scaleControl: false,
				scrollwheel: false,
				disableDoubleClickZoom: true,
				disableDefaultUI: false
			};
		}
		var newgmap = new google.maps.Map(document.getElementById(mapdata.id), myOptions);
		if(mapdata.sign == '1'){
			var image = new google.maps.MarkerImage('/_template/images/add/sign-logo.png',
				new google.maps.Size(150, 72),
				new google.maps.Point(0,0),
				new google.maps.Point(74, 64)
			);
		}
		else{
			var image = new google.maps.MarkerImage('/_template/images/add/sign.png',
				new google.maps.Size(60, 72),
				new google.maps.Point(0,0),
				new google.maps.Point(30, 64)
			);
		}
		var marker = new google.maps.Marker({
			position: myLatlng,
			icon: image,
			map: newgmap,
			title: mapdata.text
		});
		google.maps.event.addListener(marker, 'click', function() {
			window.open('http://maps.google.com/maps?ll='+mapdata.lat+','+mapdata.lng+'&z='+myOptions.zoom+'&t=m&q='+mapdata.lat+','+mapdata.lng,'_blank');
		});
	},
	gbin: []
};

window.onload = function(){
  if (typeof(gmap) != 'undefined')
	{
		gmap.showMaps();
	}
  if (typeof(date) != 'undefined')
	{
		date.showDate();
	}
};
