﻿function addEvent(obj, ev, fu) {
	if (obj.attachEvent)
		obj.attachEvent("on" + ev, fu);
	else
		obj.addEventListener(ev, fu, false);
}

function popWindow() {
	var me = this;
	this.screen = document.createElement("div");
	this.screen.style.cssText = "top:0; left:0; filter:alpha(opacity=60); opacity:0.6; width:100%; height:10000px; position:fixed; z-index:500; background-color:#000; display:none;";
	this.wndow = document.createElement("div");
	this.wndow.style.cssText = "top:25%; left:30%; position:absolute; z-index:600; display:none; background-color:transparent;";
	this.winid = null;
	this.draw = function() {
		me.wndow.style.width = me.width+"px";
		me.wndow.style.height = me.height+"px";
		if(me.winid==null)
			me.wndow.id = "divscreenWindow";
		else
			me.wndow.id = me.winid;
		
		addEvent(window,'load',function(){
			document.body.insertBefore(me.screen, document.body.firstChild);
			document.body.insertBefore(me.wndow, document.body.firstChild);
		});
	}
	this.redraw = function() {
		me.wndow.style.width = me.width+"px";
		me.wndow.style.height = me.height+"px";
	}
	this.show=function() {
		me.screen.style.display = "block";
		me.wndow.style.display = "block";
	}
	this.hide=function() {
		me.screen.style.display = "none";
		me.wndow.style.display = "none";
	}
}

var videoLoc, videoWidth, videoHeight;

function popVideo() {
	popWin.wndow.innerHTML = "\n	<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='" + videoWidth + "' height='" + videoHeight + "' id='FLVPlayer'>\n"
	+ "		<param name='movie' value='/includes/pages/all/flash/FLVPlayer_Progressive.swf' />\n"
	+ "		<param name='salign' value='lt' />\n"
	+ "		<param name='quality' value='high' />\n"
	+ "		<param name='scale' value='noscale' />\n"
	+ "		<param name='FlashVars' value='&MM_ComponentVersion=1&skinName=Clear_Skin_1&streamName=" + videoLoc + "&autoPlay=true&autoRewind=false' />\n"
	+ "		<embed src='/includes/pages/all/flash/FLVPlayer_Progressive.swf' flashvars='&MM_ComponentVersion=1&skinName=Clear_Skin_1&streamName=" + videoLoc + "&autoPlay=true&autoRewind=false' quality='high' scale='noscale' width='" + videoWidth + "' height='" + videoHeight + "' name='FLVPlayer' salign='LT' type='application/x-shockwave-flash' pluginspage='http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash' />\n"
	+ "	</object><br />\n"
	+ "	<a href='javascript:popWin.hide();'>Close Window</a>";
	popWin.show();
}
