/*
This file contains the source of several other js files. 

DO NOT CHANGE THE CONTENT OF THIS FILE. INSTEAD SCHANGE THE ORIGINAL IN THE JS/SRC 
DIRECTORY  AND COPY IT TO THIS FILE.

CONTAINING FILES:

- popupControl.js
- languageSelector.js
- loginControl.js
- dateValidator.js
- injectFlash.js
*/

// De onderstaande require is opgenomen in de youw8frontend layer. 
//dojo.require('dijit._base.place');

/*********************************popupControl.js******************************/

dojo.addOnLoad(staticCreatePopup);
dojo.connect(window, 'onresize', staticCorrectLayout);
dojo.connect(window, 'onscroll', staticCorrectLayout);

function staticCreatePopup() {
	p = new PopupControl();
}
function staticCorrectLayout() {
	p.correctLayout();
} 


var p						= new Object();
p.init						= function() {};
p.show						= function() {};
p.showMaximized				= function() {};
p.showExecute				= function() {};
p.hide						= function() {};
p.correctLayout				= function() {};
p.getScrollAmount			= function() {};
p.toggleHiddenObjects		= function() {};
p.setClosable				= function() {};
p.closeToDashboard			= function() {};
p.goToDashBoard				= function() {};

var VIED_FIXED_DIMENSIONS	= 'fixed';
var VIEW_DEFAULT			= 'default';
var VIEW_MAXIMIZED			= 'maximized';
var APP_WIDTH				= 1160;
var MAX_WIDTH				= 974;
var MAX_HEIGHT				= 850;
var DEFAULT_WIDTH			= 850;

var url;

function PopupControl() {

	this.isUp = false;
	this.greyLayover;
	this.container;
	this.content;
	this.contentHandle;
	this.currentViewStyle;
	this.fixedHeight;
	this.fixedWidth;
	this.objectsToHide;
	this.oldUrl;
	
	PopupControl.prototype.init					= pCInit;
	PopupControl.prototype.show					= pCShow;
	PopupControl.prototype.showMaximized		= pCShowMaximized;
	PopupControl.prototype.showExecute			= pCShowExecute;
	PopupControl.prototype.hide					= pCHide;
	PopupControl.prototype.correctLayout		= pCCorrectLayout;
	PopupControl.prototype.getScrollAmount		= pCGetScrollAmount;
	PopupControl.prototype.toggleHiddenObjects	= pCToggleHiddenObjects;
	PopupControl.prototype.setClosable			= pCSetClosable;
	PopupControl.prototype.closeToDashboard		= pCCloseToDashboard;
	PopupControl.prototype.goToDashBoard 		= pCGoToDashBoard;
	this.init();
}

function pCInit() {
	var greyLayover		= document.createElement("DIV");
	var container		= document.createElement("DIV");
	var header			= document.createElement("DIV");
	var content			= document.createElement("DIV");
	var contentHandle	= document.createElement("IFRAME");
	var footer			= document.createElement("DIV");
	var left			= document.createElement("DIV");	
	var headerCornerL	= document.createElement("DIV");	
	var headerCornerR	= document.createElement("DIV");	
	var closeButton		= document.createElement("A");	
	var footerCornerL	= document.createElement("DIV");	
	var footerCornerR	= document.createElement("DIV");	
	
	this.greyLayover	= greyLayover;
	this.container		= container;
	this.content		= content;
	this.contentHandle	= contentHandle;
	this.objectsToHide	= dojo.query(".hideOnPopup");
	
	this.isUp						= false;
	this.greyLayover.style.display	= 'none';
	this.container.style.display	= 'none';

	this.refreshOnClose			= false;
		
	greyLayover.id				= "popupGreyLayover";
	container.id				= "popupContainer";
	header.id					= "popupHeader";
	content.id					= "popupContent";
	contentHandle.id			= "popupContentHandle";
	contentHandle.name			= "popupIframe";
	contentHandle.frameBorder	= "0";
	footer.id					= "popupFooter";
	left.id						= "popupLeft";
	headerCornerR.id			= "popupHeaderCornerR";
	headerCornerL.id			= "popupHeaderCornerL";
	footerCornerL.id			= "popupFooterCornerL";
	footerCornerR.id			= "popupFooterCornerR";
	closeButton.id				= "closeButton";
	closeButton.href			= "JavaScript:p.hide()";
	
	document.body.insertBefore(container, document.body.firstChild);
	document.body.insertBefore(greyLayover, document.body.firstChild);
	container.appendChild(header);
	container.appendChild(content);
	container.appendChild(footer);
	content.appendChild(left);
	content.appendChild(contentHandle);
	header.appendChild(headerCornerR);
	header.appendChild(headerCornerL);
	footer.appendChild(footerCornerR);
	footer.appendChild(footerCornerL);
	headerCornerR.appendChild(closeButton);
	
	dojo.fadeOut({node : 'popupContainer', duration: 1}).play();
}

