﻿
function getQuerystring(key, default_) {
    if (default_ == null) default_ = "";
    key = key.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regex = new RegExp("[\\?&]" + key + "=([^&#]*)");
    var qs = regex.exec(window.location.href);
    if (qs == null)
        return default_;
    else
        return qs[1];
}

    var isCMSAdmin = getQuerystring('cmspagemode', 'notfound');
    
    var page = "index/nav/" + location.href.split('/')[3].split('.')[0].toLowerCase().replace('-', '_').replace('-', '_');
    var loc = location.href.toLowerCase();
    loc = loc.substring(loc.indexOf('//') + 2);
    loc = loc.substring(loc.indexOf('/home') + 5);
    var lastIndex = loc.indexOf('.aspx');
    loc = loc.substring(0, lastIndex);

    if (loc == '')
    { loc = '/home' }

    page = loc;

    if (isCMSAdmin == 'notfound') {
        var flashvars = {
            branch: page
        };
        var params = {
            allowScriptAccess: "always"
        };
        var attributes = {
            id: "flashcontent"
        };
        
        swfobject.embedSWF("MomentumWW.swf", "flashcontent", "990", "580", "9.0.28", "expressInstall.swf", flashvars, params, attributes);
        //swffit.fit("flashcontent", 990, 580, null, null, true, false);

        //init the youTubeLoader JavaScript methods
        SWFID = "flashcontent"
    }
