
var video_container_runing = false;
var current_video_url;
var current_type;
var current_content_url;
var current_content_width;
var current_content_height;
var current_content_bg;

function ConfVideoContainer(){

	go('divSombra').css('position', 'fixed');
	go('divSombra').css('background-color', '#000000');
	go('divSombra').setX(0);
	go('divSombra').setY(0);
	go('divSombra').setW(Screen.Width);
	go('divSombra').setH(Sum([Screen.Height, 20]));
	go('divSombra').hide();
	
}

function MostrarAreaContenido(pType, pURL, pWidth, pHeight){

	ConfVideoContainer();
	
	
	current_content_url = pURL;
	current_type = pType;
	
	if(current_type == 'branquea'){
		
		video_container_runing = true;
		
		var repro_container;
		
		repro_container = go(document.body).newdiv('video.player.div');
		
		if (pWidth){
		  current_content_width = pWidth;	
		} else {
			current_content_width = 800;
		}
		
		if (pHeight){
		  current_content_height = pHeight;	
		} else {
			current_content_height = 500;
		}

		current_content_bg = 'transparent';
		
		
		go('divSombra').raiseTop();
		go('divSombra').alpha(0);
		go('divSombra').display();
		go('divSombra').fadein(100, 80, function(){
			
			repro_container.css('position', 'fixed');
			repro_container.css('background-color', current_content_bg);
			
			
			repro_container.css('background-color', current_content_bg);
			
			var TableContainer = '';
			
			TableContainer += '<table border="0" cellpadding="0" cellspacing="0">'
			
			TableContainer += '<tr>'
			TableContainer += '<td height="1" width="1"><img src="images/ctrl11.png" border="0"></td>'
			TableContainer += '<td height="1" background="images/ctrlfdo.png"><img src="images/ctrlfdo.png" border="0"></td>'
			TableContainer += '<td height="1" width="1"><img src="images/ctrl13.png" border="0"></td>'
			TableContainer += '</tr>'
			
			TableContainer += '<tr>'
			TableContainer += '<td width="1" background="images/ctrlfdo.png"><img src="images/ctrlfdo.png" border="0"></td>'
			TableContainer += '<td>'
			TableContainer += '<iframe src="' + current_content_url + '" frameborder="0" width="' + current_content_width + '" height="' + current_content_height + '" scrolling="no"></iframe>'
			TableContainer += '</td>'
			TableContainer += '<td width="1" background="images/ctrlfdo.png"><img src="images/ctrlfdo.png" border="0"></td>'
			TableContainer += '</tr>'
			
			TableContainer += '<tr>'
			TableContainer += '<td height="1" width="1"><img src="images/ctrl31.png" border="0"></td>'
			TableContainer += '<td height="1" background="images/ctrlfdo.png"><img src="images/ctrlfdo.png" border="0"></td>'
			TableContainer += '<td height="1"width="1"><img src="images/ctrl33.png" border="0"></td>'
			TableContainer += '</tr>'
			
			TableContainer += '</table>'
			
			repro_container.html(TableContainer);		
			
			repro_container.setX(0);
			repro_container.setY(0);
			repro_container.setW(parseInt(current_content_width)+38);
			repro_container.setH(parseInt(current_content_height)+100);
			repro_container.raiseTop();
			repro_container.show(300, 'center->expand', function(){
			
				var close_btn = go(document.body).newdiv('video.player.close.div');
				
				close_btn.css('position', 'fixed');
				close_btn.css('overflow', 'hidden');
				close_btn.css('cursor', 'pointer');
				close_btn.setX(Sum([go('video.player.div').iLeft, current_content_width, 1]));
				close_btn.setY(parseInt(((Screen.Height - current_content_height)/2) - 44));
				close_btn.setW(34);
				close_btn.setH(34);
				close_btn.html('<img src="images/closebutton.png" />');
				close_btn.raiseTop();
				
				close_btn.click(function(me){
					go('video.player.div').parentNode.del('video.player.div');
					me.parentNode.del(me.id);
					go('divSombra').fadeout(100, 0, function(){
						go('divSombra').hide();
						video_container_runing = false;
					});
				})

			});
			
		});
		
	}
	
}

function Close()
{
		go('video.player.div').parentNode.del('video.player.div');
		go('video.player.close.div').parentNode.del('video.player.close.div');
		go('divSombra').fadeout(100, 0, function(){
			go('divSombra').hide();
			video_container_runing = false;});
}

Page.OnLoad(function(){

	ConfVideoContainer();
	
});
