if(!window.Silverlight)
    window.Silverlight={};
Silverlight.InstallAndCreateSilverlight = function(version, installPromptDiv, createSilverlightDelegate)
{
    var RetryTimeout=3000;	              //The interval at which Silverlight instantiation is attempted(ms)
    if ( Silverlight.isInstalled(version) && !installPromptDiv ) //this assumes that the original call will always include a div in which to place the install button if needed
    {
        WT.sli = "Installed";
        WT.slv = version;
        var uri = window.location.pathname.substr(0, window.location.pathname.lastIndexOf('/')+1) + 'SL_Install_Complete/' + window.location.pathname.substr(window.location.pathname.lastIndexOf('/')+1);
        dcsMultiTrack('DCS.dcsuri', uri, 'WT.ti','Silverlight Installation Completed', 'WT.dl','6');
        createSilverlightDelegate();
    }
    else if ( Silverlight.isInstalled(version) )
    {
	    createSilverlightDelegate();
    }
    else
    {
	    if ( installPromptDiv )
	    {
	        tempHtml = Silverlight.createObject(null, null, null, {version: version, inplaceInstallPrompt:true},{}, null);
	        tempHtml = tempHtml.replace(/target="_top"/g,'target="_blank"');
	        onclickLoc = tempHtml.indexOf("onclick");
	        onclickLoc = onclickLoc + 20; //advance past 'onclick="Javascript:'
            var uri = window.location.pathname.substr(0, window.location.pathname.lastIndexOf('/')+1) + 'SL_Install_Button_Clicked/' + window.location.pathname.substr(window.location.pathname.lastIndexOf('/')+1);
	        tempHtml = tempHtml.substr(0,onclickLoc) + "dcsMultiTrack('DCS.dcsuri', '" + uri + "','WT.ti','Silverlight Install Button Clicked', 'WT.dl','6');" + tempHtml.substr(onclickLoc);
	        installPromptDiv.innerHTML = tempHtml;
	        
	    }
	    TimeoutDelegate = function()
	    {
		    Silverlight.InstallAndCreateSilverlight(version, null, createSilverlightDelegate);
	    }
	    setTimeout(TimeoutDelegate, RetryTimeout);
    }
}
