




/*
     FILE ARCHIVED ON 21:10:08 фев 18, 2008 AND RETRIEVED FROM THE
     INTERNET ARCHIVE ON 11:44:16 июл 31, 2014.
     JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.

     ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
     SECTION 108(a)(3)).
*/
// //
// Copyright 2007 comScore Networks. All rights reserved.

// Name: Microsoft Silverlight Beta
// Date: 2007-12-13

// Create the configuration, globals, and constants namespaces.
var SR_Cfg = new Object();
var SR_Glb = new Object();
var SR_Con = new Object();

// Validation variables.
SR_Glb.parseFlag = false;
SR_Glb.empty = false;

// Browser information.
SR_Con.browser = new Object();
SR_Con.browser.internetExplorer = 'Microsoft Internet Explorer';
SR_Con.browser.mozilla = 'Netscape';
SR_Con.browser.opera = 'Opera';

// Check browser information.
SR_Glb.browserName = navigator.appName; 
SR_Glb.browserVersion = parseInt(navigator.appVersion);

// Initialize browser flags.
SR_Glb.isInternetExplorer = false;
SR_Glb.isMozilla = false;
SR_Glb.isInternetExplorer7 = false;

// Check for Internet Explorer based browsers.
if (SR_Glb.browserName == SR_Con.browser.internetExplorer)
{
    if (SR_Glb.browserVersion > 3)
    {
        // Only 5.5 and above.
        var a = navigator.userAgent.toLowerCase();
        if (a.indexOf("msie 5.0") == -1 && a.indexOf("msie 5.0") == -1)
        {
            SR_Glb.isInternetExplorer = true;
        }
        
        // Check for 7.
        if (a.indexOf("msie 7") != -1)
        {
            SR_Glb.isInternetExplorer7 = true;
        }
    }
}

// Check for Mozilla based browsers.
if (SR_Glb.browserName == SR_Con.browser.mozilla)
{
    if (SR_Glb.browserVersion > 4)
    {
        SR_Glb.isMozilla = true;
    }
}

// Since Opera 9.02, they no longer use 'Mozilla' in the browser name
if (SR_Glb.browserName == SR_Con.browser.opera)
{
	SR_Glb.isMozilla = true;	// treat the same as Mozilla
}

// Cookie lifetime.
SR_Con.cookieLifetimeType = new Object();
SR_Con.cookieLifetimeType.duration = 1;
SR_Con.cookieLifetimeType.expireDate = 2;
    
// Invitation type.
SR_Con.invitationType = new Object();
SR_Con.invitationType.standard = 0;
SR_Con.invitationType.email = 1;
SR_Con.invitationType.domainDeparture = 2;
SR_Con.invitationType.emailDomainDeparture = 3;
    
// Cookie type flags.
SR_Con.cookieType = new Object();
SR_Con.cookieType.alreadyAsked = 1;
SR_Con.cookieType.inProgress = 2;
SR_Con.cookieType.emailDomainDeparture = 3;

// Alignment types.
SR_Con.horizontalAlignment = new Object();
SR_Con.horizontalAlignment.left = 0;
SR_Con.horizontalAlignment.middle = 1;
SR_Con.horizontalAlignment.right = 2;
SR_Con.verticalAlignment = new Object();
SR_Con.verticalAlignment.top = 0;
SR_Con.verticalAlignment.middle = 1;
SR_Con.verticalAlignment.bottom = 2;

// Survey cookie configuration.
SR_Cfg.cookieName = 'dlcresearch';
SR_Cfg.cookieDomain = '.microsoft.com';
SR_Cfg.cookiePath = '/';

SR_Con.cookieJoinChar = ':';

// Settings for cookie lifetime.
SR_Cfg.cookieLifetimeType = 1;

    // Duration of the cookie in days.
    SR_Cfg.cookieDuration = 90 * 86400000;

// Duration of the rapid cookie.
SR_Cfg.rapidCookieDuration = 0 * 86400000;

// URL of the email domain dep server.
SR_Cfg.listenerUrl = '';// //
// Copyright 2007 comScore Networks. All rights reserved.

