Changeset 41

Show
Ignore:
Timestamp:
07/17/08 00:42:34 (16 months ago)
Author:
jeroen
Message:

1.1 silverlight fixes

Location:
trunk/sl1
Files:
1 added
2 removed
1 modified
3 moved

Legend:

Unmodified
Added
Removed
  • trunk/sl1/player.js

    r1 r41  
    7474                        height:this.configuration['height'], 
    7575                        version:'1.0', 
    76                         inplaceInstallPrompt:true, 
     76                        inplaceInstallPrompt:false, 
    7777                        isWindowless:'false', 
    7878                        background:'#'+this.configuration['backgroundcolor'] 
    7979                }, 
    8080                events:{ 
    81                         onLoad:this.onLoadHandler 
     81                        onLoad:this.onLoadHandler, 
     82                        onError:null 
    8283                }, 
    8384                context:this 
  • trunk/sl1/silverlight.js

    r1 r41  
    1 /////////////////////////////////////////////////////////////////////////////// 
    2 // 
    3 //  Silverlight.js                      version 1.0 
     1/////////////////////////////////////////////////////////////////////////////// 
     2// 
     3//  Silverlight.js                      version 2.0.30523.6 
    44// 
    55//  This file is provided by Microsoft as a helper file for websites that 
    6 //  incorporate Silverlight Objects. This file is provided under the Silverlight  
    7 //  SDK 1.0 license available at http://go.microsoft.com/fwlink/?linkid=94240.   
     6//  incorporate Silverlight Objects. This file is provided under the Microsoft 
     7//  Public License available at  
     8//  http://code.msdn.microsoft.com/silverlightjs/Project/License.aspx.   
    89//  You may not use or distribute this file or the code in this file except as  
    910//  expressly permitted under that license. 
    1011//  
    11 //  Copyright (c) 2007 Microsoft Corporation. All rights reserved. 
     12//  Copyright (c) Microsoft Corporation. All rights reserved. 
    1213// 
    1314/////////////////////////////////////////////////////////////////////////////// 
    1415 
    15 if(!window.Silverlight)window.Silverlight={};Silverlight._silverlightCount=0;Silverlight.ua=null;Silverlight.available=false;Silverlight.fwlinkRoot="http://go.microsoft.com/fwlink/?LinkID=";Silverlight.detectUserAgent=function(){var a=window.navigator.userAgent;Silverlight.ua={OS:"Unsupported",Browser:"Unsupported"};if(a.indexOf("Windows NT")>=0)Silverlight.ua.OS="Windows";else if(a.indexOf("PPC Mac OS X")>=0)Silverlight.ua.OS="MacPPC";else if(a.indexOf("Intel Mac OS X")>=0)Silverlight.ua.OS="MacIntel";if(Silverlight.ua.OS!="Unsupported")if(a.indexOf("MSIE")>=0){if(navigator.userAgent.indexOf("Win64")==-1)if(parseInt(a.split("MSIE")[1])>=6)Silverlight.ua.Browser="MSIE"}else if(a.indexOf("Firefox")>=0){var b=a.split("Firefox/")[1].split("."),c=parseInt(b[0]);if(c>=2)Silverlight.ua.Browser="Firefox";else{var d=parseInt(b[1]);if(c==1&&d>=5)Silverlight.ua.Browser="Firefox"}}else if(a.indexOf("Safari")>=0)Silverlight.ua.Browser="Safari"};Silverlight.detectUserAgent();Silverlight.isInstalled=function(d){var c=false,a=null;try{var b=null;if(Silverlight.ua.Browser=="MSIE")b=new ActiveXObject("AgControl.AgControl");else if(navigator.plugins["Silverlight Plug-In"]){a=document.createElement("div");document.body.appendChild(a);if(Silverlight.ua.Browser=="Safari")a.innerHTML='<embed type="application/x-silverlight" />';else a.innerHTML='<object type="application/x-silverlight"  data="data:," />';b=a.childNodes[0]}document.body.innerHTML;if(b.IsVersionSupported(d))c=true;b=null;Silverlight.available=true}catch(e){c=false}if(a)document.body.removeChild(a);return c};Silverlight.createObject=function(l,g,m,j,k,i,h){var b={},a=j,c=k;a.source=l;b.parentElement=g;b.id=Silverlight.HtmlAttributeEncode(m);b.width=Silverlight.HtmlAttributeEncode(a.width);b.height=Silverlight.HtmlAttributeEncode(a.height);b.ignoreBrowserVer=Boolean(a.ignoreBrowserVer);b.inplaceInstallPrompt=Boolean(a.inplaceInstallPrompt);var e=a.version.split(".");b.shortVer=e[0]+"."+e[1];b.version=a.version;a.initParams=i;a.windowless=a.isWindowless;a.maxFramerate=a.framerate;for(var d in c)if(c[d]&&d!="onLoad"&&d!="onError"){a[d]=c[d];c[d]=null}delete a.width;delete a.height;delete a.id;delete a.onLoad;delete a.onError;delete a.ignoreBrowserVer;delete a.inplaceInstallPrompt;delete a.version;delete a.isWindowless;delete a.framerate;delete a.data;delete a.src;if(Silverlight.isInstalled(b.version)){if(Silverlight._silverlightCount==0)if(window.addEventListener)window.addEventListener("onunload",Silverlight.__cleanup,false);else window.attachEvent("onunload",Silverlight.__cleanup);var f=Silverlight._silverlightCount++;a.onLoad="__slLoad"+f;a.onError="__slError"+f;window[a.onLoad]=function(a){if(c.onLoad)c.onLoad(document.getElementById(b.id),h,a)};window[a.onError]=function(a,b){if(c.onError)c.onError(a,b);else Silverlight.default_error_handler(a,b)};slPluginHTML=Silverlight.buildHTML(b,a)}else slPluginHTML=Silverlight.buildPromptHTML(b);if(b.parentElement)b.parentElement.innerHTML=slPluginHTML;else return slPluginHTML};Silverlight.supportedUserAgent=function(){var a=Silverlight.ua,b=a.OS=="Unsupported"||a.Browser=="Unsupported"||a.OS=="Windows"&&a.Browser=="Safari"||a.OS.indexOf("Mac")>=0&&a.Browser=="IE";return !b};Silverlight.buildHTML=function(c,d){var a=[],e,i,g,f,h;if(Silverlight.ua.Browser=="Safari"){a.push("<embed ");e="";i=" ";g='="';f='"';h=' type="application/x-silverlight"/>'+"<iframe style='visibility:hidden;height:0;width:0'/>"}else{a.push('<object type="application/x-silverlight" data="data:,"');e=">";i=' <param name="';g='" value="';f='" />';h="</object>"}a.push(' id="'+c.id+'" width="'+c.width+'" height="'+c.height+'" '+e);for(var b in d)if(d[b])a.push(i+Silverlight.HtmlAttributeEncode(b)+g+Silverlight.HtmlAttributeEncode(d[b])+f);a.push(h);return a.join("")};Silverlight.default_error_handler=function(e,b){var d,c=b.ErrorType;d=b.ErrorCode;var a="\nSilverlight error message     \n";a+="ErrorCode: "+d+"\n";a+="ErrorType: "+c+"       \n";a+="Message: "+b.ErrorMessage+"     \n";if(c=="ParserError"){a+="XamlFile: "+b.xamlFile+"     \n";a+="Line: "+b.lineNumber+"     \n";a+="Position: "+b.charPosition+"     \n"}else if(c=="RuntimeError"){if(b.lineNumber!=0){a+="Line: "+b.lineNumber+"     \n";a+="Position: "+b.charPosition+"     \n"}a+="MethodName: "+b.methodName+"     \n"}alert(a)};Silverlight.createObjectEx=function(b){var a=b,c=Silverlight.createObject(a.source,a.parentElement,a.id,a.properties,a.events,a.initParams,a.context);if(a.parentElement==null)return c};Silverlight.buildPromptHTML=function(l){var a=null,d=Silverlight.fwlinkRoot,c=Silverlight.ua.OS,b="92822",e,f="Get Microsoft Silverlight",m="0x409";if(l.inplaceInstallPrompt){var n="98109",i;if(Silverlight.available){e="96189";i="96422"}else{e="96188";i="96422"}var h="93481",g="93483";if(c=="Windows"){b="92799";h="92803";g="92805"}else if(c=="MacIntel"){b="92808";h="92804";g="92806"}else if(c=="MacPPC"){b="92807";h="92815";g="92816"}var k='By clicking <b>"Get Microsoft Silverlight"</b> you accept the<br /><a title="Silverlight License Agreement" href="{2}" target="_top" style="text-decoration: underline; color: #96C5E1"><b>Silverlight license agreement</b></a>',j='Silverlight updates automatically, <a title="Silverlight Privacy Statement" href="{3}" target="_top" style="text-decoration: underline; color: #96C5E1"><b>learn more</b></a>';a='<table border="0" cellpadding="0" cellspacing="0" width="206px"><tr><td><img style="display: block; cursor: pointer; border= 0;" title="'+f+'" alt="'+f+'" onclick="javascript:Silverlight.followFWLink({0});" src="{1}" /></td></tr><tr><td style="width: 206px; margin: 0px; background: #FFFFFF; color: #C7C7C7; text-align: left; border-left-style: solid; border-right-style: solid; padding-left: 6px; padding-right: 6px; padding-top: 3px; padding-bottom: 0px; border-width: 2px; border-color: #c7c7bd; font-family: Verdana; font-size: 55%">'+k+'</td></tr><tr><td><img src="{5}" style="border: 0; display: block" /></td></tr><tr><td style="width: 206px; margin: 0px; background: #D8EFF9; color: #C7C7C7; text-align: left; border-left-style: solid; border-right-style: solid; padding-left: 6px; padding-right: 6px; padding-top: 0px; padding-bottom: 2px; border-width: 2px; border-color: #c7c7bd; font-family: Verdana; font-size: 55%">'+j+'</td></tr><tr><td><img alt="" src="{4}" /></td></tr></table>';a=a.replace("{2}",d+h);a=a.replace("{3}",d+g);a=a.replace("{4}",d+i);a=a.replace("{5}",d+n)}else{if(Silverlight.available)e="94377";else e="92801";if(c=="Windows")b="92800";else if(c=="MacIntel")b="92812";else if(c=="MacPPC")b="92811";a='<div style="display:block; width: 205px; height: 67px;"><img onclick="javascript:Silverlight.followFWLink({0});" style="border:0; cursor:pointer" src="{1}" title="'+f+'" alt="'+f+'"/></div>'}a=a.replace("{0}",b);a=a.replace("{1}",d+e+"&amp;clcid="+m);return a};Silverlight.__cleanup=function(){for(var a=Silverlight._silverlightCount-1;a>=0;a--){window["__slLoad"+a]=null;window["__slError"+a]=null}if(window.removeEventListener)window.removeEventListener("unload",Silverlight.__cleanup,false);else window.detachEvent("onunload",Silverlight.__cleanup)};Silverlight.followFWLink=function(a){top.location=Silverlight.fwlinkRoot+String(a)};Silverlight.HtmlAttributeEncode=function(c){var a,b="";if(c==null)return null;for(var d=0;d<c.length;d++){a=c.charCodeAt(d);if(a>96&&a<123||a>64&&a<91||a>43&&a<58&&a!=47||a==95)b=b+String.fromCharCode(a);else b=b+"&#"+a+";"}return b} 
     16if (!window.Silverlight) 
     17{ 
     18    window.Silverlight = { }; 
     19} 
     20 
     21////////////////////////////////////////////////////////////////// 
     22// 
     23// _silverlightCount: 
     24// 
     25// Counter of globalized event handlers 
     26// 
     27////////////////////////////////////////////////////////////////// 
     28Silverlight._silverlightCount = 0; 
     29 
     30////////////////////////////////////////////////////////////////// 
     31// 
     32// fwlinkRoot: 
     33// 
     34// Prefix for fwlink URL's 
     35// 
     36////////////////////////////////////////////////////////////////// 
     37Silverlight.fwlinkRoot='http://go2.microsoft.com/fwlink/?LinkID='; 
     38 
     39////////////////////////////////////////////////////////////////// 
     40//   
     41// onGetSilverlight: 
     42// 
     43// Called by Silverlight.GetSilverlight to notify the page that a user 
     44// has requested the Silverlight installer 
     45// 
     46////////////////////////////////////////////////////////////////// 
     47Silverlight.onGetSilverlight = null; 
     48 
     49////////////////////////////////////////////////////////////////// 
     50// 
     51// onSilverlightInstalled: 
     52// 
     53// Called by Silverlight.WaitForInstallCompletion when the page detects 
     54// that Silverlight has been installed. The event handler is not called 
     55// in upgrade scenarios. 
     56// 
     57////////////////////////////////////////////////////////////////// 
     58Silverlight.onSilverlightInstalled = function () {window.location.reload(false);}; 
     59 
     60////////////////////////////////////////////////////////////////// 
     61// 
     62// isInstalled: 
     63// 
     64// Checks to see if the correct version is installed 
     65// 
     66////////////////////////////////////////////////////////////////// 
     67Silverlight.isInstalled = function(version) 
     68{ 
     69    var isVersionSupported=false; 
     70    var container = null; 
     71     
     72    try  
     73    { 
     74        var control = null; 
     75         
     76        try 
     77        { 
     78            control = new ActiveXObject('AgControl.AgControl'); 
     79            if ( version == null ) 
     80            { 
     81                isVersionSupported = true; 
     82            } 
     83            else if ( control.IsVersionSupported(version) ) 
     84            { 
     85                isVersionSupported = true; 
     86            } 
     87            control = null; 
     88        } 
     89        catch (e) 
     90        { 
     91            var plugin = navigator.plugins["Silverlight Plug-In"] ; 
     92            if ( plugin ) 
     93            { 
     94                if ( version === null ) 
     95                { 
     96                    isVersionSupported = true; 
     97                } 
     98                else 
     99                { 
     100                    var actualVer = plugin.description; 
     101                    if ( actualVer === "1.0.30226.2") 
     102                        actualVer = "2.0.30226.2"; 
     103                    var actualVerArray =actualVer.split("."); 
     104                    while ( actualVerArray.length > 3) 
     105                    { 
     106                        actualVerArray.pop(); 
     107                    } 
     108                    while ( actualVerArray.length < 4) 
     109                    { 
     110                        actualVerArray.push(0); 
     111                    } 
     112                    var reqVerArray = version.split("."); 
     113                    while ( reqVerArray.length > 4) 
     114                    { 
     115                        reqVerArray.pop(); 
     116                    } 
     117                     
     118                    var requiredVersionPart ; 
     119                    var actualVersionPart 
     120                    var index = 0; 
     121                     
     122                     
     123                    do 
     124                    { 
     125                        requiredVersionPart = parseInt(reqVerArray[index]); 
     126                        actualVersionPart = parseInt(actualVerArray[index]); 
     127                        index++; 
     128                    } 
     129                    while (index < reqVerArray.length && requiredVersionPart === actualVersionPart); 
     130                     
     131                    if ( requiredVersionPart <= actualVersionPart && !isNaN(requiredVersionPart) ) 
     132                    { 
     133                        isVersionSupported = true; 
     134                    } 
     135                } 
     136            } 
     137        } 
     138    } 
     139    catch (e)  
     140    { 
     141        isVersionSupported = false; 
     142    } 
     143    if (container)  
     144    { 
     145        document.body.removeChild(container); 
     146    } 
     147     
     148    return isVersionSupported; 
     149} 
     150////////////////////////////////////////////////////////////////// 
     151// 
     152// WaitForInstallCompletion: 
     153// 
     154// Occasionally checks for Silverlight installation status. If it 
     155// detects that Silverlight has been installed then it calls 
     156// Silverlight.onSilverlightInstalled();. This is only supported 
     157// if Silverlight was not previously installed on this computer. 
     158// 
     159////////////////////////////////////////////////////////////////// 
     160Silverlight.WaitForInstallCompletion = function() 
     161{ 
     162    if ( ! Silverlight.isBrowserRestartRequired && Silverlight.onSilverlightInstalled ) 
     163    { 
     164        try 
     165        { 
     166            navigator.plugins.refresh(); 
     167        } 
     168        catch(e) 
     169        { 
     170        } 
     171        if ( Silverlight.isInstalled(null) ) 
     172        { 
     173            Silverlight.onSilverlightInstalled(); 
     174        } 
     175        else 
     176        { 
     177              setTimeout(Silverlight.WaitForInstallCompletion, 3000); 
     178        }     
     179    } 
     180} 
     181////////////////////////////////////////////////////////////////// 
     182// 
     183// __startup: 
     184// 
     185// Performs startup tasks 
     186////////////////////////////////////////////////////////////////// 
     187Silverlight.__startup = function() 
     188{ 
     189    Silverlight.isBrowserRestartRequired = Silverlight.isInstalled(null); 
     190    if ( !Silverlight.isBrowserRestartRequired) 
     191    { 
     192        Silverlight.WaitForInstallCompletion(); 
     193    } 
     194    if (window.removeEventListener) {  
     195       window.removeEventListener('load', Silverlight.__startup , false); 
     196    } 
     197    else {  
     198        window.detachEvent('onload', Silverlight.__startup ); 
     199    } 
     200} 
     201 
     202if (window.addEventListener)  
     203{ 
     204    window.addEventListener('load', Silverlight.__startup , false); 
     205} 
     206else  
     207{ 
     208    window.attachEvent('onload', Silverlight.__startup ); 
     209} 
     210 
     211/////////////////////////////////////////////////////////////////////////////// 
     212// createObject: 
     213// 
     214// Inserts a Silverlight <object> tag or installation experience into the HTML 
     215// DOM based on the current installed state of Silverlight.  
     216// 
     217///////////////////////////////////////////////////////////////////////////////// 
     218 
     219Silverlight.createObject = function(source, parentElement, id, properties, events, initParams, userContext) 
     220{ 
     221    var slPluginHelper = new Object(); 
     222    var slProperties = properties; 
     223    var slEvents = events; 
     224     
     225    slPluginHelper.version = slProperties.version; 
     226    slProperties.source = source;     
     227    slPluginHelper.alt = slProperties.alt; 
     228     
     229    //rename properties to their tag property names. For bacwards compatibility 
     230    //with Silverlight.js version 1.0 
     231    if ( initParams ) 
     232        slProperties.initParams = initParams; 
     233    if ( slProperties.isWindowless && !slProperties.windowless) 
     234        slProperties.windowless = slProperties.isWindowless; 
     235    if ( slProperties.framerate && !slProperties.maxFramerate) 
     236        slProperties.maxFramerate = slProperties.framerate; 
     237    if ( id && !slProperties.id) 
     238        slProperties.id = id; 
     239     
     240    // remove elements which are not to be added to the instantiation tag 
     241    delete slProperties.ignoreBrowserVer; 
     242    delete slProperties.inplaceInstallPrompt; 
     243    delete slProperties.version; 
     244    delete slProperties.isWindowless; 
     245    delete slProperties.framerate; 
     246    delete slProperties.data; 
     247    delete slProperties.src; 
     248    delete slProperties.alt; 
     249 
     250 
     251    // detect that the correct version of Silverlight is installed, else display install 
     252 
     253    if (Silverlight.isInstalled(slPluginHelper.version)) 
     254    { 
     255        //move unknown events to the slProperties array 
     256        for (var name in slEvents) 
     257        { 
     258            if ( slEvents[name]) 
     259            { 
     260                if ( name == "onLoad" && typeof slEvents[name] == "function" && slEvents[name].length != 1 ) 
     261                { 
     262                    var onLoadHandler = slEvents[name]; 
     263                    slEvents[name]=function (sender){ return onLoadHandler(document.getElementById(id), userContext, sender)}; 
     264                } 
     265                var handlerName = Silverlight.__getHandlerName(slEvents[name]); 
     266                if ( handlerName != null ) 
     267                { 
     268                    slProperties[name] = handlerName; 
     269                    slEvents[name] = null; 
     270                } 
     271                else 
     272                { 
     273                    throw "typeof events."+name+" must be 'function' or 'string'"; 
     274                } 
     275            } 
     276        } 
     277        slPluginHTML = Silverlight.buildHTML(slProperties); 
     278    } 
     279    //The control could not be instantiated. Show the installation prompt 
     280    else  
     281    { 
     282        slPluginHTML = Silverlight.buildPromptHTML(slPluginHelper); 
     283    } 
     284 
     285    // insert or return the HTML 
     286    if(parentElement) 
     287    { 
     288        parentElement.innerHTML = slPluginHTML; 
     289    } 
     290    else 
     291    { 
     292        return slPluginHTML; 
     293    } 
     294 
     295} 
     296 
     297/////////////////////////////////////////////////////////////////////////////// 
     298// 
     299//  buildHTML: 
     300// 
     301//  create HTML that instantiates the control 
     302// 
     303/////////////////////////////////////////////////////////////////////////////// 
     304Silverlight.buildHTML = function( slProperties) 
     305{ 
     306    var htmlBuilder = []; 
     307 
     308    htmlBuilder.push('<object type=\"application/x-silverlight\" data="data:application/x-silverlight,"'); 
     309    if ( slProperties.id != null ) 
     310    { 
     311        htmlBuilder.push(' id="' + slProperties.id + '"'); 
     312    } 
     313    if ( slProperties.width != null ) 
     314    { 
     315        htmlBuilder.push(' width="' + slProperties.width+ '"'); 
     316    } 
     317    if ( slProperties.height != null ) 
     318    { 
     319        htmlBuilder.push(' height="' + slProperties.height + '"'); 
     320    } 
     321    htmlBuilder.push(' >'); 
     322     
     323    delete slProperties.id; 
     324    delete slProperties.width; 
     325    delete slProperties.height; 
     326     
     327    for (var name in slProperties) 
     328    { 
     329        if (slProperties[name]) 
     330        { 
     331            htmlBuilder.push('<param name="'+Silverlight.HtmlAttributeEncode(name)+'" value="'+Silverlight.HtmlAttributeEncode(slProperties[name])+'" />'); 
     332        } 
     333    } 
     334    htmlBuilder.push('<\/object>'); 
     335    return htmlBuilder.join(''); 
     336} 
     337 
     338 
     339 
     340////////////////////////////////////////////////////////////////// 
     341// 
     342// createObjectEx: 
     343// 
     344// takes a single parameter of all createObject  
     345// parameters enclosed in {} 
     346// 
     347////////////////////////////////////////////////////////////////// 
     348 
     349Silverlight.createObjectEx = function(params) 
     350{ 
     351    var parameters = params; 
     352    var html = Silverlight.createObject(parameters.source, parameters.parentElement, parameters.id, parameters.properties, parameters.events, parameters.initParams, parameters.context); 
     353    if (parameters.parentElement == null) 
     354    { 
     355        return html; 
     356    } 
     357} 
     358 
     359/////////////////////////////////////////////////////////////////////////////////////////////// 
     360// 
     361// buildPromptHTML 
     362// 
     363// Builds the HTML to prompt the user to download and install Silverlight 
     364// 
     365/////////////////////////////////////////////////////////////////////////////////////////////// 
     366Silverlight.buildPromptHTML = function(slPluginHelper) 
     367{ 
     368    var slPluginHTML = ""; 
     369    var urlRoot = Silverlight.fwlinkRoot; 
     370    var shortVer = slPluginHelper.version ; 
     371    if ( slPluginHelper.alt ) 
     372    { 
     373        slPluginHTML = slPluginHelper.alt; 
     374    } 
     375    else 
     376    { 
     377        if (! shortVer ) 
     378        { 
     379            shortVer=""; 
     380        } 
     381        slPluginHTML = "<a href='javascript:Silverlight.getSilverlight(\"{1}\");' style='text-decoration: none;'><img src='{2}' alt='Get Microsoft Silverlight' style='border-style: none'/></a>"; 
     382        slPluginHTML = slPluginHTML.replace('{1}', shortVer ); 
     383        slPluginHTML = slPluginHTML.replace('{2}', urlRoot + '108181'); 
     384    } 
     385     
     386    return slPluginHTML; 
     387} 
     388 
     389/////////////////////////////////////////////////////////////////////////////////////////////// 
     390// 
     391// getSilverlight: 
     392// 
     393// Navigates the browser to the appropriate Silverlight installer 
     394// 
     395/////////////////////////////////////////////////////////////////////////////////////////////// 
     396Silverlight.getSilverlight = function(version) 
     397{ 
     398    if (Silverlight.onGetSilverlight ) 
     399    { 
     400        Silverlight.onGetSilverlight(); 
     401    } 
     402     
     403    var shortVer = ""; 
     404    var reqVerArray = String(version).split("."); 
     405    if (reqVerArray.length > 1) 
     406    { 
     407        var majorNum = parseInt(reqVerArray[0] ); 
     408        if ( isNaN(majorNum) || majorNum < 2 ) 
     409        { 
     410            shortVer = "1.0"; 
     411        } 
     412        else 
     413        { 
     414            shortVer = reqVerArray[0]+'.'+reqVerArray[1]; 
     415        } 
     416    } 
     417     
     418    var verArg = ""; 
     419     
     420    if (shortVer.match(/^\d+\056\d+$/) ) 
     421    { 
     422        verArg = "&v="+shortVer; 
     423    } 
     424     
     425    Silverlight.followFWLink("114576" + verArg); 
     426} 
     427 
     428 
     429/////////////////////////////////////////////////////////////////////////////////////////////// 
     430// 
     431// followFWLink: 
     432// 
     433// Navigates to a url based on fwlinkid 
     434// 
     435/////////////////////////////////////////////////////////////////////////////////////////////// 
     436Silverlight.followFWLink = function(linkid) 
     437{ 
     438    top.location=Silverlight.fwlinkRoot+String(linkid); 
     439} 
     440 
     441/////////////////////////////////////////////////////////////////////////////////////////////// 
     442// 
     443// HtmlAttributeEncode: 
     444// 
     445// Encodes special characters in input strings as charcodes 
     446// 
     447/////////////////////////////////////////////////////////////////////////////////////////////// 
     448Silverlight.HtmlAttributeEncode = function( strInput ) 
     449{ 
     450      var c; 
     451      var retVal = ''; 
     452 
     453    if(strInput == null) 
     454      { 
     455          return null; 
     456    } 
     457       
     458      for(var cnt = 0; cnt < strInput.length; cnt++) 
     459      { 
     460            c = strInput.charCodeAt(cnt); 
     461 
     462            if (( ( c > 96 ) && ( c < 123 ) ) || 
     463                  ( ( c > 64 ) && ( c < 91 ) ) || 
     464                  ( ( c > 43 ) && ( c < 58 ) && (c!=47)) || 
     465                  ( c == 95 )) 
     466            { 
     467                  retVal = retVal + String.fromCharCode(c); 
     468            } 
     469            else 
     470            { 
     471                  retVal = retVal + '&#' + c + ';'; 
     472            } 
     473      } 
     474       
     475      return retVal; 
     476} 
     477/////////////////////////////////////////////////////////////////////////////// 
     478// 
     479//  default_error_handler: 
     480// 
     481//  Default error handling function  
     482// 
     483/////////////////////////////////////////////////////////////////////////////// 
     484 
     485Silverlight.default_error_handler = function (sender, args) 
     486{ 
     487    var iErrorCode; 
     488    var errorType = args.ErrorType; 
     489 
     490    iErrorCode = args.ErrorCode; 
     491 
     492    var errMsg = "\nSilverlight error message     \n" ; 
     493 
     494    errMsg += "ErrorCode: "+ iErrorCode + "\n"; 
     495 
     496 
     497    errMsg += "ErrorType: " + errorType + "       \n"; 
     498    errMsg += "Message: " + args.ErrorMessage + "     \n"; 
     499 
     500    if (errorType == "ParserError") 
     501    { 
     502        errMsg += "XamlFile: " + args.xamlFile + "     \n"; 
     503        errMsg += "Line: " + args.lineNumber + "     \n"; 
     504        errMsg += "Position: " + args.charPosition + "     \n"; 
     505    } 
     506    else if (errorType == "RuntimeError") 
     507    { 
     508        if (args.lineNumber != 0) 
     509        { 
     510            errMsg += "Line: " + args.lineNumber + "     \n"; 
     511            errMsg += "Position: " +  args.charPosition + "     \n"; 
     512        } 
     513        errMsg += "MethodName: " + args.methodName + "     \n"; 
     514    } 
     515    alert (errMsg); 
     516} 
     517 
     518/////////////////////////////////////////////////////////////////////////////////////////////// 
     519// 
     520// __cleanup: 
     521// 
     522// Releases event handler resources when the page is unloaded 
     523// 
     524/////////////////////////////////////////////////////////////////////////////////////////////// 
     525Silverlight.__cleanup = function () 
     526{ 
     527    for (var i = Silverlight._silverlightCount - 1; i >= 0; i--) { 
     528        window['__slEvent' + i] = null; 
     529    } 
     530    Silverlight._silverlightCount = 0; 
     531    if (window.removeEventListener) {  
     532       window.removeEventListener('unload', Silverlight.__cleanup , false); 
     533    } 
     534    else {  
     535        window.detachEvent('onunload', Silverlight.__cleanup ); 
     536    } 
     537} 
     538 
     539/////////////////////////////////////////////////////////////////////////////////////////////// 
     540// 
     541// __getHandlerName: 
     542// 
     543// Generates named event handlers for delegates. 
     544// 
     545/////////////////////////////////////////////////////////////////////////////////////////////// 
     546Silverlight.__getHandlerName = function (handler) 
     547{ 
     548    var handlerName = ""; 
     549    if ( typeof handler == "string") 
     550    { 
     551        handlerName = handler; 
     552    } 
     553    else if ( typeof handler == "function" ) 
     554    { 
     555        if (Silverlight._silverlightCount == 0) 
     556        { 
     557            if (window.addEventListener)  
     558            { 
     559                window.addEventListener('onunload', Silverlight.__cleanup , false); 
     560            } 
     561            else  
     562            { 
     563                window.attachEvent('onunload', Silverlight.__cleanup ); 
     564            } 
     565        } 
     566        var count = Silverlight._silverlightCount++; 
     567        handlerName = "__slEvent"+count; 
     568         
     569        window[handlerName]=handler; 
     570    } 
     571    else 
     572    { 
     573        handlerName = null; 
     574    } 
     575    return handlerName; 
     576}