// JavaScript Document
function hide(obj,on){
		if(on){obj.style.visibility = "hidden";}
		else{obj.style.visibility = "visible";}
	}
function slide(subobj){	
			//subobj.style.left=this.getposOffset(anchorobj, "offsetLeft") + horizontaloffset + "px"
			//subobj.style.top=this.getposOffset(anchorobj, "offsetTop")+verticaloffset+"px"
			//subobj.style.clip=(subobj.dropposition[1]=="top")? "rect(auto auto auto 0)" : "rect(0 auto 0 0)"
			subobj.style.clip="rect(auto auto auto 0)";
			//alert("You clicked the map.");
			subobj.glidetime= 500;
			subobj.startTime=new Date().getTime();
//			if (typeof window["hidetimer_"+subobj.id]!="undefined") //clear timer that hides drop down box?
//				clearTimeout(window["hidetimer_"+subobj.id]);
			slideengine(subobj);
			
	}
function curveincrement(percent){//return cos curve based value from a percentage input
		return (1-Math.cos(percent*Math.PI)) / 2;  
	}
function slideengine(obj){
		var elapsed=new Date().getTime()-obj.startTime; //get time animation has run
		if (elapsed<obj.glidetime){ //if time run is less than specified length
			var distancepercent= 1-this.curveincrement(elapsed/obj.glidetime);
			//var currentclip=(distancepercent*obj.contentheight)+"px";
			var currentclipleft=(distancepercent*220)+"px"; //obj.content.width
			//alert("You clicked the map.");
			//   obj.style.clip=(direction=="down")? "rect(0 auto "+currentclip+" 0)" : "rect(0 auto  auto  "+currentclipleft+")"
			obj.style.clip="rect(0 auto  auto  "+currentclipleft+")";
			window["glidetimer_"+obj.id]=setTimeout(function(){slideengine(obj)}, 10);
		}
		else{ //if animation finished
			obj.style.clip="rect(0 auto auto 0)"
		}
	}	
function opensubmenu(subobj){
		if(AktivMenu!=subobj)
		{
			//test(AktivMenu,250);
			hide(AktivMenu,true); AktivMenu=subobj; 
			//test(AktivMenu,100); 
			hide(AktivMenu,false); slide(AktivMenu);
		}
	}
	