﻿function fToggleID(id) {
       var e = document.getElementById(id);
       if(e.style.display == 'block')
          e.style.display = 'none';
       else
          e.style.display = 'block';
    }

    var vFlashVersion = fGetFlashVersion();
    //var vSiteRoot = fGetRoot();
    if (document.location.search.indexOf("flash=0") > -1) vFlashVersion = 0;
    var vFlashOK = (vFlashVersion = 8);
    var W3CDOM = (document.getElementById && document.getElementsByTagName);


    function fWriteSWF(swfName) {
        if (vFlashOK) {
            fWriteFlash("_assets/swf/" + swfName + ".swf", null, null, true, null);
        } else {
            document.write('<div id="videoGetFlash" >');
            document.write('<a href="http://get.adobe.com/flashplayer/" >');
            document.write('<img src="' + '_assets/images/' + swfName + '.png" alt="" class="noImgBorder" />');
            document.write('</a>');
            document.write('</div>');
        }
    }


    function fWriteFlash(swf, fid, bgcolor, transparent, noscale) {
        var swf = swf;
        var txt = "";
        txt += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="340" height="143" ';
        if (fid) txt += 'id="' + fid + '" ';
        txt += 'codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0">';
        txt += '<param name="movie" value="' + swf + '" />';
        txt += '<param name="menu" value="false" />';
        if (bgcolor) txt += '<param name="bgcolor" value="' + bgcolor + '" />';
        if (noscale) txt += '<param name="scale" value="noscale" /><param name="salign" value="' + noscale + '" />';
        if (transparent) txt += '<param name="wmode" value="transparent" />';
        txt += '<embed src="' + swf + '" menu="false" width="340" height="143" ';
        if (fid) txt += 'id="' + fid + '" name="' + fid + '" ';
        if (bgcolor) txt += 'bgcolor="' + bgcolor + '" ';
        if (noscale) txt += 'scale="noscale" salign="' + noscale + '" ';
        if (transparent) txt += 'wmode="transparent" ';
        txt += 'swLiveConnect="true" type="application/x-shockwave-flash "';
        txt += 'pluginspage="//get.adobe.com/flashplayer/" />';
        txt += '</object>';
        document.write(txt);
    }

    function getElementsByCondition(condition, container, arg) { container = container || document; var all = container.all || container.getElementsByTagName('*'); var arr = new Array(); var e; for (var k = 0; k < all.length; k++) { e = all[k]; if (condition(e, k, arg)) arr[arr.length] = e; } return arr; }
    function fApplyStyle(id, style, prop) { var e = (typeof (id) == "string") ? document.getElementById(id) : id; if (e == null) return; if (e.style) e = e.style; e[style] = prop; }
    function fAddEvent(obj, evType, fn) { if (obj.addEventListener) { obj.addEventListener(evType, fn, false); return true; } else if (obj.attachEvent) { var r = obj.attachEvent("on" + evType, fn); return r; } else return false; }
    function fGetFlashWModeOK() { return (navigator.platform.toLowerCase().indexOf("win") > -1) && (navigator.appVersion.toLowerCase().indexOf('msie') > -1); }
    function fGetFlashVersion() { var latestV = 8; flVersion = 0; var agent = navigator.userAgent.toLowerCase(); if (agent.indexOf("mozilla/3") != -1 && agent.indexOf("msie") == -1) { flVersion = 0; } if (navigator.plugins != null && navigator.plugins.length > 0) { var flashPlugin = navigator.plugins['Shockwave Flash']; if (typeof flashPlugin == 'object') { for (var i = latestV; i >= 3; i--) { if (flashPlugin.description.indexOf(i + '.') != -1) { flVersion = i; break; } } } } else if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && agent.indexOf("win") != -1 && agent.indexOf("16bit") == -1) { var doc = '<scr' + 'ipt language="VBScript"\> \n'; doc += 'On Error Resume Next \n'; doc += 'Dim obFlash \n'; doc += 'For i = ' + latestV + ' To 3 Step -1 \n'; doc += '   Set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash." & i) \n'; doc += '   If IsObject(obFlash) Then \n'; doc += '      flVersion = i \n'; doc += '      Exit For \n'; doc += '   End If \n'; doc += 'Next \n'; doc += '</scr' + 'ipt\> \n'; document.write(doc); } else if (agent.indexOf("webtv/2.5") != -1) flVersion = 3; else if (agent.indexOf("webtv") != -1) flVersion = 2; else { flVersion = -1; } return flVersion; }
    if (!Array.prototype.pop) {
        function array_pop() { lastElement = this[this.length - 1]; this.length = Math.max(this.length - 1, 0); return lastElement; }
        Array.prototype.pop = array_pop;
    }    