/*
 * Default FlowPlayer fullscreen opener.
 * http://flowplayer.org
 */
 
var isFullScreen = false;
 
function setWidth() {

	document.getElementById('fplayer').width = 800;

}

function flowPlayerOpenFullScreen(config) {
	if(isFullScreen){
		document.getElementsByTagName("body")[0].style.overflow = '';
		document.getElementsByTagName("html")[0].style.overflow = '';
	
		var fsdiv = this.parent.document.getElementById('PlayerBox_flv');
		fsdiv.removeAttribute("style");
		fsdiv.style.position = 'relative';
		//fsdiv.style.left = 0;
		//fsdiv.style.top = 5;
		
		if(document.getElementById('player_ul') != null){
			fsdiv.style.width = "300px";
			fsdiv.style.height = "280px";
		}else{
			fsdiv.style.width = "600px";
			fsdiv.style.height = "378px";
		}

		var stars = document.getElementsByTagName('ul');
		for(var i=0; i<stars.length; i++){
			stars[i].style.display = '';
		}
		var stars = document.getElementsByTagName('select');
		for(var i=0; i<stars.length; i++){
			stars[i].style.display = '';
		}
		
		if(document.getElementById('player_ul') != null){
			document.getElementById('fplayer').style.width = "300px";
			document.getElementById('fplayer').style.height = "280px";
		}else{
			document.getElementById('fplayer').style.width = "600px";
			document.getElementById('fplayer').style.height = "378px";
		}

		isFullScreen = false;
		
	} else {
		var winWidth = 0;
		var winHeight = 0;
		
		window.scrollTo(0,0);
		
		document.getElementsByTagName("body")[0].style.overflow = 'hidden';
		document.getElementsByTagName("html")[0].style.overflow = 'hidden';
	
		if(!window.innerWidth) {
			//strict mode
			if(!(document.documentElement.clientWidth == 0)) {
				winWidth = document.documentElement.clientWidth;
				winHeight = document.documentElement.clientHeight;
			//quirks mode
			} else { 
				winWidth = document.body.clientWidth;
				winHeight = document.body.clientHeight;
			}
		//w3c
		} else { 
			winWidth = window.innerWidth;
			winHeight = window.innerHeight;
		}
		
	  
		var playerDiv = document.getElementById('PlayerBox_flv');	
		playerDiv.style.width = winWidth+"px";
		playerDiv.style.height = winHeight+"px";
		
		playerDiv.style.position = "absolute";
		playerDiv.style.left = document.body.scrollLeft;
		playerDiv.style.top = document.body.scrollTop;

		//api.width = playerDiv.style.width;
		document.getElementById('fplayer').style.width = winWidth+"px";
		winHeight -= 3;
		document.getElementById('fplayer').style.height = winHeight+"px";
		//api.height = playerDiv.style.height;
		
		var stars = document.getElementsByTagName('ul');
		for(var i=0; i<stars.length; i++){
			if(stars[i].id == 'player_ul') continue;
			stars[i].style.display = 'none';
		}
		var stars = document.getElementsByTagName('select');
		for(var i=0; i<stars.length; i++){
			stars[i].style.display = 'none';
		}
	 
		isFullScreen = true;
	}
/*	
	var newdiv = document.createElement('div');
	newdiv.setAttribute('id', "FullscreenDIV");
	newdiv.style.width = winWidth - 30;
	newdiv.style.height = winHeight - 10;
	
	newdiv.style.position = "absolute";
	newdiv.style.left = document.body.scrollLeft + 5;
	newdiv.style.top = document.body.scrollTop + 5;
	
	newdiv.style.background = "#CCCCCC";
	newdiv.style.border = "1px dashed #000";
	
	newdiv.innerHTML = '<iframe id="fi" width="100%" height="100%" frameborder="0" src="fullscreen.html?config=' + config + '"></iframe>';
	document.body.appendChild(newdiv);
*/
  //window.open('fullscreen.html?config='+config, 'FlowPlayer', 'left=0,top=0,width='+winWidth+',height='+winHeight+',status=no,resizable=yes');
  
}

function flowPlayerExitFullScreen(config) {
	
	var fsdiv = this.parent.document.getElementById('PlayerBox_flv');
	fsdiv.style.width = undefined;
	fsdiv.style.height = undefined;
	fsdiv.style.position = undefined;
	fsdiv.style.left = undefined;
	fsdiv.style.top = undefined;
	
	api.width = 600;
	api.height = 378;
  
	return;
}

function resizeDiv(){

	//debugger;
	//alert(api.width == 590 && api.height == 367);
	//alert(document.getElementById('fplayer').width);
	if(!isFullScreen) return;
	
	var winWidth = 0;
	var winHeight = 0;
  
	if(!window.innerWidth) {
		//strict mode
		if(!(document.documentElement.clientWidth == 0)) {
			winWidth = document.documentElement.clientWidth;
			winHeight = document.documentElement.clientHeight;
		//quirks mode
		} else { 
			winWidth = document.body.clientWidth;
			winHeight = document.body.clientHeight;
		}
	//w3c
	} else { 
		winWidth = window.innerWidth;
		winHeight = window.innerHeight;
	}

	var playerDiv = document.getElementById('PlayerBox_flv');
	playerDiv.style.width = winWidth+"px";
	playerDiv.style.height = winHeight+"px";
	
	playerDiv.style.position = "absolute";
	playerDiv.style.left = document.body.scrollLeft;
	playerDiv.style.top = document.body.scrollTop;

	document.getElementById('fplayer').style.width = winWidth+"px";
	winHeight -= 3;
	document.getElementById('fplayer').style.height = winHeight+"px";
	
return;
	fsdiv.style.width = winWidth - 30;
	fsdiv.style.height = winHeight - 10;
	
	fsdiv.style.position = "absolute";
	fsdiv.style.left = document.body.scrollLeft + 5;
	fsdiv.style.top = document.body.scrollTop + 5;
}

function getScrollerWidth() {
    var scr = null;
    var inn = null;
    var wNoScroll = 0;
    var wScroll = 0;

    // Outer scrolling div
    scr = document.createElement('div');
    scr.style.position = 'absolute';
    scr.style.top = '-1000px';
    scr.style.left = '-1000px';
    scr.style.width = '100px';
    scr.style.height = '50px';
    // Start with no scrollbar
    scr.style.overflow = 'hidden';

    // Inner content div
    inn = document.createElement('div');
    inn.style.width = '100%';
    inn.style.height = '200px';

    // Put the inner div in the scrolling div
    scr.appendChild(inn);
    // Append the scrolling div to the doc
    document.body.appendChild(scr);

    // Width of the inner div sans scrollbar
    wNoScroll = inn.offsetWidth;
    // Add the scrollbar
    scr.style.overflow = 'auto';
    // Width of the inner div width scrollbar
    wScroll = inn.offsetWidth;

    // Remove the scrolling div from the doc
    document.body.removeChild(
        document.body.lastChild);

    // Pixel width of the scroller
    return (wNoScroll - wScroll);
}

function hasHSB()
{
	if (parseInt(navigator.appVersion)>3) {
		if (navigator.appName=="Netscape") {
			if (window.innerHeight < window.outerHeight)
				return true;
			else
				return false;
		}
		if (navigator.appName.indexOf("Microsoft")!=-1) {
			if (document.body.clientHeight < document.body.offsetHeight)
				return true;
			else
				return false;
		}
	}
} 
