﻿<!--
function ScriptMgr()
{
	this.rgOnload = [];
	this.addWinOnloadEvent = function(fn)
	{
		this.rgOnload.push(fn);
	}
	this.addWinOnloadShowcase = function(srcId, elId, args)
	{
		this.addWinOnloadEvent(new Showcase(srcId, elId, args));
	}
	this.loadWinOnloadEvents = function()
	{
		try{
			for(var i = 0; i <= this.rgOnload.length-1; i++)
			{
				if(typeof this.rgOnload[i] == 'function')
				{
					this.rgOnload[i]();
				}
				else
				{
					this.rgOnload[i].init();
				}
			}
		}catch(e){}
	}
}
ScriptMgr.prototype.cleanUp = function()
{
    try{
	    this.rgOnload.clear();
	}catch(e){}
}

Array.prototype.clear = function()
{
	this.length = 0;
}

function Showcase(elementId, showcaseId, args)
{
	this.elementID = elementId;
	this.showcaseID = showcaseId;
	this.arguments = args;
	this.init = function()
	{
		try
		{
			var el = document.getElementById(this.elementID);
			if(el)
			{
				var s = '/showcase.asp?scid=' + this.showcaseID;
				if(this.arguments)
					s += '&' + this.arguments;
				this.SetIframeWinURL(el, s);
			}
		}
		catch(e){}
		finally
		{
			this.elementID = null;
			this.showcaseID = null;
			this.arguments = null;
		}
	}
}
Showcase.prototype.SetIframeWinURL = function(elIframe, sURL) {
	var iFrameWin;
	if (elIframe.contentWindow)
	{
		iFrameWin = elIframe.contentWindow.document;
	}
	else if (elIframe.contentDocument)
	{
		iFrameWin = elIframe.contentDocument;
	}
	else if (elIframe.document)
	{
		iFrameWin = elIframe.document;
	}
	if (iFrameWin)
	{
		iFrameWin.location.replace(sURL);
	}
}

var winOnload = window.onload;
window.onload = function()
{
	try
	{
		scriptMgr.loadWinOnloadEvents();
		if(typeof winOnload == 'function'){winOnload();}
	}
	catch(e){}
	finally
	{
		if(scriptMgr){scriptMgr.cleanUp();}
	}
}
//-->