/** 
 * Main page announce
 */

if(typeof(window['_$']) !== 'function')
{
	function _$(id){
		return document.getElementById(id);
	}
}

/**
 * Size of DIV: 394x334, 480x284, 490x301,
 */
function showVideoPlayer(file, title, href)
{
		if(href) {
    		var url_href = href;
		}
		else {
		    var url_href = document.location.href;
		}
		url_href = url_href.replace('http://', '');
		url_href = url_href.replace('www.', '');
		url_href = url_href.replace(/\//gi, '_');
					

	var divPlayer  = _$('anons_player');

	var sizePlayerWidth  = 320;
	var sizePlayerHeight = 240;

	var sizeWidth  = sizePlayerWidth + 10;
	var sizeHeight = sizePlayerHeight + 29;

	if(href === undefined || href =='')
		href = 'javascript:void(0)';

	_$('anons_title').innerHTML = title;
	_$('anons_title').href = href;
		
		
	if(_$('player_flv'))
	  cleanNode( _$('player_flv'));
	// 480x272, 470x255
	
	var so = new SWFObject('/js/jw_flv_player/flvplayer.swf','mpl', sizePlayerWidth, sizePlayerHeight,'7');
	so.addParam('allowscriptaccess','always');
	so.addParam('allowfullscreen','true');
	so.addVariable('width', sizePlayerWidth);
	so.addVariable('height', sizePlayerHeight);
	so.addVariable('wmode','opaque');
	so.addVariable('autostart','true');
	so.addVariable('volume','60');
	so.addVariable('image','/img/pages/re_logo.jpg');
	so.addVariable('file', file);
	so.write('player_flv');

	
	var oBody = document.getElementsByTagName("body")[0];
	divPlayer.style.display = 'block';

  	var theHandle = document.getElementById("player_move");
  	var theRoot   = document.getElementById("anons_player");
  	Drag.init(theHandle, theRoot);
}


function showVideoPlayer1(file, title, href)
{
		if(href) {
    		var url_href = href;
		}
		else {
		    var url_href = document.location.href;
		}
		url_href = url_href.replace('http://', '');
		url_href = url_href.replace('www.', '');
		url_href = url_href.replace(/\//gi, '_');
					

	var divPlayer  = _$('anons_player');

	var sizePlayerWidth  = 320;
	var sizePlayerHeight = 240;

	var sizeWidth  = sizePlayerWidth + 10;
	var sizeHeight = sizePlayerHeight + 29;

	if(href === undefined || href =='')
		href = 'javascript:void(0)';

	_$('anons_title').innerHTML = title;
	_$('anons_title').href = href;
		
		
	if(_$('player_flv'))
	  cleanNode( _$('player_flv'));
	// 480x272, 470x255
	
	var so = new SWFObject('/js/jw_flv_player/flvplayer.swf','mpl', sizePlayerWidth, sizePlayerHeight,'7');
	so.addParam('allowscriptaccess','always');
	so.addParam('allowfullscreen','true');
	so.addVariable('width', sizePlayerWidth);
	so.addVariable('height', sizePlayerHeight);
	so.addVariable('wmode','opaque');
	so.addVariable('autostart','true');
	so.addVariable('volume','60');
	so.addVariable('image','/img/pages/re_logo.jpg');
	so.addVariable('file', file);
	so.write('player_flv');

	var oBody = document.getElementsByTagName("body")[0];
	divPlayer.style.top  = toInt(toInt(oBody.clientHeight)/2) + toInt(oBody.scrollTop) - toInt(sizeHeight/2) + 'px';
	divPlayer.style.left = toInt(toInt(oBody.clientWidth)/2) + toInt(oBody.scrollLeft) - toInt(sizeWidth/2) + 'px';
	divPlayer.style.display = 'block';

  var theHandle = document.getElementById("player_move");
  var theRoot   = document.getElementById("anons_player");
  Drag.init(theHandle, theRoot);
}



function closeVideoPlayer()
{
	_$('anons_player').style.display = 'none';
	cleanNode( _$('player_flv'));
}

function toInt(value)
{
	return parseInt(value, 10);
}

function cleanNode(dest)
{
	while (dest.firstChild)
			dest.removeChild(dest.firstChild);
}