  var objDrag = null;     // Element, ber dem Maus bewegt wurde

  var mouseX   = 0;       // X-Koordinate der Maus
  var mouseY   = 0;       // Y-Koordinate der Maus

  var offX = 0;           // X-Offset der Maus zur linken oberen Ecke des Elements
  var offY = 0;           // Y-Offset der Maus zur linken oberen Ecke des Elements
  
  var actl = 0;

  // Browserweiche
  IE = document.all&&!window.opera;
  DOM = document.getElementById&&!IE;

  // Initialisierungs-Funktion
  function init(){
    // Initialisierung der berwachung der Events
    document.onmousemove = doDrag;  // Bei Mausbewegung die Fkt. doDrag aufrufen
  //  document.ondblclick = newlayer;  // Bei Doppelclick neuer Layer
    document.onmouseup = stopDrag;  // Bei Loslassen der Maustaste die Fkt. stopDrag aufrufen
  }

  // Wird aufgerufen, wenn die Maus ber einer Box gedrckt wird
  function startDrag(objElem) {
    // Objekt der globalen Variabel zuweisen -> hierdurch wird Bewegung mglich
    objDrag = objElem;

    // Offsets im zu bewegenden Element ermitteln
    offX = mouseX - objDrag.offsetLeft;
    offY = mouseY - objDrag.offsetTop;
  }

  // Wird ausgefhrt, wenn die Maus bewegt wird
  function doDrag(ereignis) {
    // Aktuelle Mauskoordinaten bei Mausbewegung ermitteln
    mouseX = (IE) ? window.event.clientX : ereignis.pageX;
    mouseY = (IE) ? window.event.clientY : ereignis.pageY;

    // Wurde die Maus ber einem Element gedrck, erfolgt eine Bewegung
    if (objDrag != null) {
      // Element neue Koordinaten zuweisen
      xx=mouseX - offX
      yy=mouseY - offY
      
//	SNAP SNAP SNAP
//	SNAP SNAP SNAP

      if (183 < xx && xx < 223){xx=203};
      if (76 < yy && yy < 116){yy=96};
      
      if (xx < 32){xx=12};
      if (106 < yy && yy < 156){yy=136};
      
//      if (225 < mouseX && mouseX < 439){xx=226};
//      if (438 < mouseX && mouseX < 652){xx=439};
//      if (651 < mouseX ){xx=652};
      objDrag.style.left = xx + "px";
      objDrag.style.top = yy + "px";

      // Position in Statusleiste ausgeben
      window.status = "Box-Position: " + objDrag.style.left + ", " + objDrag.style.top;
    }
  }

  // Wird ausgefhrt, wenn die Maustaste losgelassen wird
  function stopDrag(ereignis) {
    // Objekt lschen -> beim Bewegen der Maus wird Element nicht mehr verschoben
    objDrag = null;
    pos()
  }








var ww=0;
var aktiv;
var editor;

function regexptest()
{

if(document.myform.regexp) {if (document.myform.regexp.value != ' Stichwort') sortTable(document.myform.regexp.value)};
}

function refresh()
	{
	var theurl=""+document.URL+"&action=refresh";
	document.location.href=theurl
	}
	
function reset()
	{
	var theurl=""+document.URL.replace(/&action=refresh/,"")+"&action=reset";
	document.location.href=theurl
	}
	
function clear()
	{
	var theurl=""+document.URL.replace(/Terms=.*/,"")+"Terms=suchen";
	document.location.href=theurl
	}
	
function language(l)
	{
	if(l == "E"){
		var theurl=document.URL.replace(/\.E/,".D");
		theurl=theurl.replace(/language\=E/,"language=D");
		}
		else{
		var theurl=document.URL.replace(/\.D/,".E");
		theurl=theurl.replace(/language\=D/,"language=E");
		};
	document.location.href=theurl
	}


