// JavaScript Document

function openMoviePlayer(number) {
	window.open("moviePlayer.html?movie="+number, "_blank", "titlebar=0,scrollbars=0,resizable=0,menubar=0,toolbar=0,status=0,location=0,directories=0,width=720,height=585");
}

function openAudioPlayer(xmlFile) {
	window.open("/common/popups/mp3/mp3player.html?xmlFile="+xmlFile, "_blank", "titlebar=0,scrollbars=0,resizable=1,menubar=0,toolbar=0,status=0,location=0,directories=0,width=310,height=100");
}

function thisMovie(movieName) {
// IE and Netscape refer to the movie object differently.
// This function returns the appropriate syntax depending on the browser.
	if (navigator.appName.indexOf ("Microsoft") !=-1) {
		return window[movieName];
	} else {
		return document[movieName];
	}
}

function setVariableAndPlay(theVariable, theValue) {
	thisMovie(movieName).SetVariable(theVariable, theValue);
}

var movieName = "moviePlayer";

var mainSize;

function playBanner() {
mainSize = document.getElementById('main').offsetHeight;

	var myAnim = dojo.fx.chain([
	dojo.fadeOut({
		node: 'bannerImage',
		duration:1000,
		easing: dojox.fx.easing.easeOut,
		onEnd: function() {
			dojo.style("playImage","display","none");
		}
	}),
	dojo.animateProperty({
  		node : 'main',
		properties : {
			height : {start : mainSize, end : 0, unit : "px"}
   		}
	}),
	dojo.animateProperty({
		node: 'imagehead',
		properties : {
			height : {start : 250, end : 280, unit : "px"}
   		},
		onEnd: function() {
			dojo.style("bannerImage","display","none");
			dojo.style("bannerMovieHolder","display","block");
		}
	})]);

 myAnim.play();
 
	 /*
		A temporary fix until we know more about OpenCms : SB 1/5/09
		Problem: FF and Safari do not hide the logo div on playBanner()
	 */
	var bannerIm = document.getElementById('logo');
	bannerIm.style.zIndex=-1;
}

function closeBanner() {
	var n = document.getElementById('main');
	var myAnim = dojo.fx.chain([
	dojo.animateProperty({
		node: 'imagehead',
		properties : {
			height : {start : 280, end : 250, unit : "px"}
   		}
	}),
	dojo.animateProperty({
  		node : 'main',
		properties : {
			height : {start : 0, end : mainSize, unit : "px"}
   		},
		onEnd: function() {
			dojo.style("bannerImage","display","block");
		}
	}),
	dojo.fadeIn({
		node: 'bannerImage',
		duration:1000,
		easing: dojox.fx.easing.easeOut,
		onEnd: function() {
			dojo.style("playImage","display","inline");
		}
	})]);

 dojo.style("bannerMovieHolder","display","none");
 myAnim.play();
 
	 /*
		A temporary fix until we know more about OpenCms : SB 1/5/09
		Problem: FF and Safari do not display the logo div on closeBanner()
	 */
	var bannerIm = document.getElementById('logo');
	bannerIm.style.zIndex=5;

}


function lightboxMe() {

	var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
    
    myHeight += 20; 	// fix for 'just a bit too short in IE' bug
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
    
  	leftAmount = (myWidth - 800)/2;
  	topAmount = (myHeight - 564)/2;
  	
	document.getElementById("backdrop").style.height = myHeight+"px";
 	document.getElementById("backdrop").style.width = myWidth+"px";
	document.getElementById("backdrop").style.display = "block";
	document.getElementById("moviePlayerDiv").style.display = "block";
	document.getElementById("moviePlayerDiv").style.left = leftAmount+"px";
	document.getElementById("moviePlayerDiv").style.top = topAmount+"px";
}

function closePlayer() {
	document.getElementById("moviePlayerDiv").style.display = "none";
	document.getElementById("backdrop").style.display = "none";
	
}