function pCShowMaximized(url,showCloseButton, refreshOnClose) {
	this.currentViewStyle	= VIED_FIXED_DIMENSIONS;
	this.fixedWidth			= null; 
	this.fixedHeight		= null;
	this.showExecute(url, showCloseButton, refreshOnClose);
}

function pCShow(url, showCloseButton, width, height, refreshOnClose) {
	height = getCorrectPopupHeight(height);
	this.oldUrl = url;
	this.refreshOnClose = refreshOnClose == null || refreshOnClose == undefined? false: refreshOnClose;
	
	if (width == null || height == null) {
		this.currentViewStyle	= VIED_FIXED_DIMENSIONS;
		this.fixedWidth			= DEFAULT_WIDTH; 
		this.fixedHeight		= null;
	} else {
		this.currentViewStyle	= VIED_FIXED_DIMENSIONS;
		this.fixedWidth			= width;
		this.fixedHeight		= height;
	}
	this.showExecute(url, showCloseButton);
}
function pCShowExecute(url, showCloseButton) {
	try {
		this.isUp = true;
		this.correctLayout();
		this.toggleHiddenObjects();
		this.greyLayover.style.display	= '';
		this.container.style.display 	= '';
		this.contentHandle.src			= url;
		this.setClosable(showCloseButton);
		dojo.fadeIn({node : 'popupContainer', duration: 800}).play();
	} catch (e) {
		this.isUp = false;
		// Sometimes the DOM is not ready yet.
		// Wait a while and try again
		setTimeout('p.showExecute("' + url + '",' + showCloseButton + ');', 100);
	}
}
function pCHide() {	
	this.isUp = false;
	this.toggleHiddenObjects();
	this.greyLayover.style.display	= 'none';
	this.container.style.display	= 'none';
	dojo.fadeOut({node : 'popupContainer', duration: 1}).play();
	if (this.refreshOnClose) {
		document.location.reload();
	}	
}

function pCToggleHiddenObjects() {
	for (var i=0; i < this.objectsToHide.length; i++) {
		this.objectsToHide[i].style.visibility = this.isUp? 'hidden': 'visible';
	}
}

function pCCorrectLayout() {
	if (this.isUp) {
		var vp	= dijit.getViewport(); 
		var sxy	= this.getScrollAmount();
		
		this.greyLayover.style.width	= vp.w + 'px';
		this.greyLayover.style.height	= vp.h + 'px';
		this.greyLayover.style.top		= sxy[1] + 'px';
		this.greyLayover.style.left		= sxy[0] + 'px';
		
		var h,w;
		if (this.fixedHeight == null) {
			h	= Math.min(MAX_HEIGHT, Math.floor(vp.h * .8));
		} else {
			h	= Math.min(MAX_HEIGHT, this.fixedHeight);
		}
		
		if (this.currentViewStyle == VIED_FIXED_DIMENSIONS) {
			w	= Math.min(MAX_WIDTH, this.fixedWidth);
		} else {
			w	= Math.min(MAX_WIDTH, Math.floor(Math.min(APP_WIDTH, vp.w) * .8));
		}
		this.container.style.width		= w + 'px'; 
		this.container.style.height		= h + 'px'; 
		this.container.style.top		= sxy[1] + Math.floor((vp.h - h) / 2) + 'px';
		this.container.style.left		= sxy[0] + Math.floor((vp.w - w) / 2) + 'px';
		this.content.style.height		= (h - 33) + 'px';
		this.contentHandle.style.width	= (w - 28) + 'px';
	}
}

function pCGetScrollAmount() {
	var scrOfX = 0, scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		//DOM compliant
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;
		scrOfX = document.documentElement.scrollLeft;
	}
	return [ scrOfX, scrOfY ];
}

