/********************************************
  JavaScript für www.vectron.de
  Autoren: Marc Malwitz / Andreas Wolter
  08/2003
*********************************************/

function openCard(url,name,marginright,margintop,height,width,status,scroll,resize){ //mmalwitz 27.06.2002
   if(marginright==null) marginright=parseInt(100);
   if(margintop==null) margintop=parseInt(75);
   if(height==null) height=parseInt(324);
   if(width==null) width=parseInt(410);
   if(status==null) status='no';
   if(scroll==null) scroll='auto';
   if(resize==null) resize='yes';
   var vstart = (screen.width-width-marginright);
   var mgbottom = parseInt(height) + parseInt(margintop);
   if (screen.height <= mgbottom) margintop=(screen.height - height - 80);
   var conditions = 'height='+height+',width='+width+',top='+margintop+',left='+vstart+',scrollbars='+scroll+',status='+status+',resizable='+resize;
   helppopup = window.open(url,name,conditions);
   if (parseInt(navigator.appVersion) >= 4) {
      helppopup.window.focus();
   }
}

function openWindow(url,name,height,width,scroll,status,resize) { //mmalwitz 27.06.2002

   if (window && window.innerWidth)
      var maxwidth = window.innerWidth;
   else if (document && document.documentElement && document.documentElement.clientWidth)
      var maxwidth = document.documentElement.clientWidth;
   else if (document && document.body && document.body.clientWidth)
      var maxwidth = document.body.clientWidth;
   else
      var maxwidth = screen.width;

   if (window && window.innerHeigh)
      var maxheight = window.innerHeigh;
   else if (document && document.documentElement && document.documentElement.clientHeight)
      var maxheight = document.documentElement.clientHeigh;
   else if (document && document.body && document.body.clientHeigh)
      var maxheight = document.body.clientHeigh;
   else
      var maxheight = screen.height;

   if (height==null)
      var height = parseInt(600);
   else if (height > maxheight)
      var height = maxheight;
   if (width==null)
      var width = parseInt(800);
   else if (width > maxwidth)
      var width = maxwidth;

   if (status==null)
      var status='yes';
   if (scroll==null)
      var scroll='auto';
   if (resize==null)
      var resize='yes';

   if(!window.opera){
      var vstart = (screen.width - width) / 2;
      var hstart = (screen.height - height) / 3;
   }
   else{
      var vstart = (screen.innerWidth - width) / 2;
      var hstart = (screen.innerHeight - height) / 3;
   }
   var featurescomplete = 'height='+height+',width='+width+',top='+hstart+',left='+vstart+',scrollbars='+scroll+',status='+status+',resizable='+resize;
   var popup = window.open(url,name,featurescomplete);
   if (parseInt(navigator.appVersion) >= 4) {
      popup.window.focus();
   }
}

function logaccess(){
   // mmalwitz 27.10.2004
   var plugins='';
   if(navigator.appName=='Netscape'||navigator.appName=='Opera'){
	for(i=0;i<navigator.plugins.length;++i)
	   plugins += navigator.plugins[i].name+';';
	plugins=escape(plugins);
   }
   document.write("<img style=\"border:0px;width:0px;height:0px\" alt=\"\" src=\"/countaccess.php?js=1&amp;sw="+screen.width+"&amp;sh="+screen.height+"&amp;plgn="+plugins+"&amp;ref="+document.referrer+"&amp;srch="+document.location.search+"\" />");
}

function preloadImages() {
   var d=document;
   if(d.images){
   if(!d.p)
	d.p=new Array();
   var i,j=d.p.length;
   var a=arguments;
   for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){
	   d.p[j]=new Image; d.p[j++].src=a[i];
	}
   }
}

function findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function swapImgRestore() { //v3.0
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function swapImage() { //v3.0
  var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function move(target) {
   window.location.href = target;
   return;
}

function instantWindow(body,head,height,width,scroll,status,resize) {
   // Diese Funktion erzeugt ein Fenster und verarbeitet den Inhalt direkt.
   // mmalwitz 03/2007
   if(height==null) height=parseInt(800);
   if(width==null) width=parseInt(600);
   if(status==null) status='yes';
   if(scroll==null) scroll='auto';
   if(resize==null) resize='yes';
   var vstart = (screen.width - width) / 2;
   var hstart = (screen.height - height) / 3;
   var features = 'height='+height+',width='+width+',top='+hstart+',left='+vstart+',menubar=no,toolbar=no,directories=no,scrollbars='+scroll+',resizable='+resize+',status=no,location=no';
   var popup = window.open('','msgWindow',features);
   head = unescape(head);
   body = unescape(body);
   var html = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'
   + '<html>'
   + '<head>'
   + '<link href="/styles.css" rel="stylesheet" type="text/css">'
   + '<style type="text/css">'
   + '@media print { p.navigation {display:none}}'
   + '@media screen, handheld {p.navigation {display:block}}'
   + '</style>'
   + '<title>'+head+'</title>'
   + '</head>'
   + '<body class="instantwindow">'+body+'</body>'
   + '</html>';

   with(popup)
   {
	document.open();
	document.write(html);
	document.close();
	focus();
   }
}

function simpleTicker(text,speed) {
   // Darstellung des Inhaltes als Formularelement: <input type="text" name="ticker" />
   var timerId
   document.form1.ticker.value=text+text+text;
   text=text.substring(1,text.length) + text.substring(0,1);
   timerId=setTimeout("simpleTicker()",speed);
}

function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// Found at:
// http://msdn.microsoft.com/workshop/author/dhtml/overview/browserdetection.asp
{
    var rv = -1; // Return value assumes failure
    if (navigator.appName == 'Microsoft Internet Explorer')
    {
        var ua = navigator.userAgent;
        var re  = new RegExp ("MSIE ([0-9]{1,}[\.0-9]{0,})");
        if (re.exec (ua) != null)
        {
        	rv = parseFloat (RegExp.$1);
        }
    }
    return rv;
}

function enableActiveX (containerID)
// Use it, improve it
// by Dirk Alban Adler // KLITSCHE.DE
{
	// No IE = no need to enable
    if (getInternetExplorerVersion () != 1)
    {
        // Get container
        var container = document.getElementById (containerID);
        // Get html in noscript
        var html = container.innerHTML;
        // Write html back to container
        container.innerHTML = html;
    }
}

function writeMailto (xname, xendung) {
	document.write('\<a href=\"mailto:' + xname + '@' + xendung + '">');
	document.write(xname + '@' + xendung + '<\/a>');
}

function open_lines(s)
{ var t;
if(tmp_table) tmp_table.style.display='none';
if(t=document.getElementById(s))
{ t.style.display='block';
tmp_table = t;
}
}



