var AC_FL_RunContent = 0;
var map = null;
var point = null;

function dhtmlLoadScript(url)
{
   var e = document.createElement("script");
   e.src = url;
   e.type="text/javascript";
   document.getElementsByTagName("head")[0].appendChild(e); 
}


function mapload(id, x, y){
    if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById(id));
        map.clearOverlays();
        map.addControl(new GSmallMapControl());
        point = new GLatLng(x, y);
        map.setCenter(point, 14);
        var text = "";
        var pnt = new GLatLng(x, y);
        map.addOverlay(createMarker(pnt, text));
    }
}

function createMarker(point, text){
    var marker = new GMarker(point);
    return marker;
}

var loadMap = function() {
	mapload('map',46.156499605026795,8.972911834716797);
}

window.addEvent('domready',function(){ 
	if (document.getElementById('map')) {
		dhtmlLoadScript('http://maps.google.com/maps?file=api&v=2&key=ABQIAAAApRA7_VF2h0Z2QPP9HIIt9xQtd61XZS-6yTgxuBSQL3ZBP-H-wxT10u2NcfQayYabRfHXdx_KqQJD3A&async=2&callback=loadMap');		
	}

    var pathArray = window.location.pathname.split('/');
    try {

        if (pathArray.length == 2) {
            var img = new Element('img');
            img.onload = function(){
				var div = new Element('div');
				div.id = 'popup';
				div.setStyles({
					'position': 'absolute',
					'top': '8px',
					'left': (1002 - this.width) + 'px',
					'height': (this.height + 40) + 'px',
					'width': (this.width + 20) + 'px',
					'backgroundImage': 'url(' + this.src + ')',
					'backgroundPosition': '10px 30px',
					'backgroundRepeat': 'no-repeat',
					'backgroundColor': '#FFF',
					'border': '1px solid #999',
					'cursor': 'pointer'
				});
				div.onclick = function(){
					this.setStyle('display', 'none');
				}
				var cls = new Element('div');
				cls.id = 'popupclose';
				cls.onclick = function(){
					$('popup').setStyle('display', 'none');
				}
				cls.setStyles({
					'position': 'relative',
					'top': '5px',
					'float': 'right',
					'width': '24px',
					'height': '24px',
					'margin-right': '10px'
				})
				var img = new Element('img');
				img.src = '/files/images/common/close.png';
				img.injectInside(cls);
				cls.injectInside(div);
				div.injectInside(document.body);
				div.setStyle('display', Cookie.read('popup') != '1' ? 'block' : 'none');
				
				var myCookie = Cookie.write('popup', 1);
				
				try {
					var caller = $('popupcaller');
					caller.onclick = function(e){
						$('popup').setStyle('display', 'block');
						if (!e) var e = window.event;
						e.cancelBubble = true;
						if (e.stopPropagation) e.stopPropagation();
					}
					caller.setStyle('cursor', 'pointer');
				} 
				catch (e) {
				}
			} 
            img.src = '/files/images/main/popup.jpg';
        }
    } 
    catch (e) {
    }







});	