function pCSetClosable(showCloseButton) {
	if (showCloseButton) {
		dojo.removeClass(this.container, 'notClosable');
	} else {
		dojo.addClass(this.container, 'notClosable');
	}
}
function pCCloseToDashboard(){
	dojo.byId('closeButton').href = "JavaScript:p.goToDashBoard()";
}

function pCGoToDashBoard(){
	window.p.show(this.oldUrl,true,924,getCorrectPopupHeight(730));
	history.go(-1);
	dojo.byId('closeButton').href = "JavaScript:p.hide()";
}

/*******************************languageSelector.js****************************/

function openLangSelect() {
	var ls = dojo.byId('langSelect');
	if (ls != null) {
		ls.style.display = 'block';
		dojo.body().onclick = closeLangSelect;
	}
}

function closeLangSelect() {
	var ls = dojo.byId('langSelect');
	if (ls != null) {
		ls.style.display = 'none';
		dojo.body().onclick = '';
	}
}

/*********************************loginControl.js******************************/

var usrText;
var pwdText;

var usrElem;
var pwdElem;
var defUsrTxt;
var defPwdTxt;
var txtErrUsr;
var txtErrPwd;
var usrFocussed;
var pwdFocussed;
var targetPage = '/restricted/dispatcher.jsp';
dojo.addOnLoad(initLoginControl);
function initLoginControl() {
	usrText = document.getElementById('usernameText');
	pwdText = document.getElementById('passwordText');
	if (usrText != null && pwdText != null) {
		var loginBlock = dojo.byId('loginBlock');
		loginBlock.onmouseover = function (e) { overForm(e) }
		loginBlock.onmouseout = function (e) { outForm(e) }
		
		usrElem = document.login.username;
		pwdElem = document.login.password;
		
		usrFocussed = false;
		pwdFocussed = false;

		usrElem.onfocus = function (e) { focusEvt(e, defUsrTxt) }
		usrElem.onkeydown = function (e) { focusEvt(e, defUsrTxt) }
		pwdElem.onfocus = function (e) { focusEvt(e, defPwdTxt) }
		pwdElem.onkeydown = function (e) { focusEvt(e, defPwdTxt) }
		usrElem.onblur = function (e) { blurEvt(e, defUsrTxt) }
		pwdElem.onblur = function (e) { blurEvt(e, defPwdTxt) }
	
		usrText.style.display = (usrElem.value == ""? 'block': 'none');
		pwdText.style.display = (pwdElem.value == ""? 'block': 'none');
	}
}
function overForm(e) {
	usrText.style.display = 'none';
	pwdText.style.display = 'none';
}
function outForm(e) {
	if (usrElem.value == "" && usrFocussed != true) {
		usrText.style.display = 'block';
	}
	if (pwdElem.value == "" && pwdFocussed != true) {
		pwdText.style.display = 'block';
	}
}
function focusEvt(e, defTxt) {
	e = e || window.event;
	var c = e.target? e.target: e.srcElement;
	
	if (c == pwdElem) {
		pwdFocussed = true;	
	} else {
		usrFocussed = true;
	}
	overForm(e);
}
function blurEvt(e, defTxt) {
	e = e || window.event;
	var c = e.target? e.target: e.srcElement;
	
	if (c == pwdElem) {
		pwdFocussed = false;	
	} else {
		usrFocussed = false;
	}
	outForm(e);
}