function editpage()
	{
	parent.if.location.href=document.URL;
	if(document.URL.search(/parse/) < 0){
		var theurl=document.URL.replace(/static\//,"cgi-bin/parse.pl?file=");
		var theurl3=theurl.replace(/\.html/,"");
		}
		else{
		var theurl=document.URL.replace(/\&.*/,"");
		var theurl2=theurl.replace(/cgi-bin\/parse.pl\?file=/,"static\/");
		var theurl3=theurl2+".html";
		};
	document.location.href=theurl3
	}

function closetest()
	{
	if(editor.closed == true){location.reload(); window.clearInterval(aktiv);};
	}

function edit(feld)
	{
	if(feld.search(/:/) < 0){
	splitUrl = document.URL.split("&");
	var theurl=""+splitUrl[0].substr(0,splitUrl[0].length-2)+":"+feld;}
	else{
	var theurl=document.URL.replace(/=.+/,"="+feld)};
	var theurl2 = theurl.replace(/parse.pl/,"edit.pl")
	if(document.URL.search(/parse/) > 0) editor = window.open(theurl2,'sowjeteditor','resizable=yes,scrollbars=yes'); aktiv = window.setInterval("closetest()",1000); //self.focus(); parent.Editor.location.href=theurl2; //
	}
	
function pos()
	{
	if (actl != 0) {
	feld = actl;
	splitUrl = document.URL.split("&");
	y=document.getElementById(feld).offsetTop;
	x=document.getElementById(feld).offsetLeft;
	var theurl=""+splitUrl[0].substr(0,splitUrl[0].length-2)+":"+feld+"&y="+y+"&x="+x;
	var theurl2 = theurl.replace(/parse.pl/,"pos.pl");
	parent.if.location.href=theurl2;
	actl=0;
	}
	}
	
function newlayer(ereignis)
	{
    x = (IE) ? window.event.clientX : ereignis.pageX;
    y = (IE) ? window.event.clientY : ereignis.pageY;
	feld = 1;
	while (document.getElementById(feld) != null) {feld++;};
	splitUrl = document.URL.split("&");
	var theurl=""+splitUrl[0].substr(0,splitUrl[0].length-2)+":"+feld+"&new=y"+"&y="+y+"&x="+x;
	var theurl2 = theurl.replace(/parse.pl/,"edit.pl");
	if(document.URL.search(/parse/) > 0) editor = window.open(theurl2,'sowjeteditor','resizable=yes,scrollbars=yes'); aktiv = window.setInterval("closetest()",1000); //self.focus(); parent.Editor.location.href=theurl2; //
	}
	
function restricted(feld)
	{
	var theurl2 = document.URL.replace(/static/,"restricted")
	parent.document.location.href=theurl2;
	}
	
function opn(src)
	{ window.open(src,'','width=400,height=400') }

var cookieValue="";

function SetCookie(name, value, expires, path, domain)
{ document.cookie = name + "=" + escape(value) +
  ((expires == null) ? "" : "; expires=" + expires.toGMTString()) +
  ((path == null)    ? "" : "; path=" + path) +
  ((domain == null)  ? "" : "; domain=" + domain);
}

function AddItem(name,val)
{
	var cname = name + "=";
  var dc = document.cookie;
  if (dc.length > 0)
  { begin = dc.indexOf(cname);
    if (begin != -1)
    { begin += cname.length;
      end = dc.indexOf(";", begin);
      if (end == -1) end = dc.length;
      cookieValue = unescape(dc.substring(begin, end));
    }
  }
  SetCookie(name, val, null, '/');
}

function suchen()
{
	name = 'Architekturbild';
	var cname = name + "=";
  var dc = document.cookie;
  if (dc.length > 0)
  { begin = dc.indexOf(cname);
    if (begin != -1)
    { begin += cname.length;
      end = dc.indexOf(";", begin);
      if (end == -1) end = dc.length;
      cookieValue = unescape(dc.substring(begin, end));
    }
  }
  if (cookieValue.length == 0){cookieValue="Realm=BestOf&Terms=suchen"};
  parent.location.href='http://architekturbild.ch/cgi-bin/search/search.pl?'+cookieValue;
}

 function email(adr)
{
  	var emailadr="mailto:" + adr + "@" + "dominiquewehrli.ch" ;
  	location.href = emailadr ;
}