// MOD: Setting temp msresearch cookie
if (document.cookie.indexOf("dlcresearch") == -1 && document.cookie.indexOf("msresearch") == -1)
{
		/*
		var SR_cd = new Date();  
		var SR_ed = new Date();
		var SR_du = 30 * 1000;
		SR_ed.setTime(SR_cd.getTime() + SR_du);
		*/
		var SR_cn = 'msresearch'
		var SR_dom = '.microsoft.com';
		
		var c = SR_cn + '=1;path=/; '; 
		//var c += 'expires=' + SR_ed.toGMTString() + ';';
		if (SR_dom != '') { c += 'domain=' + SR_dom; }
		document.cookie = c;
}

// KeepAlive class definition.
function SiteRecruit_KeepAlive()
{
    // Time between page checks.
    this.keepAlivePollDelay = 1000;

    // Unique (well, sorta) ID for this page.
    this.id = Math.random();

    // Attach methods.
    this.attemptStart = KeepAlive_attemptStart;
    this.checkCookie = KeepAlive_checkCookie;
    this.inProgressCookieExists = KeepAlive_inProgressCookieExists;
    this.cookieExists = KeepAlive_cookieExists;

    // Check for either domain dep or email domain dep cookies and act accordingly.
    function KeepAlive_attemptStart()
    {
        if (this.inProgressCookieExists())
        {
            setInterval('SR_Glb.keepAlive.checkCookie()', this.keepAlivePollDelay);
        }
        else
        {
            if (this.cookieExists(SR_Con.cookieType.emailDomainDeparture))
            {
                var c = document.cookie.toString();
                var index = c.indexOf(SR_Cfg.cookieName + '=' + SR_Con.cookieType.emailDomainDeparture);
                var endc = c.length;
                c = c.substring(index, endc);
                var ind1 = c.indexOf(';');
                if (ind1 != -1) c = c.substring(0, ind1);        
                var ind2 = c.indexOf('=');
                c = c.substring(ind2 + 1);
                var values = c.split(':');
                if (values.length == 2)
                {
                    var url = SR_Cfg.listenerUrl;
                    
                    // append ? to qs if needed
					url += (url.indexOf('?') == -1 ? '?' : '&');
					
                    url += 'action=log'
                        + '&user=' + values[1]
                        + '&location=' + escape(window.location);
                    
                    setTimeout("var i = new Image(); i.src = '" + url + "&' + (new Date()).getTime(); ", 5);
                }
            }
        }
    }
    
    // Check and update the cookie.
    function KeepAlive_checkCookie()
    {
        if (this.inProgressCookieExists())
        {
            var c = SR_Cfg.cookieName + '=' + SR_Con.cookieType.inProgress
                + ':' + escape(document.location)
                + ':' + (new Date()).getTime()
                + ':' + this.id
                + '; path=' + SR_Cfg.cookiePath;
            
            if (SR_Cfg.cookieDomain != '')
            {
                c += '; domain=' + SR_Cfg.cookieDomain;
            }
            
            document.cookie = c;
        }
    }

    // Return true if an in-progress cookie exists.
    function KeepAlive_inProgressCookieExists()
    {
        return this.cookieExists(SR_Con.cookieType.inProgress);
    }
    
    // Return true if a cookie of the given type exists.
    function KeepAlive_cookieExists(cookieType)
    {
        var c = SR_Cfg.cookieName + '=' + cookieType;
        if (document.cookie.indexOf(c) != -1)
        {
            return true;
        }
        return false;
    }
}

// Create the KeepAlive if a suitable cookie exists.
SR_Glb.keepAlive = new SiteRecruit_KeepAlive();
SR_Glb.keepAlive.attemptStart();
// //
// Copyright 2007 comScore Networks. All rights reserved.