function loginStep1(customTargetPage) {	
	return;
	if (customTargetPage != null) {
		targetPage = customTargetPage;
	}
	var frm = document.forms.login;
	
	// controle of de username en pwd wel zijn ingevuld.
	if (frm.username.value == "" || frm.username.value == defUsrTxt) {
		alert(txtErrUsr);
	} else if (frm.password.value == "" || frm.password.value == defPwdTxt) {
		alert(txtErrPwd);
	} else {		
		
		dojo.xhrPost({				
			url: "/servlet/CookieManagerServlet",
			content: {
				"username": frm.username.value,
				"password": frm.password.value,
				"rememberPassword": frm.rememberPasswordCheckBox.checked
			},
			handleAs: "json",	
			load: function(data,ioargs){
				console.dir(data);
			}
		});
		
		// aan het .txt bestand wordt een random string meegegeven zodat er niet
		// wordt gecached door de browsers (firefox) 
		var rnd = (new Date()).getTime();
		var url = '/restricted/isLoggedIn.txt?rnd='+ rnd;
	    dojo.xhrGet( {
	        url: url,
	        load: loginStep2,
	        error: connectionError,
	        handleAs: "text",
	        timeout: 15000
	    });
	}
}
function loginStep2(response, ioArgs) {
	if (response.indexOf('<!--not logged in-->') != 0) {
		document.location.href = targetPage;
	} else {
		var formName			= 'random' + (new Date()).getTime();
		var rnd					= (new Date()).getTime();		
		var newForm				= document.createElement('FORM');
		newForm.name			= formName;
		newForm.id				= formName;
		newForm.style.display	= 'none';
		newForm.action			= 'j_security_check?rnd=' + rnd;
		newForm.method			= 'POST';
		dojo.body().appendChild(newForm);
		
		var usr					= document.createElement('INPUT');
		usr.type				= 'TEXT';
		usr.name				= 'j_username';
		usr.value				= document.forms.login.username.value;
		newForm.appendChild(usr);
		
		var pwd					= document.createElement('INPUT');
		pwd.type				= 'PASSWORD';
		pwd.name				= 'j_password';
		pwd.value				= document.forms.login.password.value;
		newForm.appendChild(pwd);
 		dojo.xhrGet( {
	        url: 'j_security_check?rnd=' + rnd,
	        load: loginStep3,
	        error: connectionError,
	        handleAs: "text",
	        timeout: 15000,
	        form: formName
	      });	
	}
}
function loginStep3(response, ioArgs) {
	if (response == 'success') {
		// Goed ingelogd
		document.location.href = targetPage;
	} else {
		// Verkeerde login gegevens
		var purl = '/open/loginFailure.jsp?msg=WRONG_CREDENTIALS';
		p.show(purl, true, 400, 300);
	}
}
function connectionError(response, ioArgs) {
	if (hasNoPermission(response)) {
		// Reeds ingelogd en geen toegang tot de gevraagde resource met die rol. 
		var purl = '/open/loginFailure.jsp?msg=NO_PERMISSION';
	} else {
		// Wazig onbekend probleem. De errorcode wordt weggeschreven in het 
		// HTML commentaar van de popup pagina.
		var txt		= makeReadable('Response', response);
		txt			+= makeReadable('IoArgs', ioArgs);
		var purl	= '/open/loginFailure.jsp?msg=UNKNOWN_ERROR&err=' + encodeURI(txt);
	}
	p.show(purl, true, 400, 300);
}
function makeReadable(name, obj, indent) {
	indent = indent == undefined? 1: indent;
	
	var tabs = '';
	for (var i=0; i < indent; i++) {
		tabs += '\t';
	} 
	
	var txt = '\n' + tabs + name + '\n';
	for (var i in obj) {
		var o = obj[i];
		if (o instanceof Object) {
			try {
				txt += makeReadable(i, o, indent+1);
			} catch (e) {
				txt += tabs + 'cannot read object:' + e;
			}
		} else {
			txt += tabs  + '-' + i + ': ' + obj[i] + '\n';
		}
	}
	return txt;
}

function hasNoPermission(response) {
	if (response.description) {
		return response.description.indexOf('403') > -1;
	} else if (response.indexOf) {
		return response.indexOf('<!--no permission for resources with current role-->') > -1;
	} else {
		return response.toString().indexOf('403') > -1;
	}
	return false;
}
function isACorrectDate(value) {
	var arr = value.split('-');
	try {				
		for (var i=0; i < arr.length; i++) { 
			arr[i] = arr[i].replace(/^\s+|\s+$/g, '');
			arr[i] = arr[i].replace(/^0/, '');
		}

		if (arr[0] && arr[1] && arr[2]) {
			var datumOrig = arr[0] + '-' + arr[1] + '-' + arr[2];			
			var date		= new Date(parseInt(arr[2]), parseInt(arr[1]) - 1, parseInt(arr[0]));
			var datumNew	= date.getDate() + '-' + (date.getMonth() + 1) + '-' + adjustYear(date.getYear());
			return (datumOrig == datumNew  && isCorrectYear(arr[2]));
			
		} else {
			return false;
		}
	} catch (e) { return false; }
}
function adjustYear(jaar) {
	return jaar + (jaar < 1000? 1900: 0);
}
function isCorrectYear(year) {
	return year > 1900;
}


