//really not important (the first two should be small for Opera's sake)
PositionX = 10;
PositionY = 10;
defaultWidth  = 600;
defaultHeight = 400;

//kinda important
var AutoClose = false;

//don't touch
function popFlashMovie(movieURL, movieTitle, movieWidth, movieHeight){
  var imgWin = window.open('','_blank','scrollbars=no,resizable=1,width=' + movieWidth+ ',height=' + movieHeight+ ',left=' + PositionX + ',top=' + PositionY);
  if( !imgWin ) { return true; } //popup blockers should not cause errors
  imgWin.document.write('<html><head><title>' + movieTitle + '<\/title><script type="text\/javascript" src="\/javascripts\/swfobject.js"></script><script type="text\/javascript">\n'+
    'function resizeWinTo() {\n'+
    '	var mvDiv = document.getElementById("movieDiv");\n'+
    '	var oW = mvDiv.offsetWidth, oH =  mvDiv.offsetHeight;\n'+
    '	if( !oH || window.doneAlready ) { return; }\n'+ //in case images are disabled
    '	window.doneAlready = true;\n'+ //for Safari and Opera
    '	var x = window;\n'+
    '	x.resizeTo( oW + 200, oH + 200 );\n'+
    '	var myW = 0, myH = 0, d = x.document.documentElement, b = x.document.body;\n'+
    '	if( x.innerWidth ) { myW = x.innerWidth; myH = x.innerHeight; }\n'+
    '	else if( d && d.clientWidth ) { myW = d.clientWidth; myH = d.clientHeight; }\n'+
    '	else if( b && b.clientWidth ) { myW = b.clientWidth; myH = b.clientHeight; }\n'+
    '	if( window.opera && !document.childNodes ) { myW += 16; }\n'+
    '	x.resizeTo( oW = oW + ( ( oW + 200 ) - myW ), oH = oH + ( (oH + 200 ) - myH ) );\n'+
    '	var scW = screen.availWidth ? screen.availWidth : screen.width;\n'+
    '	var scH = screen.availHeight ? screen.availHeight : screen.height;\n'+
    '	if( !window.opera ) { x.moveTo(Math.round((scW-oW)/2),Math.round((scH-oH)/2)); }\n'+
    '}\n'+
    '\n'+
    'function LoadMovie() {\n'+
    'var fo = new SWFObject("/flashs/mediaplayer.swf", "mediaplayer", "' + movieWidth + '", "' + movieHeight +'", "9", "#ffffff", true);\n'+
	'fo.addParam("allowScriptAccess", "always");\n'+
	'fo.addParam("allowfullscreen", "true");\n'+
	'fo.addVariable("autostart", "true");\n'+
	'fo.addVariable("width", ' + movieWidth + ');\n'+
	'fo.addVariable("height", ' + movieHeight + ');\n'+
	'fo.addVariable("file", ' + movieURL + ');\n'+
	'fo.addVariable("showicons", "false");\n'+
	'fo.addVariable("searchbar", "false");\n'+
	'fo.addVariable("showdigits", "false");\n'+
	'fo.write("movieDiv");\n'+
    '}\n'+
    '<\/script>'+
    '<\/head><body onload="LoadMovie();resizeWinTo();"' + (AutoClose ? ' onblur="self.close();"' : '') + '>'+
    (document.layers ? ('<layer left="0" top="0">') : ('<div style="position:absolute;left:0px;top:0px;display:table;">'))+
    '<div id="movieDiv">' + movieTitle + '</div>'+
    (document.layers ? '<\/layer>' : '<\/div>') + '<\/body><\/html>');
  imgWin.document.close();
  if( imgWin.focus ) { imgWin.focus(); }
  return false;
}


 function LoadMovie(movieURL, movieWidth, movieHeight, target, autostart) {
    var fo = new SWFObject("/flashs/mediaplayer.swf", "mediaplayer", movieWidth, movieHeight, "9", "#ffffff", true);
	fo.addParam("allowScriptAccess", "always");
	fo.addParam("allowfullscreen", "true");
	fo.addVariable("autostart", autostart);
	fo.addVariable("width", movieWidth);
	fo.addVariable("height", movieHeight);
	fo.addVariable("file", movieURL);
	fo.addVariable("showicons", "false");
	fo.addVariable("searchbar", "false");
	fo.addVariable("showdigits", "false"); 
	fo.write(target);
 }
 