resizeList = [];
function loadvideo(videos) {
	var varray = videos.split("|");
	var video = varray[0];
	var flvvideos = '';
	var separator = '';
        div = document.getElementById('video');
        divResize('video');
        pwidth = parseInt(div.style.width);
        pheight = parseInt(div.style.height);
        div.innerHTML = '';
	for(var i=0;i<varray.length;i++) {
		(flvvideos == '' ? separator = '' : separator = '|');
		flvvideos = 'http://media.cerebustv.com/exoss/'+varray[i]+'.flv'+separator+flvvideos;
		//var flvvideos = 'http://media.cerebustv.com/exoss/'+varray[i]+'.flv'+extra+flvvideos;
	}
        flvvideo = 'http://media.cerebustv.com/exoss/'+video+'.flv';
        databegin = '<div id="close" style="display:block;position:relative;right:0px;top:0px;height:29px;text-align:right;cursor:pointer;" onClick="closeVideo();return false;"> \
<div style="text-align:right;width:128px;color:white;font-weight:900;font-size:20px;position:absolute;top:1px;right:1px;z-index:200;">[X] close</div> \
<div style="text-align:right;width:128px;color:red;font-weight:100;font-size:20px;position:absolute;top:0px;right:0px;z-index:201;">[X] close</div> \
</div>';

        player = '<object type="application/x-shockwave-flash" data="player.swf" width="'+pwidth+'" height="'+pheight+'"> \
        <param name="movie" value="player.swf" /> \
<param name="allowFullScreen" value="true" /> \
    <param name="FlashVars" value="flv='+flvvideos+'&amp;startimage=images/videos/'+video+'.jpg&amp;width='+pwidth+'&amp;height='+pheight+'&amp;autoplay=1&amp;autoload=1&amp;showvolume=1&amp;showtime=2&amp;showopen=0&amp;showfullscreen=1&amp;showiconplay=0&amp;ondoubleclick=fullscreen" /> \
</object>';
        div.innerHTML = databegin+player;
        if(div.style.visibility == "hidden") {
                sfade('video');
        }
}

function closeVideo() {
        document.getElementById('video').innerHTML = '';
        sfade('video');
}

function getWidth() {
        return (!window.innerWidth ? document.body.clientWidth : window.innerWidth);
}
function getHeight() {
        return (!window.innerHeight ? document.body.clientHeight : window.innerHeight);
}

function divResize(id, maxw, maxh) {
        div = document.getElementById(id);
        curwidth = getWidth();
        curheight = getHeight();
        oldwidth = parseInt(div.style.width);
        oldheight = parseInt(div.style.height);
        div.removeAttribute('width');
        div.removeAttribute('height');
        if (oldwidth < 640) {
                div.style.height = (oldheight / (oldwidth/(640)));
                div.style.width = 640;
        }
        if (oldwidth > curwidth) {
                div.style.height = (oldheight / (oldwidth/(curwidth - 64)));
                div.style.width = curwidth-64;
        }
        if (oldheight > curheight) {
                div.style.width = (oldwidth / (oldheight/(curheight - 64)));
                div.style.height = curheight-64;
        }
        div.style.marginLeft = -parseInt(div.style.width)/2;
        div.style.marginTop = -parseInt(div.style.height)/2;
}

function doResize() {
        for (var i=0;i<resizeList.length;i++) {
                divResize(resizeList[i]);
        }
}

