function openVideo(id) {
	createZDiv();
	fade('zDiv');
	createMainWindow(id);
	showIFrame(id);
}
createZDiv=function() {
	var zDiv=document.createElement('div');
	zDiv.id='zDiv';
	zDiv.style.height=document.body.scrollHeight;
	zDiv.style.width=document.body.scrollWidth;
	zDiv.style.filter=0;
	
	if(zDiv.addEventListener) {
		zDiv.addEventListener("onclick", clear, false);
		document.body.addEventListener("onkeypress", keyPressHandler, false);
		} 
	else if (zDiv.attachEvent) {
		zDiv.attachEvent("onclick", clear);
		document.body.attachEvent("onkeypress", keyPressHandler);
	} 
	else {
		zDiv.onclick=clear;
		document.body.onkeypress=keyPressHandler;
	} 
	document.body.appendChild(zDiv);
}
createMainWindow=function() {
	var mw=document.createElement('div');
	mw.id='mw';
	mw.style.height='556px';
	mw.style.width='810px';
	mw.innerHTML=writeDivHeader();
	document.body.appendChild(mw);
}
showIFrame=function(id) {
	var iframe=document.createElement('iframe');
	iframe.id='iframe';
	iframe.height='100%';
	iframe.width='100%';
	iframe.frameborder=0;
	iframe.style.display='block';
	iframe.scrolling='no';
	iframe.src='http://crenews-tv.com/?id='+id;
	document.getElementById('mw').appendChild(iframe);
	return false;
}
fade=function() {
	x=0.6;
	obj=document.getElementById('zDiv');
	op=(obj.style.opacity)?parseFloat(obj.style.opacity):parseInt(obj.style.filter)/100;
	
	if(op<x) {
		op+=0.1;
		obj.style.opacity=op;
		obj.style.filter='alpha(opacity='+op*100+')';
		setTimeout("fade()",10);
	}
}
clear=function() {
	if(!!document.getElementById('zDiv')==false) return;
	
	x=0;
	obj=document.getElementById('zDiv');
	obj.style.filter='alpha(opacity=0)';
	obj.innerHTML="";
	var mw=document.getElementById('mw');
	var iframe=document.getElementById('iframe');
	iframe.visibility='hidden';
	mw.removeChild(iframe);
	document.body.removeChild(mw);
	document.body.removeChild(obj);
}
keyPressHandler=function(e) {
	var kC=(window.event)? event.keyCode : e.keyCode;
	var Esc=(window.event)? 27 : e.DOM_VK_ESCAPE;
	if(kC==Esc) clear();
}
writeDivHeader=function() {
	return '<div align="center" style="background:#cccccc;"><a href="javascript:clear();">Закрыть окно</a> или нажать клавишу Esc</div>';
}