// Scripts til flashloads - load flash uden om IE's sikkerhedsmodel.

function Flashees(){}

// returnerer browserens flashversion
Flashees.prototype.flashVersion = function(){
	var intMaxFlashVersion = 20;
	var intFlashVersion = 0;
	if (navigator.plugins && navigator.plugins.length) {
		for (var i = 0; i < navigator.plugins.length; i++) {
			if (navigator.plugins[i].name.indexOf('Shockwave Flash') != -1) {
				intFlashVersion = navigator.plugins[i].description.split('Shockwave Flash ')[1].charAt(0);
				break;
			}
		}
	} else if (window.ActiveXObject){
		for (var i = 2; i <= intMaxFlashVersion; i++){
			try {
				objFlash = eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash." + i + "');");
				if (objFlash) {
					intFlashVersion = i;
				}
			}
			catch(e) {}
		}
	}
	return intFlashVersion;
}

// loader flash object uden om explorers sikkerhedsblokering
Flashees.prototype.loadFlash = function(intVersion, strMovieUrl, intWidth, intHeight, blnClickable, strAlternativeImage, strTitle, strAlternativeUrl, strname, strid){
	var strReturn = "";
	if(this.flashVersion() >= intVersion || intVersion == 0){
		strReturn += "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\"  codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=" + intVersion + ",0,0,0\" width=\"" + intWidth + "\" height=\"" + intHeight + "\" id=\"flashloader\" align=\"middle\">\n";
		strReturn += "<param name=\"allowScriptAccess\" value=\"sameDomain\" />\n";
		strReturn += "<param name=\"movie\" value=\"" + strMovieUrl + "\" />\n";
		strReturn += "<param name=\"quality\" value=\"high\" />\n";
		if (this.flashVars != "") strReturn += "<param name=\"FlashVars\" value=\"" + this.flashVars + "\" />\n";
		strReturn += "<embed src=\"" + strMovieUrl + "\" quality=\"high\" width=\"" + intWidth + "\" height=\"" + intHeight + "\" name=\"" + strname + "\" id=\"" + strid + "\" align=\"middle\" allowscriptaccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" ";
		if (this.flashVars != "") strReturn += " FlashVars=\"" + this.flashVars + "\"";
		strReturn += " />\n";
		strReturn += "</object>\n";
		document.write(strReturn);
	} else {
		if (strAlternativeImage != ""){
			if (blnClickable) {
				strReturn += "<a href=\"" + strAlternativeUrl + "\" title=\"" + strTitle + "\">\n";
				strReturn += "<img src=\"" + strAlternativeImage + "\" alt=\"" + strTitle + "\" title=\"" + strTitle + "\" />\n";
				strReturn += "</a>\n";
			}	else {
				strReturn += "<img src=\"" + strAlternativeImage + "\" alt=\"" + strTitle + "\" title=\"" + strTitle + "\" />\n";	
			}
			document.write(strReturn);
		} else if (strAlternativeUrl && strAlternativeUrl != ""){
			document.location.href = strAlternativeUrl;
		}
	}
}

Flashees.prototype.flashVars = "";

var flashees = new Flashees();