active='n1';
visibility='hidden';
selected=0;
var list = new Array;

function a(v,w)
	{
	document.getElementById(active).style.visibility='hidden';
	active=v;
	vi=visibility;
	if(w){if(document.getElementById(w).className == 'g'){vi='hidden'}};
	document.getElementById(active).style.visibility=vi;
	}
	
function s(v)
	{
	if(visibility=='visible'){visibility='hidden'}else{visibility='visible'};
	if(v){if(document.getElementById(v).className == 'g'){visibility='hidden'}};
	document.getElementById(active).style.visibility=visibility;
	}
	
function h(v)
	{
	visibility='hidden';
	document.getElementById(active).style.visibility='hidden'
	}
	
function l()
	{
	document.location.href=""+document.URL.replace(/&w=.*/,"");
	}
	
function r()
	{
	if(selected>0)
		{
		u=document.URL.replace(/&s=.*?&/,"&");
		u=u.replace(/&n=.*&/,"&");
		u=u.replace(/&s=.*/,"");
		document.location.href=u;
		}
	}
	
function sa()
	{
	u=document.URL.replace(/&s=.*/,"");
	document.location.href=""+u+"&s=all";
	}
	
function o()
	{
			if(selected>0)
		{
		w=window.open('/cgi-bin/e.pl?s='+list,'editor','width=625,height=625,status=0,toolbar=0,menubar=0,location=0,scroll=0');
		w.focus();
		}else{alert('No Images Selected')}
	}
	
function p(v,w)
	{
	var cl=document.getElementById(v).className;
	if(cl == 'ig')
		{document.getElementById(v).className='i';selected=selected-1;list[v]=null;};
	if(cl == 'i')
		{document.getElementById(v).className='ig';selected=selected+1;list[v]=w;};

//alt	if(cl == 'ig')
//		{document.getElementById(v).className='igd';selected=selected-1;list[v]=null;};
//	if(cl == 'igd')
//		{document.getElementById(v).className='ig';selected=selected+1;list[v]=w;};

//	if(cl == 'i')
//		{document.getElementById(v).className='is';selected=selected+1;list[v]=w;};
//	if(cl == 'is')
//		{document.getElementById(v).className='i';selected=selected-1;list[v]=null;};

	}
	
function ss()
	{
	alert(list)
	}
	
function os()
	{
		if(selected>0)
		{
		document.location.href='/cgi-bin/o.pl?s='+list;
		}else{alert('No Images Selected')}
	}
	
function nc()
	{
		if(selected>0)
		{
		document.location.href=document.URL+"&n=y&s="+list;
		}else{alert('No Images Selected')}
	}
	
function password(v)
	{
	p=prompt('Enter Password');
	u=document.URL.replace(/#.*/,"");
	u=u.replace(/&w=.*/,"");
	document.location.href=""+u+"&w="+p+"&s="+list;
	}
	
function go(v)
	{
	alert(list);
	document.location.href="/cgi-bin/"+v+"&s="+list;
	}
	
function g(v)
	{
	w=window.open('/cgi-bin/'+v,'editor','width=625,height=625,status=0,toolbar=0,menubar=0,location=0,scroll=0');
	w.focus();
	}
	
function gp(v)
	{
	p=prompt('Enter Password');
	document.location.href="/cgi-bin/"+v+"&s="+list+"&p="+p;
	}
	
function z(v,s)
	{
	document.getElementById('zi').innerHTML="<img id='imgz' style='border: 1px solid #666' src='http://wehrlimueller.dyndns.org/objekte/"+v+"'>";
	
	var x,y;
	if (self.innerHeight) // all except Explorer
	{
		x = self.innerWidth;
		y = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		x = document.documentElement.clientWidth;
		y = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		x = document.body.clientWidth;
		y = document.body.clientHeight;
	}
	
	var dx,dy;
	if (self.pageYOffset) // all except Explorer
	{
		dx = self.pageXOffset;
		dy = self.pageYOffset;
	}
	else if (document.documentElement && document.documentElement.scrollTop)
		// Explorer 6 Strict
	{
		dx = document.documentElement.scrollLeft;
		dy = document.documentElement.scrollTop;
	}
	else if (document.body) // all other Explorers
	{
		dx = document.body.scrollLeft;
		dy = document.body.scrollTop;
	}
	
//	document.getElementById('z').style.left=x/2-300+dx;
	document.getElementById('z').style.left=200;
	document.getElementById('z').style.top=y/2-300+dy;
		
	h1 = document.getElementById('1').offsetHeight+100;
	h2 = document.body.offsetHeight;
	if(h2>h1){h1=h2}
	document.getElementById('zc').style.height=h1;
	
	document.getElementById('zc').style.display='inline';
	
	document.getElementById('nr').innerHTML = s;
	i = 'img'+s;
	nmt = document.getElementById(i).name;
	document.getElementById('nm').innerHTML = ih;
	}
	
function MouseDown(e){	
	if (!e) {e = window.event}

  	if (e.pageX || e.pageY) {
  		X0 = e.pageX;
 	  	Y0 = e.pageY;
 	} else if (e.clientX || e.clientY) {
 		X0 = e.clientX + document.body.scrollLeft;
		Y0 = e.clientY + document.body.scrollTop;
 	}
 }
 
function download(){
	document.getElementById('zi').innerHTML="Only for personal use!"
}
////////////////////////////////////////////////////////// Von wehrlimueller.ch

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()
	{
	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 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 + "@" + "wehrlimueller.ch" ;
  	location.href = emailadr ;
}