/* DHTML-Bibliothek */
var DHTML = 0, DOM = 0, MS = 0, NS = 0, OP = 0;

function DHTML_init() {
	// alert("execute: 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;
 	}
}

/**
 *	@param	p1	string
 *	@param	p2	string
 *	@param	p3	string
 */	
function getTagsCnt(tagname) {
 	var cnt  ;
	if(DOM) {
		cnt = document.getElementsByTagName(tagname).length ;
	} else if(MS) {
		cnt = document.all.tags(tagname).length ;
	} else if(NS) {
		cnt = document[tagname].length ;
	}
	
	return(cnt)
}

/**
 *	@param	p1	id, name oder tagname
 *	@param	p2	string
 *	@param	p3	string
 */
function getElement(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);
 }
}
/**
 * Funktion für abwärtskompatiblität
 */
function getElem(p1,p2,p3) {
 	return getElement(p1,p2,p3)
}

/**
 *
 */
function getCont(p1,p2,p3) {
   var Cont;
   if(DOM && getElement(p1,p2,p3) && getElement(p1,p2,p3).firstChild) {
     if(getElement(p1,p2,p3).firstChild.nodeType == 3)
       Cont = getElement(p1,p2,p3).firstChild.nodeValue;
     else
       Cont = "";
     return(Cont);
   }
   else if(MS && getElement(p1,p2,p3)) {
     Cont = getElement(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 = getElement(p1,p2,p3).getAttribute(p4);
     return(Attr);
   }
   else if (NS && getElement(p1,p2)) {
       if (typeof getElement(p1,p2)[p3] == "object")
        Attr=getElement(p1,p2)[p3][p4]
       else
        Attr=getElement(p1,p2)[p4]
         return Attr;
       }
   else return void(0);
}

/**
 *	@param p1 
 *	@param p2 
 *	@param p3 
 *	@param p4 
 */
function setCont(p1,p2,p3,p4) {
   if(DOM && getElement(p1,p2,p3) && getElement(p1,p2,p3).firstChild)
     getElement(p1,p2,p3).innerHTML  = p4
	 //getElement(p1,p2,p3).firstChild.nodeValue = p4;
   else if(MS && getElement(p1,p2,p3))
     getElement(p1,p2,p3).innerText = p4;
   else if(NS && getElement(p1,p2,p3)) {
     getElement(p1,p2,p3).document.open();
     getElement(p1,p2,p3).document.write(p4);
     getElement(p1,p2,p3).document.close();
   }
}


function hideElement(typ,name,index) {
 	if(NS){
    	getElement(typ,name,index).visibility  = 'hide';
   	} else {
   		getElement(typ,name,index).style.visibility = 'hidden';
    }
}

function showElement(typ,name,index) {
	if(NS){
   		getElement(typ,name,index).visibility  = 'show';
    } else {
    	getElement(typ,name,index).style.visibility = 'visible';
    }

}
DHTML_init(); //  DHTML-Javascript Bibliothek in der Datei "dhtml.js" initialisieren 