var move=1;
var blur=0;
var swf="";
function minit() {
  blur_it();
  show(); 
  var a=document.getElementById("scrollframe");
  if(a) {
	scr_init();
	window.onblur=function () {
		blur=1;
		move=0;
	}
	window.onfocus=function () {
		move=1;
		blur=0;
	}
  }
  if(swf!="") {
	  b=document.getElementById('swf');
	  b.innerHTML=swf;
  }
}
var gamewindow="";
function showgame(url,w,h) {
  if(gamewindow) {
    if(gamewindow.closed==false) {
      gamewindow.close();
    }
  }
  features ='toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0'
  window_top = 10
  window_left = 10
  gamewindow=window.open(url,'img_window','width='+w+',height='+h+',top='+window_top+',left='+window_left+',features='+features+'');
  gamewindow.focus();
}

function blur_it() {
  var alla=document.getElementsByTagName('a');
  for(var i=0;i<alla.length;i++) {
     alla[i].onfocus=new Function("if(this.blur)this.blur();");
  }
}
function show(id) {
var d = document.getElementById(id);
  for (var i = 1; i<=30; i++) {
    if (document.getElementById('smenu'+i)) {
      document.getElementById('smenu'+i).style.display='none';
    }
  }
  if (d) {
    d.style.display='block';
  }
}
var imgwindow;
function showimage(fname,w,h,page,rid) {
  if(imgwindow) {
    if(imgwindow.closed==false) {
      imgwindow.close();
    }
  }
  h+=32;
  features ='toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0'
  window_top = 10
  window_left = 10
  imgwindow=window.open('index.php?c=img&f='+fname+'&p='+page+'&r='+rid+'&mh='+h,'img_window','width='+w+',height='+h+',top='+window_top+',left='+window_left+',features='+features+'');
  imgwindow.focus();
}

var smenu="";
function setmenu(id) {
 var a=document.getElementById(id);
 if(a)
   smenu=id;
}

var lmenu=new Array();
lmenu[0]="star";
lmenu[1]="unt";
lmenu[2]="leist";
lmenu[3]="lmenu0";
lmenu[4]="lmenu1";
lmenu[5]="lmenu2";
lmenu[6]="lmenu3";
lmenu[7]="lmenu4";
lmenu[8]="prod1";
lmenu[9]="prod2";
lmenu[10]="prod3";
lmenu[11]="prod4";
lmenu[12]="prod5";
lmenu[13]="prod6";
lmenu[14]="prod7";
lmenu[15]="prod8";
lmenu[16]="partner";
lmenu[17]="presse";
lmenu[18]="spiel";

var amenu="";
var menu="";

function lhide(e) {
  if (!e) var e = window.event;
  var tg = (window.event) ? e.srcElement : e.target;
  var reltg = (e.relatedTarget) ? e.relatedTarget : e.toElement;
  if(e.type=="mouseout") {
    while (reltg.nodeName != 'BODY' && reltg.nodeName!='DL') {
      reltg = reltg.parentNode
    }
    if(reltg.nodeName=='DL')
      return;
  }
  clearTimeout(menu);
  for(x in lmenu) {
    var ld=document.getElementById(lmenu[x]);
    if(ld) {
      if(lmenu[x]!=smenu) {
       ld.style.display='none';
      } else
       ld.style.display='block';
    }
  }
}
function lshow(e,id) {
  var tg = (window.event) ? e.srcElement : e.target;
  if(tg.parentNode.nodeName=="A") {
    return'';
  }
  clearTimeout(menu);
  menu=setTimeout("lshowf('"+id+"',true)",400);
  return '';
}
function lshowf(id,show) {
  var d = document.getElementById(id);
  if(d) {
    if(show) {
      d.style.display='block';
    } else {
      d.style.display='none';
    }
  }
}

function s2show(id,ti) {
  var a = document.getElementById(''+id+'a');
  var d = document.getElementById(id);
  if(d) {
  if(d.style.display!='block') {
    d.style.display='block';
    if(a) {
      a.innerHTML="-";
    }
  } else {
    d.style.display='none';
    if(a) {
      a.innerHTML="+";
    }
  }
  }
}

function findPos(obj) {
  var curleft = curtop = 0;
  if (obj.offsetParent) {
    curleft = obj.offsetLeft;
    curtop = obj.offsetTop;
    while (obj = obj.offsetParent) {
      curleft += obj.offsetLeft;
      curtop += obj.offsetTop;
    }
  }
  return [curtop,curleft];
}
function hover(lid,hid) {
   l=document.getElementById(lid);
   if(l) {
      pos=findPos(l);
   }
   a=document.getElementById(hid);
   if(a) {
      a.style.display='block';
      a.style.top=pos[0]+16+'px';
      if((pos[1]+24)<550) {
        a.style.left=pos[1]+24+'px';
      } else {
        a.style.left=550+'px';
      }
   }
}
function hide(lid,hid) {
   a=document.getElementById(hid);
   if(a) {
      a.style.display='none';
   }
}
function showSop(state) {
	var a=document.getElementById('sopDD');
	var b=document.getElementById('sopMEN');
	if(a) {
		if(state==1) {
			a.style.display='block';
			b.className="sopopen";
		} else {
			a.style.display='none';
			b.className="sopclose";
		}
	}
}
function setFontSize(sid) {
	var a=document.getElementById('sop3');
	var b=document.getElementById('sop2');
	var c=document.getElementById('sop1');
	if(sid==-1) {
		var fSize='8px';		
		a.style.fontWeight='normal';
		b.style.fontWeight='bold';
		c.style.fontWeight='bold';
	} else if(sid==0) {
		var fSize='11px';		
		a.style.fontWeight='bold';
		b.style.fontWeight='normal';
		c.style.fontWeight='bold';
	} else {
		var fSize='14px';		
		a.style.fontWeight='bold';
		b.style.fontWeight='bold';
		c.style.fontWeight='normal';
	}	
	document.getElementsByTagName('body')[0].style.fontSize=fSize;
	document.cookie='fSize='+fSize+'; expires=Sun, 31 May 2015 23:59:59 UTC; path=/';
}

var scr_interv="";
function scr_init() {
  var a=document.getElementById("scrollframe");
  if(a) {
     if(scr_interv)
        window.clearInterval(scr_interv);
     scrollframe_width=a.style.width;
     scr_interv=window.setInterval("scr_scroll()",1);
  }
}

function scr_scroll(){
	if(blur==0) {
		a=document.getElementById("scrollcontent");
		if(a) {
			if(parseInt(a.style.left)<=-(parseInt(a.offsetWidth))) {
			  a.style.left=scrollframe_width;
			}
			a.style.left=parseInt(a.style.left)-(1*move)+"px";
		}
	}
}




function load() {
  if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById("map"));
    map.addControl(new GLargeMapControl());
    map.addControl(new GMapTypeControl());
    map.setCenter(new GLatLng(50.127656,9.195911), 14);
    map.setMapType(G_HYBRID_MAP);
   // Create our "tiny" marker icon
   var icon = new GIcon();
   icon.image = "img/gm_logo.png";
   icon.iconSize = new GSize(32, 14);
   icon.iconAnchor = new GPoint(16, 14);

  var point = new GLatLng(50.127656,9.195911);
  map.addOverlay(new GMarker(point, icon));
  }
}

function map24_removeDefaultValues(){
  if (document.link2map24.sstreet.value == 'Straße')   document.link2map24.sstreet.value   = '';
  if (document.link2map24.szip.value     == 'PLZ')     document.link2map24.szip.value     = '';
  if (document.link2map24.scity.value   == 'Ort')     document.link2map24.scity.value   = '';

  }