function createDropDown(body, control, align, event) {

    /**
    * createDropDown Class
    *
    * Class for creating drop-down menus. Tested on IE6 and NS6
    * Usage: createDropDown("body-ID","control-ID","align","event");
    * align: "left","top","right","bottom"
    * event: "over","click"
    *
    * @author Maxim Spivakovsky
    * @copyright four for business AG 2002
    * @version 2.0
    * @link http://www.4fb.de
    */

    /**
    * Create object references
    * @access private
    */
    oBody = document.getElementById(body);
    oControl = document.getElementById(control);
    /**
    * Set the object properties
    * @access private
    */
    oBody.style.position = "absolute";
    oBody.style.visibility = "hidden";
    oBody.oAlign = align;

    oControl.event = event;
    oControl.oBody = oBody;
    oControl.oBody.open = false;

    oBody.event = event;
    oBody.oBody = oBody;
    oBody.control = control;

    //oBody.style.width = oControl.offsetWidth;

    /**
    * Define class methods
    * @access private
    */
    oControl.open = createDropDown_open;
    oControl.close = createDropDown_close;
    oControl.getPos = createDropDown_getPos;

    /**
    * Set event handlers depending on type (over/click)
    * @access private
    */
    if (event == "over") {
        oControl.onmouseover = createDropDown_open;
        oControl.onmouseout = createDropDown_close;
        oBody.onmouseover = createDropDown_open;
        oBody.onmouseout = createDropDown_close;
    } else {
        oControl.onclick = createDropDown_open;
    }

    /**
    * Get the position of the control element
    * @access private
    */
    oControl.getPos();
    oBody.style.left = oBody.x;
	oBody.style.top = oBody.y;

}

function createDropDown_getPos() {

    /**
    * Method getPos()
    *
    * This method calculates the position
    * of the control element
    *
    * @access private
    */
    this.x = 0;
    this.y = 0;
    var el = this;
	
    while (el.tagName != "BODY") {
        this.x += el.offsetLeft;
        this.y += el.offsetTop;
        el = el.offsetParent;
    }

    switch (this.oBody.oAlign) {

        case "top":
            this.oBody.x = this.x;
            this.oBody.y = this.y - this.oBody.offsetHeight;
            break;

        case "right":
            this.oBody.x = this.x + this.offsetWidth - 20;
            this.oBody.y = this.y;
            break;

        case "bottom":
            this.oBody.x = this.x;
            this.oBody.y = this.y + this.offsetHeight + 0;
            break;

        case "left":
            this.oBody.x = this.x - this.offsetWidth;
            this.oBody.y = this.y;
            break;

    }

    this.oBody.style.left = this.oBody.x + "px";
    this.oBody.style.top = this.oBody.y + "px";

}

function createDropDown_open() {

    /**
    * Method for opening the menu
    * @access private
    */
    oControl.getPos();

    if (this.event == "over") {
        this.oBody.style.visibility = "visible";
        this.style.backgroundColor = "#A3A3A3";
		
		if(this.control) {
			document.getElementById(this.control).style.backgroundColor = "#A3A3A3";
			//Hilfsnavi
			if((document.getElementById(this.control).id == "center_menu_0") || (this.id == "center_menu_46") || (this.id == "center_submenu_46")){
				document.getElementById(this.control).style.borderRight = "1px #a3a3a3 solid";
				document.getElementById(this.control).style.borderLeft = "1px #a3a3a3 solid";
			}else{
				document.getElementById(this.control).style.borderRight = "1px #ffffff solid";
				document.getElementById(this.control).style.borderLeft = "1px #ffffff solid";
			}
			if (document.getElementById(this.control).getElementsByTagName('a')[0]) {
				document.getElementById(this.control).getElementsByTagName('a')[0].style.color = "#255AA6";
			}
		}
		else {
			this.style.backgroundColor = "#A3A3A3";

			//Hilfsnavi
			if((this.id == "center_menu_0") || (this.id == "center_menu_46")){
				this.style.borderRight = "1px #a3a3a3 solid";
				this.style.borderLeft = "1px #a3a3a3 solid";
			}else{
				this.style.borderRight = "1px #ffffff solid";
				this.style.borderLeft = "1px #ffffff solid";
			}
			
			if (this.getElementsByTagName('a')[0]) {
				this.getElementsByTagName('a')[0].style.color = "#255AA6";
			}
		}

    } else {
        if (!this.oBody.open) {
            this.oBody.style.visibility = "visible";
			this.oBody.open = true;
        } else {
            this.oBody.style.visibility = "hidden";
            this.oBody.open = false;
        }
    }
}

function createDropDown_close() {

    /**
    * Method for closing the menu
    * @access private
    */
    this.oBody.style.visibility = "hidden";
    this.oBody.style.backgroundColor = "#a3a3a3";
	
	if(this.control) {
		document.getElementById(this.control).style.backgroundColor = "#a1a1a1";
		document.getElementById(this.control).style.borderRight = "1px #a1a1a1 solid";
		document.getElementById(this.control).style.borderLeft = "1px #a1a1a1 solid";
		if (document.getElementById(this.control).getElementsByTagName('a')[0]) {
			document.getElementById(this.control).getElementsByTagName('a')[0].style.color = "#ffffff";
		}
	}
	else {
		this.style.backgroundColor = "#a1a1a1";
		this.style.borderRight = "1px #a1a1a1 solid";
		this.style.borderLeft = "1px #a1a1a1 solid";
		if (this.getElementsByTagName('a')[0]) {
			this.getElementsByTagName('a')[0].style.color = "#ffffff";
		}
	}

}


