﻿
var cs_e59079113e124a64a6b1b4c0b4b86b03_Utils = new Object();
cs_e59079113e124a64a6b1b4c0b4b86b03_Utils.CreateSafeFunction = function(instance, func)
{
    return function() {
        return func.apply(instance, arguments);
    }
}
var loader_e59079113e124a64a6b1b4c0b4b86b03 = new cs_e59079113e124a64a6b1b4c0b4b86b03_Loader();
loader_e59079113e124a64a6b1b4c0b4b86b03.ReplaceScriptTag('http:\/\/telligent.com\/support\/communityserver\/community_server_2008\/m\/community_server_2008\/617628\/embed.aspx','<div id=\"video_04497991-9ffb-4a8b-9836-f771b1877eea\"><noscript><embed type=\"application\/x-shockwave-flash\" src=\"http:\/\/telligent.com\/WebResource.axd?d=TQhLjX-BO5TZZE6-8qsvM6fpx3ImjAEaRomOPkv7JBHXk0MGzeyNbpsmriUob5iYHsk0BI6g0IlcfaeGp9F7lGpoG1YHoDNmLWVuOuoxisD5UAKZhgO38pvznPbS7MHc7N_rbImGjc9NO351adyMG0sve4W9LZGimRnGH_XS-Xsfi3TYTD_WfST_bwf80ZyL3cacUg2&amp;t=634590353900000000\" width=\"300\" height=\"225\" allowfullscreen=\"true\" flashvars=\"width=300&amp;height=225&amp;file=http%3A%2F%2Fdev.communityserver.com%2Fvideos%2F2008%2Fcs-2008-04-intro.flv\"  \/><\/noscript><\/div>');
loader_e59079113e124a64a6b1b4c0b4b86b03.AddScriptToLoad(new cs_e59079113e124a64a6b1b4c0b4b86b03_ScriptToLoad(true, 'http:\/\/telligent.com\/WebResource.axd?d=xKzwhkyHtZrLvdcALlyHazZsGgxkNIKH7M_4sg2cp_3nMy74e2FyYaHy9ecs8ZCdmHpDbvh1ipOAbo0M9tXPnaYxdIWB85WXXXWAWv5qrd_Ubqmz31fndQSctcBnTum_bw1Vd9BJ_TQCWzfB35NAv7wm3R6BwG8BHejz9zdnuZdcgVwrJt80R8VQKApwabKenmrwSQ2&t=634590353900000000'));
loader_e59079113e124a64a6b1b4c0b4b86b03.AddScriptToLoad(new cs_e59079113e124a64a6b1b4c0b4b86b03_ScriptToLoad(false, 'try\n{\ncs_setInnerHtml(\'video_04497991-9ffb-4a8b-9836-f771b1877eea\',\'<embed type=\\\"application\\\/x-shockwave-flash\\\" src=\\\"http:\\\/\\\/telligent.com\\\/WebResource.axd?d=TQhLjX-BO5TZZE6-8qsvM6fpx3ImjAEaRomOPkv7JBHXk0MGzeyNbpsmriUob5iYHsk0BI6g0IlcfaeGp9F7lGpoG1YHoDNmLWVuOuoxisD5UAKZhgO38pvznPbS7MHc7N_rbImGjc9NO351adyMG0sve4W9LZGimRnGH_XS-Xsfi3TYTD_WfST_bwf80ZyL3cacUg2&amp;t=634590353900000000\\\" width=\\\"300\\\" height=\\\"225\\\" allowfullscreen=\\\"true\\\" flashvars=\\\"width=300&amp;height=225&amp;file=http%3A%2F%2Fdev.communityserver.com%2Fvideos%2F2008%2Fcs-2008-04-intro.flv\\\"  \\\/>\');\n} catch(e) { }'));
loader_e59079113e124a64a6b1b4c0b4b86b03.LoadAll();

