/* DHTML-Bibliothek */

var DHTML = 0, DOM = 0, MS = 0, NS = 0, OP = 0;

function DHTML_init() {

 if (window.opera) {
     OP = 1;
 }
 if(document.getElementById) {
   DHTML = 1;
   DOM = 1;
 }
 if(document.all && !OP) {
   DHTML = 1;
   MS = 1;
 }
if (window.netscape && window.screen && !DOM && !OP) {
   DHTML = 1;
   NS = 1;
 }
}

function getElem(p1,p2,p3) {
 var Elem;
 if(DOM) {
   if(p1.toLowerCase()=="id") {
     if (typeof document.getElementById(p2) == "object")
     Elem = document.getElementById(p2);
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="name") {
     //if (typeof document.getElementsByName(p2) == "object")
     Elem = document.getElementsByName(p2)[p3];
     //else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="tagname") {
     if (typeof document.getElementsByTagName(p2) == "object" || (OP && typeof document.getElementsByTagName(p2) == "function"))
     Elem = document.getElementsByTagName(p2)[p3];
     else Elem = void(0);
     return(Elem);
   }
   else return void(0);
 }
 else if(MS) {
   if(p1.toLowerCase()=="id") {
     if (typeof document.all[p2] == "object")
     Elem = document.all[p2];
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="tagname") {
     if (typeof document.all.tags(p2) == "object")
     Elem = document.all.tags(p2)[p3];
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="name") {
     if (typeof document[p2] == "object")
     Elem = document[p2];
     else Elem = void(0);
     return(Elem);
   }
   else return void(0);
 }
 else if(NS) {
   if(p1.toLowerCase()=="id" || p1.toLowerCase()=="name") {
   if (typeof document[p2] == "object")
     Elem = document[p2];
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="index") {
    if (typeof document.layers[p2] == "object")
     Elem = document.layers[p2];
    else Elem = void(0);
     return(Elem);
   }
   else return void(0);
 }
}

function getCont(p1,p2,p3) {
   var Cont;
   if(DOM && getElem(p1,p2,p3) && getElem(p1,p2,p3).firstChild) {
     if(getElem(p1,p2,p3).firstChild.nodeType == 3)
       Cont = getElem(p1,p2,p3).firstChild.nodeValue;
     else
       Cont = "";
     return(Cont);
   }
   else if(MS && getElem(p1,p2,p3)) {
     Cont = getElem(p1,p2,p3).innerText;
     return(Cont);
   }
   else return void(0);
}

function getAttr(p1,p2,p3,p4) {
   var Attr;
   if((DOM || MS) && getElem(p1,p2,p3)) {
     Attr = getElem(p1,p2,p3).getAttribute(p4);
     return(Attr);
   }
   else if (NS && getElem(p1,p2)) {
       if (typeof getElem(p1,p2)[p3] == "object")
        Attr=getElem(p1,p2)[p3][p4]
       else
        Attr=getElem(p1,p2)[p4]
         return Attr;
       }
   else return void(0);
}

function setCont(p1,p2,p3,p4) {
   if(DOM && getElem(p1,p2,p3) && getElem(p1,p2,p3).firstChild)
     getElem(p1,p2,p3).firstChild.nodeValue = p4;
   else if(MS && getElem(p1,p2,p3))
     getElem(p1,p2,p3).innerText = p4;
   else if(NS && getElem(p1,p2,p3)) {
     getElem(p1,p2,p3).document.open();
     getElem(p1,p2,p3).document.write(p4);
     getElem(p1,p2,p3).document.close();
   }
}

DHTML_init();

var action; 
var thisid;   

   function pInit() {
      e=getElem("id","pboxContent",null);
      if (e!=null) {
         e.style.top=40; e.style.left=600;
      }
      pMenue(null);
   }
   function pnoMenue() {
      if (thisid!=null) {
         //action = window.setInterval("pMenue(0)",600);
			action = window.setInterval("pAGMenue(null,0,0)",600);
         thisid=null;
      }
   }
   
	function pMenue(id) {
      epop=getElem("id","pop",null);
      ebox=getElem("id","pboxContent",null);
      eframe=getElem("id","pframe",null);
      if (epop!=null) {
         if (id==1) {
            epop.style.visibility = "visible";
            eframe.width=600; eframe.height=400;
            ebox.style.left=100;
         } else {
            epop.style.visibility = "hidden";
            eframe.width=1;   eframe.height=1;
            ebox.style.left=600;
         }
      }
      window.clearInterval(action);
      thisid=id;
   }

	
	
   function pChecknoMenue(id) {
      if (checkid!=null) {
         action = window.setInterval("pCheckMenue(0)",800);
         checkid=null;
      }
   }

   function pCheckMenue(id, left, top) {
      ebox=getElem("id","pboxContent",null);
      if (ebox!=null) {
         if (id==1) {
            ebox.style.left = left;
            ebox.style.top = top;
            ebox.style.width = 300;
            ebox.style.height = 240;
            ebox.style.visibility = "visible";
         } else {
            ebox.style.width = 100;
            ebox.style.visibility = "hidden";
            ebox.style.height = 1;
            ebox.style.width = 1;
         }
      }
      window.clearInterval(action);
      checkid=id;
   }
