/**
resize the window
*/
function resizeWindow(w,h) {
 if (parseInt(navigator.appVersion)>3) {
   if (navigator.appName=="Netscape") {
    top.outerWidth=w;
    top.outerHeight=h;
   }
   else top.resizeTo(w,h);
 }
}

/**
opens the movie window
*/
function show_extooi_movie(layername, movie, movieName) {
	 
	var x,y;
	if (self.innerHeight) // all except Explorer
	{
		x = self.innerWidth;
		y = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		x = document.documentElement.clientWidth;
		y = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		x = document.body.clientWidth;
		y = document.body.clientHeight;
	}

	var widthMovie = 640;
	var hightMovie = 480;
	if (y < 650){
		widthMovie = y-200;
		hightMovie = (widthMovie/4)*3;
	}
	var widthWindow= widthMovie;
	var hightWindow= hightMovie;
	var posLeft = 13;
	var posTop  = 300;
	
	window.open("http://www.alpserver.de/1.33/portal/wk/templates/movieWindow.php?width="+widthMovie+"&height="+hightMovie+"&movie="+movie,
				"",
				"toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=1,width="+widthWindow+",height="+hightWindow+",left="+posLeft+",top="+posTop+"");
	
} 

/**
shows the info page
*/
function infos(divid,stat){
	document.getElementById(divid).style.display = stat;
}
	    
/**
@author coster
Resize the IFrame size dynamicaly
*/
function setIFrameSize() {
	 
	//var x;
	var y;
	var iframesize = 355; //optimal fuer 1024x768px;
	if (self.innerHeight) // all except Explorer
	{
		//x = self.innerWidth;
		y = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		//x = document.documentElement.clientWidth;
		y = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		//x = document.body.clientWidth;
		y = document.body.clientHeight;
	}
	//get the iFrame:
	var iframe=getIFrame('iFrameAbt');
	//resize the iFrame:
	iframe.height = y-170;

}

/**
returns an iframe
*/
function getIFrame(name) {
		  if (document.getElementById) {
			return document.getElementById(name);			
		  }
		  else if (document.all) {
			return document.all[name];			
		  }
		  else if (document.layers) {
			return document.layers[name];			
		  }
}
	
/**
change the iframe with the map
*/
function changeIFrame(url) {
	theiframe = getIFrame('iFrameAbt');
	theiframe.src = url;
	window.location.reload();
}	


/*
#############################################################################################
Yahoo horizontal Menue
#############################################################################################
*/
	
// Initialize and render the menu bar when it is available in the DOM
YAHOO.util.Event.onContentReady("horizontalMenu", function () {

// Animation object
var oAnim;

// "beforeshow" event handler for each submenu of the menu bar
function onMenuBeforeShow(p_sType, p_sArgs) {

	var oBody,
		oShadow,
		oUL;

	if (this.parent) {

		oShadow = this.element.lastChild;

		oShadow.style.height = "0px";
	
		if (oAnim && oAnim.isAnimated()) {
		
			oAnim.stop();
			oAnim = null;
		
		}

		oBody = this.body;
		oUL = oBody.getElementsByTagName("ul")[0];

		YAHOO.util.Dom.setStyle(oBody, "overflow", "hidden");
		YAHOO.util.Dom.setStyle(oUL, "marginTop", ("-" + oUL.offsetHeight + "px"));
	
	}

}

function onTween(p_sType, p_aArgs, p_oShadow) {

	if (this.cfg.getProperty("iframe")) {
	
		this.syncIframe();

	}

	if (p_oShadow) {

		p_oShadow.style.height = this.element.offsetHeight + "px";
	
	}

}

function onAnimationComplete(p_sType, p_aArgs, p_oShadow) {

	var oBody = this.body,
		oUL = oBody.getElementsByTagName("ul")[0];

	if (p_oShadow) {
	
		p_oShadow.style.height = this.element.offsetHeight + "px";
	
	}

	YAHOO.util.Dom.setStyle(oUL, "marginTop", "auto");
	YAHOO.util.Dom.setStyle(oBody, "overflow", "visible");
	
	if (YAHOO.env.ua.ie) {
	
		YAHOO.util.Dom.setStyle(oBody, "zoom", "1");
	
	}
	
}


// "show" event handler for each submenu of the menu bar

function onMenuShow(p_sType, p_sArgs) {

	var oElement,
		oShadow,
		oUL;

	if (this.parent) {

		oElement = this.element;
		oShadow = oElement.lastChild;
		oUL = this.body.getElementsByTagName("ul")[0];
	
		oAnim = new YAHOO.util.Anim(oUL, 
			{ marginTop: { to: 0 } },
			.5, YAHOO.util.Easing.easeOut);


		oAnim.onStart.subscribe(function () {

			oShadow.style.height = "100%";
		
		});


		oAnim.animate();


		/*
			 Refire the event handler for the "iframe" 
			 configuration property with each tween so that the  
			 size and position of the iframe shim remain in sync 
			 with the menu.
		*/

		if (YAHOO.env.ua.ie) {
			
			oShadow.style.height = oElement.offsetHeight + "px";

			oAnim.onTween.subscribe(onTween, oShadow, this);

		}

		oAnim.onComplete.subscribe(onAnimationComplete, oShadow, this);
	
	}

}


	// Instantiate and render the menu bar

	var oMenuBar = new YAHOO.widget.MenuBar("horizontalMenu", { autosubmenudisplay: true, hidedelay: 750, lazyload: true });
                
		oMenuBar.subscribe("beforeShow", onMenuBeforeShow);
		oMenuBar.subscribe("show", onMenuShow);


		/*
			 Call the "render" method with no arguments since the markup for 
			 this menu already exists in the DOM.
		*/

		oMenuBar.render();            
            
  });	
