
function pop_mit(title, width, height, filename, fullscreen)
{
	thefile=filename;
	var w = 480, h = 340;

	if (document.all || document.layers) {
	    w = screen.availWidth;
	    h = screen.availHeight;
	}
	var sFull = "";
	if (fullscreen ==true) sFull = "fullscreen=yes,";

	var leftPos = (w-width)/2, topPos = (h-height)/2;
	
	popbox=window.open(thefile,title,"status=yes,toolbar=no,scrollbars=yes,resizable=yes,directories=no,menubar=no,"+sFull+"width="+width+",height="+height+",top=" + topPos + ",left=" + leftPos);
	
	if(popbox !=null)
	{
		if (popbox.opener==null)
		{
			popbox.opener=self;
		}
	}
}


function pop(title, width, height, filename)
{
	thefile=filename;
	var w = 480, h = 340;

	if (document.all || document.layers) {
	w = screen.availWidth;
	h = screen.availHeight;
	}

	var leftPos = (w-width)/2, topPos = (h-height)/2;
	
	popbox=window.open(thefile,title,"toolbar=no,scrollbars=no,resizable=no,directories=no,menubar=no,width="+width+",height="+height+",top=" + topPos + ",left=" + leftPos);
	if(popbox !=null)
	{
		if (popbox.opener==null)
		{
			popbox.opener=self;
		}
	}
}


function pop_full(title, width, height, filename)
{
	popbox=window.open(filename,title,"fullscreen=yes,toolbar=no,scrollbars=yes,resizable=yes,directories=no,menubar=no");
	if(popbox !=null)
	{
		if (popbox.opener==null)
		{
			popbox.opener=self;
		}
	}
}





function pop_ja(title, width, height, filename)
{
	thefile=filename;
	var w = 480, h = 340;

	if (document.all || document.layers) {
	    w = screen.availWidth;
	    h = screen.availHeight;
	}


	var leftPos = (width)/2;
	var topPos = (h-height)/2;
	
	
	popbox=window.open(thefile,title,"toolbar=no,scrollbars=no,resizable=yes,directories=no,menubar=no,width="+width+",height="+height+",top=" + topPos + ",left=" + leftPos);
	if(popbox !=null)
	{
		if (popbox.opener==null)
		{
			popbox.opener=self;
		}
	}
}

var AltImg = new Array();
function setTopumfrage(frageid,antwid) {
	//topumfrage -> hidden Feld: frageid;Antwortid|frageid;Antwortid;
	
	
	
    var i1 = new Image();
    i1.src = "images/icon_chk1.gif"
    var i0 = new Image();
    i0.src = "images/icon_chk0.gif"

	
	var img; img = document.getElementById("u"+antwid);
	/*if (String(img.src).indexOf("_chk0") > 0) {
		img.src= i1.src; //"images/icon_chk1.gif";
	}*/

	
	if (img.className == 'umfrage_chk') {
		img.className = 'umfrage_chk_ja';
	}
	
	if ((AltImg[frageid]) && (AltImg[frageid] != img)) {
		//AltImg[frageid].src=i0.src;
		AltImg[frageid].className = 'umfrage_chk';
	}
		
	
	AltImg[frageid] = img;	
	
	UpdateHidden(frageid,antwid);
}

function UpdateHidden(frageid,antwid) {
	
	//document.Form1.topumfrage.value = frageid;antwid|frageid;antwid...
	var val = document.getElementById(tTopumfrage);
	
	if (val.value == "") { 
		val.value = frageid + ";" + antwid + "|"; 
	} else {
	
	//Alten Eintrag der FrageID rauslöschen		
	var newInh = "";
	var ar = val.value.split("|");
	for (var i = 0; i <= ar.length-1; i++) {
		var ar2 = ar[i].split(";");
		if (ar2[0] != frageid && ar2[0] != "") {		
			newInh += ar2[0] + ";" + ar2[1] + "|";
		}
	}	
	newInh+= frageid + ";" + antwid + "|"; 
	val.value = newInh;
	}
	
}