/*********************************injectFlash.js*******************************/

var NO_FLASH_INSTALLED		= 'NO_FLASH_INSTALLED';
var WRONG_FLASH_VERSION		= 'WRONG_FLASH_VERSION';
var isIE					= (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin					= (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera					= (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function youw8FlashCreator(width, height, absFlashUrl, swfName, flashVars, requiredMajorVersion, requiredMinorVersion, requiredRevision) {

	// Set default flash version to 9.0.124, or use overrides if provided 
	requiredMajorVersion	= requiredMajorVersion != undefined?	requiredMajorVersion:	9; 
	requiredMinorVersion	= requiredMinorVersion != undefined?	requiredMinorVersion:	0;
	requiredRevision		= requiredRevision != undefined?		requiredRevision:		124;
	
	var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
	
	if (!hasProductInstall && !hasRequestedVersion) {
		return NO_FLASH_INSTALLED;
	} else if (hasProductInstall && !hasRequestedVersion) {
		return WRONG_FLASH_VERSION;
	} else {
		return AC_FL_RunContent(
				"src", absFlashUrl
				,"width", width
				,"height", height
				,"align", "middle"
				,"id", swfName
				,"quality", "high"
				,"bgcolor", "#FFFFFF"
				,"name", swfName
				,"flashvars", (flashVars? flashVars: '')
				,"allowScriptAccess","always"
				,"type", "application/x-shockwave-flash"
				,"pluginspage", "http://www.adobe.com/go/getflashplayer"
		);
	}
}

function getUpgradeEmbed(width, height) {
	var MMPlayerType	= (isIE == true) ? "ActiveX" : "PlugIn";
	var MMredirectURL	= window.location;
    document.title		= document.title.slice(0, 47) + " - Flash Player Installation";
    var MMdoctitle		= document.title;
    
	return AC_FL_RunContent(
				"src", "/youw8Custom/dmp/swf/playerProductInstall"
				,"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+""
				,"width", width
				,"height", height
				,"align", "middle"
				,"id", "flashUpgrade"
				,"quality", "high"
				,"bgcolor", "#FFFFFF"
				,"name", "flashUpgrade"
				,"allowScriptAccess","always"
				,"type", "application/x-shockwave-flash"
				,"pluginspage", "http://www.adobe.com/go/getflashplayer"
		);
}

function getNoFlashErrTxt(introTxt, linkTxt) {
	return '<div class="noflash">' + introTxt + '<a href="javascript:p.show(\'http://www.adobe.com/go/getflash/\', true)">' + linkTxt + '</a></div>';
}

function getOldFlashErrTxt(introTxt, linkTxt) {
	return '<div class="noflash">' + introTxt + '<a href="javascript:p.show(\'/open/upgradeFlash.jsp\', true, 600, 600)">' + linkTxt + '</a></div>';
}

function ControlVersion()
{
	var version;
	var axo;
	var e;
	try {
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {}
	if (!version)
	{
		try {
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			version = "WIN 6,0,21,0";
			axo.AllowScriptAccess = "always";
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}
function GetSwfVer(){
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");			
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			var versionRevision = descArray[3];
			if (versionRevision == "") {
				versionRevision = descArray[4];
			}
			if (versionRevision[0] == "d") {
				versionRevision = versionRevision.substring(1);
			} else if (versionRevision[0] == "r") {
				versionRevision = versionRevision.substring(1);
				if (versionRevision.indexOf("d") > 0) {
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
				}
			}
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			tempArray         = versionStr.split(" ");
			tempString        = tempArray[1];
			versionArray      = tempString.split(",");
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
    var str = '';
    if (isIE && isWin && !isOpera)
    {
  		str += '<object ';
  		for (var i in objAttrs)
  			str += i + '="' + objAttrs[i] + '" ';
  		str += '>';
  		for (var i in params)
  			str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  		str += '</object>';
    } else {
  		str += '<embed ';
  		for (var i in embedAttrs)
  			str += i + '="' + embedAttrs[i] + '" ';
  		str += '> </embed>';
    }
	return str;
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  return AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "id":
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}


var hasProductInstall		= DetectFlashVer(6, 0, 65);
var flashInjectorIsloaded	= true;