/* DO AND BE
// +----------------------------------------------------------------------+
// | Javascript Klasse fuer Layermenue                                    |
// +----------------------------------------------------------------------+
// | GHID Giertz & Hrsak Informationsdesign                               |
// +----------------------------------------------------------------------+
// |                                                                      |
// +----------------------------------------------------------------------+
// | Author: Peter Giertz <giertz@ghid.de>                                |
// | Author: Anita Hrsak <hrsak@ghid.de>                                  |
// |                                                                      |
// +----------------------------------------------------------------------+

// {{{
// }}} klasse
/*
 *  menue_class()
 */
// {{{ methoden
// {{{ 
/*
 *  init()
 *  rollover("imagename")
 *  rollout("imagename")
 *  show("layername");
 *  hide("layername");
 *  get_browser_obj("layername")
 *  makeit("layername")
 *  killit("layername")
 *  hideall();
 *  fehler();
 */ 



function menue_class()
{
	//initialisieren der variablen
	this.ns4 = false;
	this.ns6 = false;
	this.ie = false;
	this.os="";
	this.version="";
	this.elem="";
	this.doc='document.images.';
    this.aktivlayer=false;
 	this.imgpfad='img/';
 	this.aktivlayer=false;
}

// {{{ init()
// {{{ 
menue_class.prototype.init = function()
{
    window.onerror=null;
	if(navigator.appName == 'Netscape')
	{
	this.version=navigator.appVersion.substring(0,3);
	if((this.version > 4.6) && (this.version < 5.0))
	{
		this.ns4 = true;
	}else if(this.version >= 5.0)
	{
		this.ns6 = true
	}else
	{
		this.ns4 = false;
		this.ns6 = false;
	}
	}
	this.version=navigator.appVersion.substring(22,25);
	if(this.version >=5.0)
	{
	this.ie = true;
	}else
	{
	this.ie = false;
	}
	this.os=navigator.platform ;	/*plattform*/
    
}
// {{{ rollover()
// {{{ 
menue_class.prototype.rollover = function(welches)
{
   if(document.images[welches] != null){
    eval(this.doc+welches+'.src=\''+this.imgpfad+welches+'_on.gif\'');
}
menu.hideall();
}



	
// {{{ rollout()
// {{{ 
menue_class.prototype.rollout = function(welches)
{

menu.alleaus()
	var act = welches.split("_");
	
    if(document.images[welches] != null && act[1] != menu.getit()){
    eval(this.doc+welches+'.src=\''+this.imgpfad+welches+'_off.gif\'');
}
    var subactiv="b_" + menu.getitsub();
    eval(this.doc+subactiv+'.src=\''+this.imgpfad+subactiv+'_on.gif\'');


}

// {{{ get_browser_obj()
// {{{ 
menue_class.prototype.get_browser_obj = function(welcher)
{
    if(document.getElementById(welcher) != null){
    if (this.ns4){return document.layers[welcher]}
    else if (this.ie){return document.all[welcher].style}
    else if (this.ns6){return document.getElementById(welcher).style}
    }
}

// {{{ show()
// {{{ 
menue_class.prototype.show = function(welcher)
{	
    var was = welcher.split("_");
    var img="b_" + was[1];
    menu.rollover(img);
    if(this.get_browser_obj(welcher) != null){
    this.get_browser_obj(welcher).visibility="visible";
    }
}
// {{{ hide()
// {{{ 
menue_class.prototype.hide = function(welcher)
{	
    
    if(this.get_browser_obj(welcher) != null){
	this.get_browser_obj(welcher).visibility="hidden";
    }

}
// {{{ makeit()
// {{{ 
menue_class.prototype.makeit = function(was)
{
    openlayer="sub_" + was;
    this.show(openlayer);

}
// {{{ killit()
// {{{ 
menue_class.prototype.killit = function(was)
{   
    menu.hideall();
    menu.show("sub_" + menu.getit())
}


menue_class.prototype.alleaus = function()
{
    if(document.getElementsByTagName) {
    var n = document.getElementsByTagName('IMG');
        for (var i=0;i<n.length;i++) {
            str=n[i].name;reg= /(b_)(.*)/;found= reg.exec(str);
                if(found){
                    var welches= n[i].name;
                    eval(this.doc+welches+'.src=\''+this.imgpfad+welches+'_off.gif\'');
                }
         }
    }
}
// {{{ hideall
// {{{
menue_class.prototype.hideall = function()
{
    if(document.getElementsByTagName) {
    var n = document.getElementsByTagName('DIV'); 
        for (var i=0;i<n.length;i++) {
            str=n[i].id;reg= /(sub)(.*)/;found= reg.exec(str);
                if(found){
                    this.hide(n[i].id);
                }
        }
    }
}

// {{{ initmenu()
// {{{
menue_class.prototype.initmenu = function(was)
{
   
	var activ="b_" + menu.getit();
	if(document.images[activ] != null){
	eval(this.doc+activ+'.src=\''+this.imgpfad+activ+'_on.gif\'');
}
var subactiv="b_" + menu.getitsub();
    eval(this.doc+subactiv+'.src=\''+this.imgpfad+subactiv+'_on.gif\'');
menu.makeit(menu.getit());
}

menue_class.prototype.getit = function(){
    var str=window.location.href;
	var reg= /(.*)\?mod=(.*)/;
	var found= reg.exec(str);
	var activ="";
	if(found){
	    var result=found[2];
	    var temp = result.split("_");
	    
	    switch(temp[0]){
            case "philosophie":
            activ="ueberblick";
            break;
            case "presse": case "classicpr":
            activ="publicrelations";
            break;
            case "seieinmalig": case "corporateculture": case "corporateimage":
            activ="corporatecommunications";
            break;
            case "partner": case "kooperation": case "kooperation_astridsenior": case "kooperation_karenlippe":
            activ="team";
            break;
            case "awards": case "pressemitteilungen": case "referenzen":
            activ="aktuelles";
            break;
            default:
            activ=temp[0];
        }
    return activ
	}
}
menue_class.prototype.getitsub = function(){
    var str=window.location.href;
	var reg= /(.*)\?mod=(.*)/;
	var found= reg.exec(str);
	var activ="";
	if(found){
	    var result=found[2];
	    var temp = result.split("_");
	   return temp[0];
	}
}
// {{{ fehler
// {{{
menue_class.prototype.fehler = function(meldung, url, zeile)
{
   return true;
}

