/* Erleichtert die Prüfung einer Variablen auf seine Array-Eigenschaft */
function isArray(obj) {
   if (obj.constructor.toString().indexOf("Array") == -1)
      return false;
   else
      return true;
}
function replaceImg(id,src){
	document.getElementById(id).src = src;
}
function easyshowhide(id,triggerid){

	if(isArray(id)===false){
		var showhideVal = document.getElementById(id).style.display;			
		
		if(showhideVal=="none"){
			document.getElementById(id).style.display="block";
		}
		else if(showhideVal=="block"){ 
			document.getElementById(id).style.display="none";
		}
		else if(showhideVal=="" && document.getElementById(id).offsetHeight > 0){
			//alert(document.getElementById(id).offsetHeight);
			document.getElementById(id).style.display="none";
		}
		else document.getElementById(id).style.display="block";
		
	}
}
//Ergänzung zu css-formatierten class="DropPos5" die der FreidropDiv in menu.php per php zugeschrieben wurden. Css könnte man sich auch sparen,
//denn wird das Menü verändert, verändern sich durch die verschiedenen Wortlängen auch die Freidrop-Positionen
function FreiDrop(){
	var myFreiDrop = document.getElementById("FreiDrop").className;
	var MenuAktuellNr = myFreiDrop.substr(7, myFreiDrop.length-7)
	var MenuAktuell = document.getElementById("Menu"+MenuAktuellNr);
	var dropLeft = MenuAktuell.offsetLeft;
	document.getElementById("FreiDrop").style.left=(dropLeft+6)+"px";
	//alert(MenuAktuell.id);
}

function showhide(triggerId,mouse,menuSel){
	var menuArray = new Array("Menu0","Menu1","Menu2","Menu3","Menu4","Menu5","Menu6","Menu7");	
		
	for(i=0;i<menuArray.length;i++){
		if(document.getElementById(menuArray[i]) && document.getElementById(menuArray[i]).hasChildNodes()){
			var MenuNodes = document.getElementById(menuArray[i]).childNodes;
		}
		else var MenuNodes = "";

		for(n=0;n<MenuNodes.length;n++){
			//alle subnavs ausblenden
			if(MenuNodes[n].nodeName == "UL"){					
				MenuNodes[n].style.display="none";					
			}
			if(mouse == "over"){
				//aktuelle subnav einblenden
				if(MenuNodes[n].nodeName == "UL" && menuArray[i] == triggerId){
					MenuNodes[n].style.display="block";
				}
			}else if(mouse == "out"){
				//ursprüngliche subnav einblenden
				if(menuSel && menuSel != ""){
					if(MenuNodes[n].nodeName == "UL" && menuArray[i] == menuSel){
						MenuNodes[n].style.display="block";
					}
				}
			}
		}
	}
}
/*---------------------------------------------------------------------------------------------------------
Horizontal scroll added by BrownBear (www.devsoftware.com)
Extension developed by David G. Miles (www.z3roadster.net/dreamweaver)
Original Scrollable Area code developed by Thomas Brattli
To add more shock to your site, visit www.DHTML Shock.com
*/
 
function verifyCompatibleBrowser(){
    this.ver=navigator.appVersion
    this.dom=document.getElementById?1:0
    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
    this.ie4=(document.all && !this.dom)?1:0;
    this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
 
    this.ns4=(document.layers && !this.dom)?1:0;
    this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
    return this
}
bw=new verifyCompatibleBrowser() 
 
var speed=50
 
var loop, timer
 
function ConstructObject(obj,nest){
    nest=(!nest) ? '':'document.'+nest+'.'
    this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
	this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
    this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight;
    this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight;
    this.up=MoveAreaUp;this.down=MoveAreaDown;

    this.scrollWidth=bw.ns4?this.css.document.width:this.el.offsetWidth;
    this.clipWidth=bw.ns4?this.css.clip.width:this.el.offsetWidth;
    this.left=MoveAreaLeft;this.right=MoveAreaRight;

	
    this.MoveArea=MoveArea; this.x=0; this.y=0;
    this.obj = obj + "Object";
    eval(this.obj + "=this");
    return this
}
function MoveArea(x,y){
    this.x=x;
	this.y=y;
    this.css.left=this.x;
    this.css.top=this.y;
}
 
function MoveAreaDown(move){
   if(this.y>-this.scrollHeight+objContainer.clipHeight){
    this.MoveArea(this.x,this.y-move);
    if(loop) setTimeout(this.obj+".down("+move+")",speed);
   }
}
function MoveAreaUp(move){
   if(this.y<0){
    this.MoveArea(this.x,this.y-move);
    if(loop) setTimeout(this.obj+".up("+move+")",speed);
   }
}
function MoveAreaRight(move){
   if(-this.x + objContainer.clipWidth < this.scrollWidth){
    this.MoveArea(this.x-move,this.y);
    if(loop) setTimeout(this.obj+".right("+move+")",speed);
   }
   window.status = "right no action " + this.x;
}
function MoveAreaLeft(move){
   if(this.x<0){
    this.MoveArea(this.x-move,this.y);
    if(loop) setTimeout(this.obj+".left("+move+")",speed);
   }
   window.status = "left no action " + this.x;
}
 
function PerformScroll(direction,speed){
   if(initialised){
      loop=true;
	  if(direction == 0) {
	        if(speed>0) objScroller.down(speed);
            else objScroller.up(speed);
	  }
	  else {
	        if(speed>0) objScroller.right(speed);
            else objScroller.left(speed);
	  }
   }
}
 
function CeaseScroll(){
    loop=false;
    if(timer) clearTimeout(timer);
}
var initialised;
function InitialiseScrollableArea(){
    objContainer=new ConstructObject('divContainer');
    objScroller=new ConstructObject('divContent','divContainer');
    objScroller.MoveArea(0,0);
    objContainer.css.visibility='visible';
    initialised=true;
	
}
//------------------------- end absolutely positioned scrollable area object scripts ----------------------------------