// Broker class definition.
function SiteRecruit_PageConfigurationBroker()
{
    // List of mappings, each contains [url, page, priority, prereqs]    
    this.m = [        
    ['', '/downloads/includes/custom/SiteRecruit_PageConfiguration_dcbeta1.js', 1, null],
    ];
    
    // Attach methods.
    this.start = PageConfigurationBroker_start;
    this.getConfigurationForPage = PageConfigurationBroker_getConfigurationForPage;
    this.loadConfiguration = PageConfigurationBroker_loadConfiguration;

    // Start the Broker.
    function PageConfigurationBroker_start(url)
    {        
        // Decide if there are surveys to run for this page.
        var configuration = this.getConfigurationForPage(url);
        
        // If there is, load id up.
        if (configuration != null)
        {
            this.loadConfiguration(configuration);
        }
    }
    
    // Return the appropriate configuration for the given URL, if any.
    function PageConfigurationBroker_getConfigurationForPage(url)
    {
        
        var currentScore = 0;
        var currentMatch = -1;
        
        // Iterate over each URL.
        for (var i = 0; i < this.m.length; i++)
        {
            if (this.m[i] != null)
            {
                // Do the reg exp match.
                var r = new RegExp(this.m[i][0], 'i');
                if (url.toString().search(r) != -1)
                {
                    var prereqs = this.m[i][3];
                    var matchPrereqs = true;
                    
                    // Now check the prereqs.
                    if (prereqs != null)
                    {
                        for (var j = 0; j < prereqs.length; j++)
                        {
                            var p = prereqs[j];
                            if (p != null)
                            {
                                if (p.elementType)
                                {
                                    var matchContent = false;
                                    var matchAttribute = false;
                                    
                                    var elements = document.getElementsByTagName(p.elementType);
                                    for (var k = 0; k < elements.length; k++)
                                    {
                                        if (p.contentValue != '')
                                        {
                                            if (elements[k].innerHTML.search(p.contentValue) != -1)
                                            {
                                                matchContent = true;
                                            }
                                        }
                                        else
                                        {
                                            matchContent = true;
                                        }
                                        
                                        if (p.attributeName != '')
                                        {
                                            var a = elements[k].attributes.getNamedItem(p.attributeName);
                                            if (a != null)
                                            {
                                                if (p.attributeValue != '')
                                                {
                                                    if (a.value.search(p.attributeValue) != -1)
                                                    {
                                                        matchAttribute = true;
                                                    }
                                                }
                                                else
                                                {
                                                    matchAttribute = true;
                                                }
                                             }
                                        }
                                        else
                                        {
                                            matchAttribute = true;
                                        }
                                    }
                                    
                                    if (!matchContent || !matchAttribute)
                                    {
                                        matchPrereqs = false;
                                        break;
                                    }
                                }
                                else if (p.cookieName)
                                {
                                    var cookieTemplate = p.cookieName + '=';
                                    if (p.cookieValue)
                                    {
                                        cookieTemplate += p.cookieValue;
                                    }
                                    if (document.cookie.indexOf(cookieTemplate) == -1)
                                    {
                                        matchPrereqs = false;
                                        break;
                                    }
                                }
                                else if (p.language)
                                {
                                    if (navigator.language && navigator.language.toString().toLowerCase().indexOf(p.language) == -1)
                                    {
                                        matchPrereqs = false;
                                        break;
                                    }
                                    else if (navigator.userLanguage && navigator.userLanguage.toString().toLowerCase().indexOf(p.language) == -1)
                                    {
                                        matchPrereqs = false;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        matchPrereqs = true;
                    }
                    
                    if (matchPrereqs)
                    {
                        // Take the current if the score is equal or better.
                        var newScore = this.m[i][2];
                        if (newScore >= currentScore)
                        {
                            currentMatch = i;
                            currentScore = newScore;
                        }
                    }
                }
            }
        }
        
        // If there was a match, return the appropriate page configuration.
        var page = null;
        if (currentMatch >= 0)
        {
            page = this.m[currentMatch][1];
        }
        
                
        return page;
    }
    
    // Dynamically loads the associated configuration.
    function PageConfigurationBroker_loadConfiguration(configuration)
    {
                
        document.write('<script language="JavaScript" src="' + configuration + '"></script>');
    }
}

try
{
    // Only run if the browser is supported.
    if (SR_Glb.isInternetExplorer || SR_Glb.isMozilla)
    {
    		if (document.cookie.toString().toLowerCase().indexOf("view_dcbeta1") != -1 && window.location.toString().toLowerCase().indexOf("/downloads/search.aspx?displaylang=en") != -1)
    		{
    			window.location.href = "/beta/downloads/Default.aspx";
    		}
        // Create and start the Broker for the current location.
        SR_Glb.broker = new SiteRecruit_PageConfigurationBroker();
        SR_Glb.broker.start(window.location);
    }
}
catch (e)
{
    // Suppress any errors.
}

SR_Glb.parseFlag = true;