var isFullScreen = false;
var preFullScreenLeft = 0;
var preFullScreenTop = 0;
var preFullScreenWidth = 0;
var preFullScreenHeight = 0;

function log(msg)
{
	if(document.controls.log != undefined)
		document.controls.log.value = msg + "\n" + document.controls.log.value;
}

function clearLog()
{
	if(document.controls.log != undefined)
		document.controls.log.value = "";
}

function getDomain()
{
	var domain = document.location.toString();
	// Check if the url starts with 'http'
	if(domain.indexOf("http") == 0)
		domain = domain.substring(7, domain.indexOf("/", 8));
	else if(domain.indexOf("https") == 0)
		domain = domain.substring(8, domain.indexOf("/", 9));
	else
		domain = domain.substring(0, domain.indexOf("/"));
		
	// If url doesn't start with 'www', then concatenate 'www' on start of the domain name
	if(domain.indexOf("www") != 0)
		domain = "www." + domain;

	return domain;
}

var isFullScreen=false;
var oldXPositions = new Object(); 
var oldYPositions = new Object();
var oldScrollBar = "no";

function ScaleVideo() {	

	var flashDiv = document.getElementById("flashDiv");
	var wrapper = document.getElementById('divWrapper');
	
	if (!isFullScreen) {
		
		oldXPositions["divPlayer"] = document.getElementById("divPlayer").offsetLeft
		document.getElementById("divPlayer").style.left="-1000";
		oldYPositions["divPlayer"] = document.getElementById("divPlayer").offsetTop
		document.getElementById("divPlayer").style.top="-1000";
		document.body.className = "scaled";		
	
		document.getElementById('divPlayer').className = "scaled";
		document.getElementById('divPlayer').style.left = "0px"
		document.getElementById('divPlayer').style.top = "0px"
		document.getElementById('divModVideo').className = "scaledFLV";

		flashDiv.className = "scaled";
		
		// hide the scroll bar in full screen mode
		oldScrollBar = document.body.scroll;
		document.body.scroll = "no";
	} 
	else 
	{
		document.getElementById("divPlayer").style.left = oldXPositions["divPlayer"] + "px"
		document.getElementById("divPlayer").style.top = oldYPositions["divPlayer"] + "px"
		document.body.className = "";
		document.getElementById('divPlayer').className = "";
		document.getElementById('divModVideo').className = "";
		flashDiv.className = "";

		oldXPositions = new Object();
		oldYPositions = new Object();
		
		// restore the actual scroll bar status
		document.body.scroll = oldScrollBar;
	}
	
	isFullScreen = !isFullScreen;
}

function showInFullScreen(fs)
{
	ScaleVideo(fs);
}