function getFlashCode(datei,b,h) {

	var oeTags = '<OBJECT CLASSID="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"'
    + 'WIDTH="'+b+'" HEIGHT="'+h+'"'
    + 'CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
    + '<PARAM NAME="MOVIE" VALUE="'+datei+'">'
    + '<PARAM NAME="PLAY" VALUE="true">'
    + '<PARAM NAME="LOOP" VALUE="false">'
    + '<PARAM NAME="QUALITY" VALUE="high">'
    + '<PARAM NAME="MENU" VALUE="false">'
    + '<EMBED SRC="'+datei+'"'
    + 'WIDTH="'+b+'" HEIGHT="'+h+'"'
    + 'PLAY="true"'
    + 'LOOP="false"'
    + 'QUALITY="high"'
    + 'MENU="false"'
    + 'TYPE="application/x-shockwave-flash"'
    + 'PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">'
    + '<\/EMBED>'
    + '<\/OBJECT>';
    return oeTags;
    
    //    + 'WMODE="transparent"'
    //    + '<PARAM NAME="WMODE" VALUE="transparent">'
}


function js_urlEncode(js_inStr) {
  js_outStr=' '; //not '' for a NS bug!
  for (i=0; i < js_inStr.length; i++) {
    js_aChar=js_inStr.substring (i, i+1);
    switch(js_aChar){
      case '%': js_outStr += "%25"; break; case ',': js_outStr += "%2C"; break;
      case '/': js_outStr += "%2F"; break; case ':': js_outStr += "%3A"; break;
      case '~': js_outStr += "%7E"; break; case '!': js_outStr += "%21"; break;
      case '"': js_outStr += "%22"; break; case '#': js_outStr += "%23"; break;
      case '$': js_outStr += "%24"; break; case "'": js_outStr += "%27"; break;
      case '`': js_outStr += "%60"; break; case '^': js_outStr += "%5E"; break;
      case '&': js_outStr += "%26"; break; case '(': js_outStr += "%28"; break;
      case ')': js_outStr += "%29"; break; case '+': js_outStr += "%2B"; break;
      case '{': js_outStr += "%7B"; break; case '|': js_outStr += "%7C"; break;
      case '}': js_outStr += "%7D"; break; case ';': js_outStr += "%3B"; break;
      case '<': js_outStr += "%3C"; break; case '=': js_outStr += "%3D"; break;
      case '>': js_outStr += "%3E"; break; case '?': js_outStr += "%3F"; break;
      case '[': js_outStr += "%5B"; break; case '\\': js_outStr += "%5C"; break;
      case ']': js_outStr += "%5D"; break; case ' ': js_outStr += "+"; break;
      case '\n': js_outStr += "%0D"; break; case "Ä": js_outStr += "%c3%84"; break;
      case "ä": js_outStr += "%c3%a4"; break; case "Ö": js_outStr += "%c3%96"; break;
      case "ö": js_outStr += "%c3%b6"; break; case "Ü": js_outStr += "%c3%9c"; break;
      case "ü": js_outStr += "%c3%bc"; break; case "€": js_outStr += "%e2%82%ac"; break;
      case "§": js_outStr += "%c2%a7"; break;
      default: js_outStr += js_aChar;
    }
    
  }
  
  
  return js_outStr.substring(1, js_outStr.length);
}


function chkSkyScrapper() {
	if (screen.width > 1000) {
		if ((navigator.userAgent.toLowerCase().indexOf('mac') == -1) || (navigator.userAgent.toLowerCase().indexOf('msie') == -1)) {
			var myPos =  (findPosX(inhalt) + 650);
			skyscrapper.style.left=myPos;
			skyscrapper.style.display='';
		}
	}
}


function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}


function findPosY(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curleft += obj.y;
	return curleft;
}


function formatNumb(s) {
	if (s < 9) {
		return String("0"+s);
	} else {
		return s;
	}
}	

