//Mini
var flashvarsMin = { path: "" };
var paramsMin = { menu: "false", allowFullScreen: "false" };

//Guest
var flashvarsMax = { advPictureUrl: "http://80.237.159.89/etv/swf/mat/advertising/default.png", advUrl: "http://www.aw100.de", advFrame: "_blank" };
var paramsMax = { menu: "false", allowFullScreen: "true" };

function centerBox(id)
{
	if(document.getElementById(id))
	{
		with(document.getElementById(id).style)
		{
			var iHeight=Number(height.replace(/px/g,""));
			var iWidth=Number(width.replace(/px/g,""));
			var iTop=(getHeightWidth("h")/2)-(iHeight/2);
			var iLeft=(getHeightWidth("w")/2)-(iWidth/2);
			left=iLeft+"px";
			top=iTop+"px";
		}
	}
}

function getHeightWidth(v)
{
	var x,y;
	if(self.innerHeight)
	{
		x=self.innerWidth;
		y=self.innerHeight;
	}
	else if(document.documentElement && document.documentElement.clientHeight)
	{
		x=document.documentElement.clientWidth;
		y=document.documentElement.clientHeight;
	}
	else if(document.body)
	{
		x=document.body.clientWidth;
		y=document.body.clientHeight;
	}
	return (v.toLowerCase() == "h") ? y : x;
}

// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.org
// Edit for Firefox by pHaez
//
function getPageSize()
{
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY)
	{
		xScroll = document.body.scrollWidth;
		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
		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 = windowWidth;
	}
	else
	{
		pageWidth = xScroll;
	}
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
	return arrayPageSize;
}

function disconnect()
{
//	flashContentMin.disconnect();
//	flashContentMax.disconnect();
}

function unloadMini()
{
	swfobject.embedSWF("http://www.ra-micro.de/ra-micro/filme/mini-white.swf", "flashContentMin", "0", "0", "9.0.0", "false", flashvarsMin, paramsMin);
}

function loadMini()
{
	swfobject.embedSWF("http://www.ra-micro.de/ra-micro/filme/mini-container.swf", "flashContentMin", "170", "110", "9.0.0", "false", flashvarsMin, paramsMin);
}

function showMaxPlayer()
{
	var objOverlay=document.getElementById('overlay');
	var arrayPageSize=getPageSize();
	unloadMini();
	objOverlay.style.height=(arrayPageSize[1] + 'px');
	objOverlay.style.display='block';
	centerBox("maxplayer");
	document.getElementById("maxplayer").style.display="block";
}


//Mini
function startGuest(directUrl, directFrame)
{
	showMaxPlayer();
	return true;
}

//Guest
function closeWindow()
{
	document.getElementById("maxplayer").style.display="none";
	var objOverlay=document.getElementById('overlay');
	objOverlay.style.display='none';
	objOverlay.style.height=0;
	loadMini();
	return true;
}

function minimizeWindow()
{
	return true;
}
