var h = document.getElementsByTagName('head')[0];
var h1  = document.createElement("link");

//var cc= document.createComment('[if !IE]><link rel="stylesheet" type="text/css" href="css/lightwindow.css" /><![endif]');
//var ccie= document.createComment('[if IE]><script type="text/javascript" src="javascript/lightwindowIE.js"></script><link rel="stylesheet" type="text/css" href="css/lightwindowIE.css" /><![endif]');


/*var lw = document.createElement("script");
lw.type = "text/javascript";
lw.src = "js/lightwindow.js";

var lwcss = document.createElement("link");
lwcss.setAttribute('rel','stylesheet');
lwcss.setAttribute('type','text/css');
lwcss.setAttribute('href','css/lightwindow.css');


var lwie = document.createElement("script");
lwie.type = "text/javascript";
lwie.src = "js/lightwindowIE.js";

var lwcssie = document.createElement("link");
lwcssie.rel = "stylesheet";
lwcssie.type = "text/css";
lwcssie.href = "css/lightwindowIE.css";

var isMSIE =  false /*@cc_on || true @*/; 
/*
if (isMSIE) {
	h.appendChild(lwie);
	h.appendChild(lwcssie);
} else {
	h.appendChild(lw);
	h.appendChild(lwcss);
}
*/
//document.getElementsByTagName('head')[0].appendChild(cc);
//document.getElementsByTagName('head')[0].appendChild(ccie);


function calcPosition (width, height)
{
    if (window.innerWidth) {
        l = ((window.innerWidth-width)/2);
        t = ((window.innerHeight-height)/2);
} else {
// document.body.offsetWidth
        l = ((document.body.offsetWidth-width)/2);
        t = ((document.body.offsetHeight-height)/2);
}

    if(l < 0)
        l = 0;

    if(t < 0)
        t = 0;

    document.getElementById("lightwindow_container").style.left= l + "px";
    document.getElementById("lightwindow_container").style.top= t + "px";
}

function reCalcPosition ()
{
    width  = document.getElementById("lightwindow_container").offsetWidth;
    height = document.getElementById("lightwindow_container").offsetHeight;

    if (navigator.appName != "Microsoft Internet Explorer") 
        calcPosition(width, height);
}

//reCalcPosition();

function openVideoplayer (flv, w, h, ts) {
	//reCalcPosition();
	myLightWindow.activateWindow({
		href: 'cdn/cdnplayer.swf?path=cdn/&flv='+flv+'&w='+w+'&h='+h+'&ts='+ts,
		width: w,
		height: h,
		title: ''
	});
	//alert("TS: " + ts)
	//reCalcPosition();
}
//alert(document.documentElement.innerHTML);