function doSearch(s) {
    location.href="?menueid=search&search="+s;
}

function load(m,lon,lat,txt,zoom,useGDirObject,dirPanel,deactivateMouseScrolling) {

  if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById(m));
    map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());
    map.addMapType(G_PHYSICAL_MAP);                
    map.enableContinuousZoom();
    map.enableScrollWheelZoom();
    
   
    if (lon != "" && lat != "") {
        if (isNaN(zoom)) zoom = 13;
        map.setCenter(new GLatLng(lon,lat), zoom);
    }
    function createMarker(point, number) {
        var marker = new GMarker(point);
        GEvent.addListener(marker, "click", function() {
        if (txt != "") {
            marker.openInfoWindowHtml(txt);
            window.setTimeout(function() {
              map.panTo(point);
            }, 400);
        }
     });
            return marker;
        
    }
    
    if(useGDirObject!=undefined)
    { 
        if(useGDirObject)
        {
            if (document.getElementById(dirPanel))  {
            var dirPanel = document.getElementById(dirPanel);
            gdir = new GDirections(map,dirPanel);
            } else {
            gdir = new GDirections(map);
            }
            GEvent.addListener(gdir, "error", handleErrors);
         } 
     }

    if (lon != "" && lat != "") {
        var point = new GLatLng(lon,lat);
        map.addOverlay(createMarker(point, 1));
        
    }
  }
}

function setFontSize(s) {
    //alert(iFontSize);
    if (s == 'r') {
        iFontSize=12;
    } else {
        if(isNaN(iFontSize) || iFontSize == null) {
            iFontSize = 12;
        } else {
            iFontSize=parseInt(iFontSize)+s;
        }
    }
    
    try {
        document.body.style.fontSize=String(iFontSize)+'px';
        setSubmenuHeight();
        functions_ajax.setFontSizeCookie(iFontSize);
    } catch(e) {
    }
}


function reloadLoginOut() {
    //Prüfen ob in den Frames die Var loginOut vorkommt.
    //Wenn ja befindet sich dort die Aktion An/Abmelden -> aktualisieren
    
    for(i=0;i<top.frames.length;i++) {
        var frm = top.frames[i];
        if (frm.loginOut) {            
            frm.location.href=frm.location.href;
        } else {
            for(d=0;d<frm.frames.length;d++) {
                if (frm.frames[d].loginOut) {
                    frm.frames[i].location.href=frm.frames[i].location.href;    
                }
            }
        }
    }
}

function flashGallery(id,lng,m) {
    var width = 635;
    var height = 580;
    window.scrollTo(0,0);
    var w = 1000;
    var h = 700;
    if (document.all) {
        w = document.body.offsetWidth;
        h = document.body.offsetHeight;
    } else {
        w = window.innerWidth; 
        h = window.innerHeight;
    }
    
    var leftPos = (w-width)/2
    var topPos = (h-height)/2;
    if (topPos < (height-20)) topPos = 20;
   

    div = document.createElement("DIV");
    div.id="flashGallery";
    div.style.position='absolute';
    div.style.width=width+'px';
    div.style.height=height+'px';
    div.style.top=topPos;
    div.style.left=leftPos;
    div.style.zIndex=150;
    div.innerHTML = "<iframe class='ifrFlashGalery' src='module/additionaldocuments/flashgallery.aspx?id="+id+"&lng="+lng+"' width='100%' height='100%' frameborder=0 border=0></iframe>";
    
    var divBg = document.createElement("DIV");
    divBg.id="flashGalleryBg";
    divBg.style.position="absolute";
    divBg.innerHTML = "<br><center><img src='images/indicator.gif' border=0></center>";
    divBg.style.top=0;
    divBg.style.left=0;
    divBg.style.width = (w) +'px';
    divBg.style.height = (h) + 'px';
    divBg.style.zIndex=100;
    divBg.style.backgroundColor='#ffffff';
    divBg.style.filter='alpha(style=0, opacity=95)';
    
    document.body.appendChild(divBg);
    document.body.appendChild(div);

}