function cs_e59079113e124a64a6b1b4c0b4b86b03_Loader()
{
    this._scriptsToLoad = new Array();
    this._currentScript = 0;

    this.AddScriptToLoad = function(scriptToLoad)
    {
        this._scriptsToLoad[this._scriptsToLoad.length] = scriptToLoad;
    }

    this.ReplaceScriptTag = function(scriptUrl, html)
    {
        scriptUrl = scriptUrl.toLowerCase();

        var scripts = document.getElementsByTagName('script');
        var script = null;
        for (var i = 0; i < scripts.length; i++)
        {
            if (scripts[i].src && scripts[i].src.toLowerCase() == scriptUrl)
	        {
		        script = scripts[i];
		        break;
	        }
        }

        if (script)
        {
	        var d = document.createElement('div');
	        d.innerHTML = html;
	        script.parentNode.insertBefore(d, script);
            script.parentNode.removeChild(script);
        }
    }

    this.AddCssText = function(cssText, media)
    {
        var s = document.createElement('style');
        s.type = 'text/css';

        if (media)
            s.media = media;

        if (s.styleSheet)
            s.styleSheet.cssText = cssText;
        else
            s.appendChild(document.createTextNode(cssText));

        document.getElementsByTagName('HEAD')[0].appendChild(s);            
    }

    this.LoadAll = function()
    {
        if (this._scriptsToLoad.length > 0 && this._currentScript < this._scriptsToLoad.length)
            this._scriptsToLoad[this._currentScript].Load(cs_e59079113e124a64a6b1b4c0b4b86b03_Utils.CreateSafeFunction(this, this._loadSuccessful), cs_e59079113e124a64a6b1b4c0b4b86b03_Utils.CreateSafeFunction(this, this._loadFailed));
    }

    this._loadSuccessful = function()
    {
        this._currentScript++;
        this.LoadAll();
    }

    this._loadFailed = function(e)
    {
        if (e)
            alert(e.message);
        else if (window.error)
            alert(window.error.message);
        else
            alert('An unknown error occurred while loading scripts associated to the latest callback');
    }
}

function cs_e59079113e124a64a6b1b4c0b4b86b03_ScriptToLoad(isInclude, content)
{
    this._isInclude = isInclude;
    this._content = content;
    this._element = null;
    this._completeCallback = null;
    this._errorCallback = null;
    this._errorTimeout = null;

    this._isSafari = function()
    {
        return navigator.userAgent.indexOf('Safari') != -1;
    }

    this._isIE = function()
    {
        return navigator && navigator.userAgent && navigator.userAgent.indexOf('MSIE') != -1
    }

    this.Load = function (completeCallback, errorCallback)
    {
        if (this._isInclude)
        {
            if (this._isScriptIncludeRegistered(this._content))
            {
                if (completeCallback)
                    completeCallback();
            }
            
            this._element = document.createElement('script');
            this._element.src = this._content;

            this._completeCallback = completeCallback;
            this._errorCallback = errorCallback;
            
            if (this._isSafari())
            {
                try
                {
                    document.getElementsByTagName('HEAD')[0].appendChild(this._element);
                }
                catch (e)
                {
                   if (errorCallback)
                       errorCallback(e);
                }

                setTimeout(cs_e59079113e124a64a6b1b4c0b4b86b03_Utils.CreateSafeFunction(this, this._completeCallback), 999);
            }
            else
            {
                if (this._isIE())
                {
                    this._element.onreadystatechange = cs_e59079113e124a64a6b1b4c0b4b86b03_Utils.CreateSafeFunction(this, this._readyStateChanged);
                }
                else
                {
                    this._element.readyState = 'loaded';
                    this._element.onload = cs_e59079113e124a64a6b1b4c0b4b86b03_Utils.CreateSafeFunction(this, this._readyStateChanged);
                }
                
                document.getElementsByTagName('HEAD')[0].appendChild(this._element);
                
                this._errorTimeout = setTimeout(cs_e59079113e124a64a6b1b4c0b4b86b03_Utils.CreateSafeFunction(this, this._errorOccured), 29999);
            }
        }
        else
        {
            var element = document.createElement('script');
            element.type = 'text/javascript';
            
            if (this._isSafari())
                element.innerHTML = this._content.replace(/(?:^\W*\/\/[^$]*?$|\/\*.*?\*\/)/gm, '');
            else
                element.text = this._content;
             
            try
            {
                document.getElementsByTagName('HEAD')[0].appendChild(element);
                
                if (!this._isSafari())
                    document.getElementsByTagName('HEAD')[0].removeChild(element);
            }
            catch (e)
            {
               if (errorCallback)
                   errorCallback(e);
            }

            if (completeCallback)
                completeCallback();
        }
    }

    this._isScriptIncludeRegistered = function(scriptUrl)
    {
        var scripts = document.getElementsByTagName('SCRIPT');
        
        for (var i = 0; i < scripts.length; i++)
        {

            if (scripts[i].src == scriptUrl)
                return true;
        }
        
        return false;
    }
    
    this._readyStateChanged = function()
    {
        if (this._element && (this._element.readyState == 'loaded' || this._element.readyState == 'complete'))
        {
            clearTimeout(this._errorTimeout);
            
            this._element.onreadystatechange = null;
            this._element.onload = null;
            this._element.onerror = null;
             
            if (this._completeCallback)
                this._completeCallback(); 
        }
    }
    
    this._errorOccured = function()
    {
        if (this._element)
        {
            this._element.onreadystatechange = null;
            this._element.onload = null;
            this._element.onerror = null;
        }
        
        if (this._errorCallback)
            this._errorCallback({'message': 'A script was not able to be loaded within the allowed time.  The callback has failed'});
    }
};

