/* Google Maps */

		var city;
		var directions;
		var directionsPanel;

			
	  function setRouteURL(lang){
		document.getElementById('routeLink').innerHTML = '<a style="font-weight: bold; color: #79B51C;" target="_blank" href="http://maps.google.com/maps?f=e&hl='+lang+'&geocode=&ie=UTF8&z=9&om=1&saddr='+encodeURIComponent(document.getElementById('inpDir').value)+'&daddr='+encodeURIComponent(city)+'">Route</a>';
	  }


    function load(country) {
		
	  	
		
      T3_onloadWrapper();
      if (GBrowserIsCompatible()) {

				var map = new GMap2(document.getElementById("map"));
				var mapControl = new GMapTypeControl();
				map.addControl(mapControl);
				map.addControl(new GLargeMapControl());
				map.enableScrollWheelZoom();
				map.setCenter(new GLatLng(52.461449, 8.546076), 13);

				GDownloadUrl("/fileadmin/templates/gmaps.xml", function(data, responseCode) {
										
				  var xml = GXml.parse(data);
				  var markers = xml.documentElement.getElementsByTagName("marker");
				  for (var i = 0; i < markers.length; i++) {
					if(markers[i].getAttribute("country") == country){  
						city = markers[i].getAttribute("city");
				    	var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),parseFloat(markers[i].getAttribute("lng")));
				    	map.addOverlay(createMarker(point,i,GXml.value(markers[i]),markers[i].getAttribute("city"),markers[i].getAttribute("title")));
						map.setCenter(point, 13);
					}
				  }
				});

				
				function createMarker(point, index, html, city, title) {

				  var marker = new GMarker(point);	
				  return marker;
				}
				
			
	  	}
		}


















/* END: Google Maps */


function toggleMenu(){
			
	if(document.getElementById('submenu_content').className == 'display'){
		document.getElementById('submenu_content').className = 'hidden';
	}
	else{
		document.getElementById('submenu_content').className = 'display'; 	
	}
}


var clipTop = 0;
var clipWidth = 615;
var clipBottom = 425;
var topper = 25;
var lyrheight = 0;
var time,amount,theTime,theHeight,DHTML;

function init()
{
	DHTML = (document.getElementById || document.all || document.layers)
	if (!DHTML) return;
	var x = new getObj('scrollcontainer');
	if (document.layers)
	{
		lyrheight = x.style.clip.bottom;
		lyrheight += 20;
		x.style.clip.top = clipTop;
		x.style.clip.left = 0;
		x.style.clip.right = clipWidth;
		x.style.clip.bottom = clipBottom;
	}
	else if (document.getElementById || document.all)
	{
		lyrheight = x.obj.offsetHeight;
		x.style.clip = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,0)';
	}
	
	if(lyrheight <= clipBottom){
		var scroll = new getObj('scrollelemente');
		scroll.style.visibility = 'hidden';	
	}else{
	
		if (window.addEventListener)
	        /** DOMMouseScroll is for mozilla. */
	        window.addEventListener('DOMMouseScroll', wheel, false);
			/** IE/Opera. */
		window.onmousewheel = document.onmousewheel = wheel;		
	}
}

function scrollayer(layername,amt,tim)
{

	layername = 'scrollcontainer';

	tim = 75;
	amt = amt*2;
	
	
	if (!DHTML) return;
	thelayer = new getObj(layername);
	if (!thelayer) return;
	amount = amt;
	theTime = tim;
	realscroll();
}

function realscroll()
{
	if (!DHTML) return;
	clipTop += amount;
	clipBottom += amount;
	topper -= amount;
	if (clipTop < 0 || clipBottom > lyrheight)
	{
		clipTop -= amount;
		clipBottom -= amount;
		topper += amount;
		return;
	}
	if (document.getElementById || document.all)
	{
		clipstring = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,0)';
		thelayer.style.clip = clipstring;
		thelayer.style.top = topper + 'px';
	}
	else if (document.layers)
	{
		thelayer.style.clip.top = clipTop;
		thelayer.style.clip.bottom = clipBottom;
		thelayer.style.top = topper;
	}
	time = setTimeout('realscroll()',theTime);
}

function stopscroll()
{
	if (time) clearTimeout(time);
}


function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}


function handle(delta) {
        if (delta < 0){
			scrollayer('scrollcontainer',10,100);
			stopscroll();
		}
        else if(delta > 0){
			scrollayer('scrollcontainer',-10,100);
			stopscroll();
		}
}

/** Event handler for mouse wheel event.
 */
function wheel(event){
        var delta = 0;
        if (!event) /* For IE. */
                event = window.event;
        if (event.wheelDelta) { /* IE/Opera. */
                delta = event.wheelDelta/120;
                /** In Opera 9, delta differs in sign as compared to IE.
                 */
                if (window.opera)
                        delta = -delta;
        } else if (event.detail) { /** Mozilla case. */
                /** In Mozilla, sign of delta is different than in IE.
                 * Also, delta is multiple of 3.
                 */
                delta = -event.detail/3;
        }
        /** If delta is nonzero, handle it.
         * Basically, delta is now positive if wheel was scrolled up,
         * and negative, if wheel was scrolled down.
         */
        if (delta)
                handle(delta);
        /** Prevent default actions caused by mouse wheel.
         * That might be ugly, but we handle scrolls somehow
         * anyway, so don't bother here..
         */
        if (event.preventDefault)
                event.preventDefault();
	event.returnValue = false;
}