function removeFlashGalleryIndicator() {
    if (parent.document.getElementById('flashGalleryBg'))  parent.document.getElementById('flashGalleryBg').innerHTML='';
}

function closeflashGallery() {
    parent.document.getElementById('flashGalleryBg').style.display='none';
    parent.document.body.removeChild(parent.document.getElementById('flashGalleryBg'));
    parent.document.body.removeChild(parent.document.getElementById('flashGallery'));
}

function fullScreen(theURL) {
    var width = screen.width-18;
    var height = screen.height-90;    
    popbox=window.open(theURL,"fullop","status=yes,toolbar=no,scrollbars=yes,resizable=yes,directories=no,menubar=no,width="+width+",height="+height+",top=0,left=0");
	
	if(popbox !=null)
	{
		if (popbox.opener==null)
		{
			popbox.opener=self;
		}
	}
	
}


function divPop(title,width,height,url) {
    var width = width;
    var height = height;
    window.scrollTo(0,0);
    var w = 1000;
    var h = 700;
    var wBg = 1000;
    var hBg = 700;
    if (document.all) {
        w = document.documentElement.clientWidth;
        h = document.documentElement.clientHeight;
        hBg = document.body.offsetHeight;
        wBg = document.body.offsetWidth;
    } else {
        w = window.innerWidth; 
        h = window.innerHeight;
        wBg = w;
        hBg = h;
    }
    
    var leftPos = (w-width)/2
    var topPos = (h-height)/2;
    if (topPos < (height-10)) topPos = 10;
   

    div = document.createElement("DIV");
    div.id=title;
    div.style.position='absolute';
    div.style.width=width+'px';
    div.style.height=height+'px';
    div.style.top=topPos;
    div.style.left=leftPos;
    div.style.zIndex=1500;
    div.innerHTML = "<iframe class='ifr"+title+"' src='"+url+"' width='100%' height='100%' frameborder=0 border=0></iframe>";
    
    var divBg = document.createElement("DIV");
    divBg.id="bg"+title;
    divBg.style.position="absolute";
    divBg.innerHTML = "<br><center><img src='images/indicator.gif' border=0></center>";
    divBg.style.top=0;
    divBg.style.left=0;
    divBg.style.width = (wBg) +'px';
    divBg.style.height = (hBg) + 'px';
    divBg.style.zIndex=1000;
    divBg.style.backgroundColor='#ffffff';    
    divBg.style.filter='alpha(style=0, opacity=85)';    
    document.body.appendChild(divBg);
    document.body.appendChild(div);
}

function divPopClose(title) {
    parent.document.getElementById('bg'+title).style.display='none';
    parent.document.body.removeChild(parent.document.getElementById('bg'+title));
    parent.document.body.removeChild(parent.document.getElementById(title));
}


function Querystring(qs) { // optionally pass a querystring to parse
	this.params = new Object()
	this.get=Querystring_get
	
	if (qs == null)
		qs=location.search.substring(1,location.search.length)

	if (qs.length == 0) return

// Turn <plus> back to <space>
// See: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1
	qs = qs.replace(/\+/g, ' ')
	var args = qs.split('&') // parse out name/value pairs separated via &
	
// split out each name=value pair
	for (var i=0;i<args.length;i++) {
		var value;
		var pair = args[i].split('=')
		var name = unescape(pair[0])

		if (pair.length == 2)
			value = unescape(pair[1])
		else
			value = name
		
		this.params[name] = value
	}
}

function Querystring_get(key, default_) {
	// This silly looking line changes UNDEFINED to NULL
	if (default_ == null) default_ = null;
	
	var value=this.params[key]
	if (value==null) value=default_;
	
	return value
}

function getLng() {
    var qs = new Querystring(location.search);
    return qs.get("lng");
}