var _DEFAULT_FLASH_VERSION = 7;
var _DEFAULT_BG_COLOR = '#B1DDC8';

function launch(windowWidth, windowHeight, theURL)	{
	windowAttributes = "top=100,left=100,screenX=100,screenY=100,height="+windowHeight+",width="+windowWidth+",resizable=no,scrollbars=no";
	if (parseInt(navigator.appVersion) >= 4) { littleWin = window.open(theURL, "_blank", windowAttributes); }
	setTimeout('littleWin.focus();',250);
}	
function launchNS(windowWidth, windowHeight, theURL)	{
	var winTop = Math.round((screen.height/2)-(windowHeight/2+20));
	var winLeft = Math.round((screen.width/2)-(windowWidth/2+10));
	windowAttributes = "top="+winTop+",left="+winLeft+",screenX="+winLeft+",screenY="+winTop+",height="+windowHeight+",width="+windowWidth+",resizable=no,scrollbars=no";
	if (parseInt(navigator.appVersion) >= 4) { littleWin = window.open(theURL, "_blank", windowAttributes); }
	setTimeout('littleWin.focus();',250);
}
// flash movie controls for IE/Win
var playing = true;
// detect type of browser
if (navigator.appName.indexOf("Microsoft")!=-1 && navigator.userAgent.indexOf("Mac")==-1) {
	var ieWin = true;
}
function startMusic() 
{
	// startMusic is only called by the video.php if music needed to be stopped anyway
	if (ieWin) {
		document.bollamovie.TCallLabel("/warnClip", "startMusicFrame");
		playing = true;
	}
}

// DOMLoaded init script
var DomLoaded =
{
	onload: [],
	loaded: function()
	{
		if (arguments.callee.done) return;
		arguments.callee.done = true;
		for (i = 0;i < DomLoaded.onload.length;i++) DomLoaded.onload[i]();
	},
	load: function(fireThis)
	{
		this.onload.push(fireThis);
		if (document.addEventListener) 
			document.addEventListener("DOMContentLoaded", DomLoaded.loaded, null);
		if (/KHTML|WebKit/i.test(navigator.userAgent))
		{ 
			var _timer = setInterval(function()
			{
				if (/loaded|complete/.test(document.readyState))
				{
					clearInterval(_timer);
					delete _timer;
					DomLoaded.loaded();
				}
			}, 10);
		}
		/*@cc_on @*/
		/*@if (@_win32)
		var proto = "src='javascript:void(0)'";
		if (location.protocol == "https:") proto = "src=//0";
		document.write("<scr"+"ipt id=__ie_onload defer " + proto + "><\/scr"+"ipt>");
		var script = document.getElementById("__ie_onload");
		script.onreadystatechange = function() {
			if (this.readyState == "complete") {
				DomLoaded.loaded();
			}
		};
		/*@end @*/
	   window.onload = DomLoaded.loaded;
	}
};

// function inserts flash into a div.
function insertFlash( div, swf, width, height, bgcolor, params) {
	var el = document.getElementById( div );
	if (typeof(el)=='undefined') return;
	// set default bgcolor if not provided
	if(!bgcolor || bgcolor=="") bgcolor = _DEFAULT_BG_COLOR;
	if(!params) params = new Object();
	if(!params.version) params.version = _DEFAULT_FLASH_VERSION;
	// parse parameters
	var objectParams = "";
	var embedParams = "";
	for(var i in params) {
		objectParams += "<param name="+i+" value=\""+params[i]+"\">\n";
		embedParams += i+"=\""+params[i] + "\" ";
	}
	// write the object
	var objHTML = 	"<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" " +
						"codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="+params.version+"\"" +
						"width=\""+width+"\" height=\""+height+"\" id=\"flash\">" +
						"<param name=\"movie\" value=\""+swf+"\">" +
						"<param name=\"quality\" value=\"high\">" +
						"<param name=\"bgcolor\" value="+bgcolor+">" +
						objectParams +
						"<embed src=\""+swf+"\" quality=\"high\" bgcolor=\""+bgcolor+"\"  width=\""+width+"\" height=\""+height+"\" " +
							embedParams +
							"type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"></embed>" +
					"</object>";
	el.innerHTML = objHTML;
}