function getElement(elementId)
{
	return document.getElementById(elementId);
}

function openPopup(pageUrl, popupName, popupWidth, popupHeight, showScrollbar) 
{
	var iWidth = popupWidth;
	var iHeight = popupHeight;
	var leftVal = (screen.width-iWidth)/2;
	var topVal = (screen.height-iHeight)/2;
	
	if (showScrollbar == true) 
	{
		newWindow = window.open(pageUrl, popupName, 'width='+iWidth+',height='+iHeight+',left='+leftVal+',top='+topVal+',scrollbars=yes');
	}
	else
	{
		newWindow = window.open(pageUrl, popupName, 'width='+iWidth+',height='+iHeight+',left='+leftVal+',top='+topVal+',scrollbars=no');
	}
	
	if (parseInt(navigator.appVersion) >= 4) 
	{ 
		newWindow.window.focus(); 
	}

	return false;
}

function checkPremiumSize()
{
	var width;
	var height;

	if (document.layers) 
	{
		width = window.innerWidth;
		height = window.innerHeight;
	} 
	else 
	{
		width = document.body.clientWidth;
		height = document.body.clientHeight;
	} 
	
	if ((width != 759) || (height != 600))
	{
		setTimeout("resizeOuterTo(759,600)", 200);
	}
}

function resizeOuterTo(w,h) 
{
	if (parseInt(navigator.appVersion)>3) 
	{
		if (navigator.appName=="Netscape") 
		{
			top.outerWidth=w;
			top.outerHeight=h+40;
		} 
		else
		{
			top.resizeTo((w+12),(h+30));
		}
	}
}

function openVideo(pageUrl, popupWidth, popupHeight) 
{
	var iWidth = popupWidth;
	var iHeight = popupHeight;
	var leftVal = (document.body.clientWidth-iWidth)/2;
	var topVal = (document.body.clientHeight-iHeight)/2;
	
	if(divE = getElement('video-popin')) {
		document.body.removeChild(divE);
/*		divE.style.display = 'block';
		getElement('video-player').SetVariable("player:jsStop", "");
		getElement('video-player').SetVariable('player:jsUrl',pageUrl);
		getElement('video-player').SetVariable("player:jsPlay", "");
		return false;*/
	} 
	
	var container = document.createElement("div");
	container.setAttribute('id','video-popin');
//	container.setAttribute('onclick',"closeVideo()");
	
	var close = document.createElement("a");
	close.setAttribute('id','video-close');
	close.setAttribute('onclick','closeVideo();');
	close.setAttribute('href','javascript:closeVideo();');
	close.innerHTML = "X";
		
	var div = document.createElement("div");
	div.style.marginTop = topVal;
	
	div.innerHTML = '<object id="video-player" type="application/x-shockwave-flash" data="/medias/video/player_flv_maxi.swf" width="'+iWidth+'" height="'+iHeight+'"><param name="movie" value="/medias/video/player_flv_maxi.swf" /><param name="allowFullScreen" value="true"><param name="wmode" value="opaque" /><param name="FlashVars" value="flv='+escape(pageUrl)+'&amp;width='+iWidth+'&amp;height='+iHeight+'&amp;configxml=/medias/video/config_player.xml" /></object>';
	
	
	/*
	var o = document.createElement("object")
	o.setAttribute('type', 'application/x-shockwave-flash');
	o.setAttribute('data', '/medias/video/player_flv_maxi.swf');
	o.setAttribute("width", iWidth);
	o.setAttribute("height", iHeight);
		
	param1 = document.createElement('param');
	param1.setAttribute('name','movie');
	param1.setAttribute('value','/medias/video/player_flv_maxi.swf');
	o.appendChild(param1);
	
	param2 = document.createElement('param');
	param2.setAttribute('name','flashvars');
	param2.setAttribute('value','autoplay=1&amp;showvolume=1&amp;showstop=1&amp;showtime=1&amp;showfullscreen=1&amp;flv='+pageUrl);
	o.appendChild(param2);
	
	param3 = document.createElement('param');
	param3.setAttribute('name','wmode');
	param3.setAttribute('value',"opaque");
	o.appendChild(param3);
	
	div.appendChild(o);
	*/
	
	div.appendChild(close);
	container.appendChild(div);

//	if (navigator.appName == 'Microsoft Internet Explorer' && document.body.style.msInterpolationMode == undefined) {
	if (navigator.appName == 'Microsoft Internet Explorer') {
		container.style.position = 'absolute';
//		container.style.top = document.body.scrollTop;
		container.style.height = document.body.scrollHeight;
		div.style.marginTop = topVal + document.body.scrollTop;
	}
	document.body.appendChild(container);
	
/*	document.write('<div id="video-popin"><object type="application/x-shockwave-flash" data="/medias/video/player_flv_maxi.swf" width="" height=""><param name="movie" value="/medias/video/player_flv_maxi.swf" /><param name="FlashVars" value="" /></object></div>');
	div = getElement('video-popin');*/
	
	return false;
}

function closeVideo() {
	getElement('video-player').SetVariable("player:jsStop", "");
	getElement('video-popin').style.display = 'none';
}

