function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function feldover(feld) 
{
document.forms[0].elements[feld].focus();
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


function layer_einblenden(layer_id) {

document.getElementById(layer_id).style.visibility = "visible";

}

function layer_ausdrucken(layer_ueberschrift,layer_inhalt) {

if(layer_ueberschrift.length > 0) layer_ueberschrift = document.getElementById(layer_ueberschrift).innerHTML;
if(layer_inhalt.length > 0) layer_inhalt = document.getElementById(layer_inhalt).innerHTML;

printwindow = window.open('printlayer.php','printwindow','directories=0,location=0,menubar=0,resizable=1,scrollbars=1,status=0,toolbar=0,width=450,height=450,left=200,top=200');

//Html erstellen für Druckseite
printwindow.document.writeln("<html>");
printwindow.document.writeln("<head>");

printwindow.document.writeln("<title>Atelier Damb&ouml;ck Messebau GmbH</title>");
printwindow.document.writeln("<link rel='stylesheet' href='../master.css' type='text/css'/>");

printwindow.document.writeln("</head>");
printwindow.document.writeln("<body onLoad='this.window.close();'>");


printwindow.document.writeln("<div id='box_popup_ueberschrift'>");
if(layer_ueberschrift.length > 0) printwindow.document.writeln(layer_ueberschrift);
printwindow.document.writeln("</div>");

printwindow.document.writeln("<div id='box_popup_inhalt' style='height: auto;'>");
if(layer_inhalt.length > 0) printwindow.document.writeln(layer_inhalt);
printwindow.document.writeln("<br><br><br></div>");


printwindow.document.writeln("</body>");
printwindow.document.writeln("</html>");

//Ausdrucken und anschließend schließen
printwindow.print();
printwindow.document.close();
}

function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;

	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}

function getPageScroll(){

	var xScroll, yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
		xScroll = self.pageXOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
		xScroll = document.documentElement.scrollLeft;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
		xScroll = document.body.scrollLeft;	
	}

	arrayPageScroll = new Array(xScroll,yScroll) 
	return arrayPageScroll;
}


function play_flash_file(video_url,video_width,video_height) {
	
	document.getElementById('flash_player_bg').style.visibility = "visible";
	var arrayPageSize = getPageSize('flash_player_bg');
	var arrayPageScroll = getPageScroll();

	document.getElementById('flash_player_bg').style.width = arrayPageSize[0] +"px";
	document.getElementById('flash_player_bg').style.height = arrayPageSize[1] +"px";

	
	document.getElementById('flash_player').style.visibility = "visible";
	
	
	frame_height = video_height + 20;
	
	document.getElementById('flash_player').style.width = video_width +"px";
	document.getElementById('flash_player').style.height = frame_height +"px";
	
	document.getElementById('flash_player_film').innerHTML = '<script type="text/javascript" src="ufo.js"></script><embed src="mediaplayer.swf" width="'+video_width+'" height="'+video_height+'" allowscriptaccess="always" allowfullscreen="true" flashvars="width='+video_width+'&height='+video_height+'&file='+video_url+'&image=images/messebau.gif&displayheight='+video_height+'&searchbar=false&autostart=true" />';
	

	var position_y = arrayPageScroll[1] + (arrayPageSize[3] / 10);
	
	document.getElementById('flash_player').style.left = "50%";
	document.getElementById('flash_player').style.marginLeft = "-"+ (video_width / 2 ) +"px";
	document.getElementById('flash_player').style.top = position_y +"px";	
		

}


function hide_flash_player() {

	document.getElementById('flash_player_film').innerHTML = '';
	
	document.getElementById('flash_player_bg').style.visibility = "hidden";
	document.getElementById('flash_player').style.visibility = "hidden";

}


