function OpenWindow(wp, wh, ww) {
          var wx = (screen.width - ww) / 2 - 100;
          var wy = (screen.height - wh) / 2 - 200;
          var wa = "height="+wh+",width="+ww+",top="+wx+",left="+wy+",scrollbars=yes,resizable";
          var ww = window.open(wp, "subwin", wa);
          return false;
}


function showDiv(elementId, display) {
	// Anzeigen
	if (display) {
		document.getElementById(elementId).className='show';
	}
	// Ausblenden
	if (!display) {
		document.getElementById(elementId).className='hide';
	}
}

function showSelectBox(selectbox) {
	showDiv('div_standorte_content', true);
}

function addNet(url,titel) {
	if ((typeof window.sidebar=="object") && (typeof window.sidebar.addPanel=="function")) {
		window.sidebar.addPanel(titel,url,"");
	}
	else {
		alert("Sie nutzen eine alte Netscape Version, �ber die das Hinzuf�gen eines Lesezeichens per JavaScript nicht m�glich ist.");
	}
}
function lesezeichen() {
	var url=window.location.href,t=document.title,ap=navigator.appName;
	if (ap=="Microsoft Internet Explorer") {
		window.external.AddFavorite(url,t);
	}
	else {
		if (ap=="Netscape") {
			addNet(url,t);
		}
		else {
			alert("Das Hinzuf�gen eines Lesezeichens �ber JavaScript ist nicht m�glich.\nBitte legen sie das Lesezeichnen manuell an.");
		}
	}
}


function checkFormSubmit (eventName) {
  if (!eventName)
  	eventName = window.event;
  if (eventName.keyCode == 13)
	  document.form1.submit();
}
document.onkeypress = checkFormSubmit;


// Copyright (C) krikkit - krikkit@gmx.net
// --> http://www.krikkit.net/
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
function copy_clip(meintext)
{
 if (window.clipboardData)
   {

   // the IE-manier
   window.clipboardData.setData("Text", meintext);

   // waarschijnlijk niet de beste manier om Moz/NS te detecteren;
   // het is mij echter onbekend vanaf welke versie dit precies werkt:
   }
   else if (window.netscape)
   {

   // dit is belangrijk maar staat nergens duidelijk vermeld:
   // you have to sign the code to enable this, or see notes below
   netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');

   // maak een interface naar het clipboard
   var clip = Components.classes['@mozilla.org/widget/clipboard;1']
                 .createInstance(Components.interfaces.nsIClipboard);
   if (!clip) return;

   // maak een transferable
   var trans = Components.classes['@mozilla.org/widget/transferable;1']
                  .createInstance(Components.interfaces.nsITransferable);
   if (!trans) return;

   // specificeer wat voor soort data we op willen halen; text in dit geval
   trans.addDataFlavor('text/unicode');

   // om de data uit de transferable te halen hebben we 2 nieuwe objecten
   // nodig om het in op te slaan
   var str = new Object();
   var len = new Object();

   var str = Components.classes["@mozilla.org/supports-string;1"]
                .createInstance(Components.interfaces.nsISupportsString);

   var copytext=meintext;

   str.data=copytext;

   trans.setTransferData("text/unicode",str,copytext.length*2);

   var clipid=Components.interfaces.nsIClipboard;

   if (!clip) return false;

   clip.setData(trans,null,clipid.kGlobalClipboard);

   }
   //alert("Following info was copied to your clipboard:\n\n" + meintext);
   return false;
}


function in_array(item,arr) {
  for(p=0;p<arr.length;p++) if (item == arr[p]) return true;
  return false;
}

function getURI() {
  var dir = location.href;
  if (dir.substr(0,7) == 'http:\/\/') 
    dir = dir.substr(7);
  var path = ''; 
  var pos = dir.indexOf('\/', dir.indexOf('\/')+2 ); 
  if (pos > -1) {
    var lang = dir.substr(dir.indexOf('\/') + 1,pos - dir.indexOf('\/') - 1);
    if( in_array(lang,lang_list) )
    {
        path = dir.substr(pos+1); 
    }
    else
    {
        path = dir.substr(dir.indexOf('\/') + 1);
    }
  }
  return path;
}


function location_url(location)
{
  var countryselector = document.getElementById("countryselector");
  var value = countryselector.options[countryselector.selectedIndex].value;
  var trennerpos = value.indexOf("#");
  var siteaccess = value.substring(0,trennerpos);
  var country = value.substring(trennerpos+1,value.length);
  //alert("/" + siteaccess + location + "/(division)/" + country);
  var uri = getURI(); 
  if (siteaccess=="")
    window.location.href = location + "/(division)/" + country + "/(uri)/" + uri;
  else
    window.location.href = "/" + siteaccess + location + "/(division)/" + country + "/(uri)/" + uri;
}

function showCountry(url,region)
{
	var divisionselector = document.getElementById("divisionselector");
	var country = divisionselector.options[divisionselector.selectedIndex].value;
	//alert(url + '/(region)/' + region + '/(country)/' + country);
	window.location.href = url + '/(region)/' + region + '/(country)/' + country;
}