//Angebotssystempopupfenster ein- und ausschalten
var agseite;
var checkid;
	function pAGMenue(id, aid, seite, links) {	
      epop=getElem("id","agpop",null);   
      eframe=getElem("id","pframe",null);
      if (epop!=null) {
         if (id==1) {
            epop.style.visibility = "visible";            
            eframe.style.visibility = "visible";            
				if (links>0) {					
					epop.style.width = 400;
					epop.style.height = 300;
					eframe.style.width = 400;
					eframe.style.height = 300;
					epop.style.left= links;
					if (seite>0 && agseite!=seite) {
						eframe.src="/01/2006/showMessage.php?aid="+aid+"&seite="+seite;											
						agseite=seite;
					}
				} 
         } else {
            epop.style.visibility = "hidden";
				eframe.style.width = 1;
				eframe.style.height = 1;
         }			
      }
		window.clearInterval(action);
      checkid=id;
   }
   function pAGnoMenue() {
      if (checkid!=null) {
         action = window.setInterval("pAGMenue(0)",300);
         checkid=null;
      }
   }

		
   function setreiter(id) {
      document.iform.noenterpress.value="0";
      document.iform.reiter.value=id;
   }
	
   function press(v,me) {
		e=getElem("id",me,null);
		if (e!=null) {
			var big = e.value.toUpperCase(); 
      	if (big.substr(0,6)=="BITTE ") e.value="";
		}
      document.iform.noenterpress.value=v;
   }
   function presstab() {
      e=getElem("id",document.iform.noenterpress.value,null);
      if (e!=null) e.focus();
   }
   function activate(id) {
      e=getElem("id",id,null);
      if (e!=null) e.focus();
   }

//keycode abfangen-----------------------------------------------------------------------------------------   
function checkenter(Ereignis) {
	var Ereignis=Ereignis || window.event;
   if (window.event==null && Ereignis.keyCode==13 && document.iform!=null && document.iform.noenterpress!=null) {
      e=getElem("id",document.iform.noenterpress.value,null);
      if (e!=null) e.focus();
   }
	if (Ereignis.keyCode==33) {e=document.getElementById('keypup'); if (e) e.focus();}
	if (Ereignis.keyCode==34) {e=document.getElementById('keypdown'); if (e) e.focus();}
	if (Ereignis.keyCode==13) {e=document.getElementById('keyret'); if (e) e.focus();}	
	if (Ereignis.keyCode==37) {e=document.getElementById('keyleft'); if (e) e.focus();}		
	if (Ereignis.keyCode==39) {e=document.getElementById('keyright'); if (e) e.focus();}				
	if (Ereignis.keyCode==38) {e=document.getElementById('keyup'); if (e) e.focus();}		
	if (Ereignis.keyCode==40) {e=document.getElementById('keydown'); if (e) e.focus();}				   
}

document.onkeydown = checkenter;
//keycode abfangen-----------------------------------------------------------------------------------------   

function BMove(id,move) {
   e=getElem("id",id,null);
   if (e!=null) {
      e.src=move;
   }
}
var nlastid = 0;
var nlastmove = "";

function _BMoveStyle(e,move,c) {
   if (e!=null) {
		if (e.style.background != "url("+move+")") 
		{
	      e.style.background = "url("+move+")";
			e.style.color = c;
			e.style.backgroundRepeat = "no-repeat";
		}
   }
}

function BMoveStyle(id,move,c) {
	if (nlastid==id && nlastmove==move) return;
	nlastid=id; nlastmove=move;
   e=getElem("id",id,null);
	_BMoveStyle(e,move,c);
}


	
