﻿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 Lvl_openWin(u,n,w,h,l,t,c,f,x) 
{
	var ww=((screen.width-w)/2);
	if(c==1)
	{
		l=ww;
		t=(screen.height-h)/2;
	}
	if(c==2)
	{
		l=ww
	}
	f+=',top='+t+',left='+l;
	LvlWin = window.open(u,n,f);
	if(x==1)
	{
		LvlWin.focus()
	}
	document.MM_returnValue=false;
}
function checkFormFocus(e, f) {
	if(window.event) // IE
		keynum = e.keyCode
	else if(e.which) // Netscape/Firefox/Opera
		keynum = e.which
	
	if(keynum == 13) {
		document.forms[f].submit();
		return true;
	}
	return true;
}
function getWindowWidth(){
	if(window.innerWidth) return window.innerWidth;
	if(document.documentElement && document.documentElement.clientWidth){
		return document.documentElement.clientWidth;
	}
	else if(document.body && document.body.clientWidth){
		return document.body.clientWidth;
	}
	return 0;
}

function getWindowHeight(){
	if(window.innerHeight) return window.innerHeight;
	if(document.documentElement && document.documentElement.clientHeight){
		return document.documentElement.clientHeight;
	}
	else if(document.body && document.body.clientHeight){
	return document.body.clientHeight;
	}
	return 0;
}
// VIDEOPLAYER FUNCTIONS
function openWinPlayer(u,n,w,h,l,t,c,f,x) {
	var ww=((screen.width-w)/2);
	if(c==1)
	{
		l=ww;
		t=(screen.height-h)/2;
	}
	if(c==2)
	{
		l=ww
	}
	f += ',top ='+t+',left='+l;
	LvlWin = window.open(u,n,f);
	if(x==1)
	{
		LvlWin.focus()
	}
	// hack Syrous 
	LvlWin.resizeTo(w, h);
	if(c==1)
	{
		var bw = (screen.width-w)/2;
		var bh = (screen.height-h)/2;
		LvlWin.moveTo(bw, bh);
	}
	document.MM_returnValue=false;
}
function open_player(video_id) {
	var width=screen.availWidth;
	var height=screen.availHeight;
	// Case kleiner gleich 1024 ffnet PLayer Fullscreen mit der vorhanden Screengre
	if(width<=1024)
	{
		openWinPlayer('videoplayer.cfm?video_id=' + video_id,'v2b_videoplayer',width,height,'0','0','1','width=' + width + ',height=' + height,'1');	
	}
	// Case grer 1024 und kleiner gleich 1280
	else if ((width > 1024) && (width <= 1280))
	{
		width = 1058;
		height = 770;
	}
	// Case grer 1280 und kleiner gleich 1280
	else if (width > 1280)
	{
		width = 1306;
		height = 855;
	}
	openWinPlayer('videoplayer.cfm?video_id=' + video_id,'v2b_videoplayer',width,height,'0','0','1','width=' + width + ',height=' + height, '1');	
}
function resizePlayer(){
	var width=screen.availWidth;
	var height=screen.availHeight;
	var bw = 0;
	var bh = 0;
	window.moveTo(bw, bh);
	window.resizeTo(width, height);
}
function resetPlayer()
{
	var width=screen.availWidth;
	var height=screen.availHeight;
	// Case kleiner gleich 1024 ffnet PLayer Fullscreen mit der vorhanden Screengre
	if(width<=1024)
	{
		width = 1024;
	}
	// Case grer 1024 und kleiner gleich 1280
	else if ((width > 1024) && (width <= 1280))
	{
		width = 1058;
		height = 770;
	}
	// Case grer 1280 und kleiner gleich 1280
	else if (width > 1280)
	{
		width = 1306;
		height = 855;
	}
	window.resizeTo(width, height);
	var bw = (screen.width - width)/2;
	var bh = (screen.height - height)/2;
	window.moveTo(bw, bh);	
}
