﻿function getFlashMovieElement(name) { var isIE = navigator.appName.indexOf('Microsoft') != -1; return (isIE) ? window[name] : document[name]; }

var intervalID; var targetHeight;

function setSwfHeight(h) {
    clearInterval(intervalID);
    var swf = getFlashMovieElement("header");
    targetHeight = h;
    alert(swf);
    if (parseInt(swf.height) < targetHeight) { intervalID = setInterval(incrementSWFHeight, 50); }
    else { intervalID = setInterval(decrementSWFHeight, 50); }
}

function incrementSWFHeight() {
    var swf = getFlashMovieElement("header");
    if (parseInt(swf.height) < targetHeight) { swf.height = parseInt(swf.height) + 10; }
    else { swf.height = targetHeight; clearInterval(intervalID); }
}

function decrementSWFHeight() {
    var swf = getFlashMovieElement("header"); if (parseInt(swf.height) > targetHeight) { swf.height = parseInt(swf.height) - 10; }
    else { swf.height = targetHeight; clearInterval(intervalID); }
}

function noCacheIE(url) {
    var isIE = navigator.appName.indexOf("Microsoft") != -1;
    if (!isIE) return (url);
    var newUrl = '?';
    if (url.indexOf('?') != -1) newUrl = '&';
    var now = new Date();
    var rand = Math.random().toString().substring(2, 4);
    newUrl = url + newUrl + "noCacheIE=" + rand + '-' + now.getTime().toString();
    return (newUrl);
}

String.prototype.endsWith = function(str) {return (this.match(str+"$")==str)}

function getContent(path) {
    if (path.substring(0, 4) == "http") {
        location = path;
    }
    else if (path.indexOf('mode=sub') > -1) {
        $get('contentframe').src = path;
    }
    else {
        if (path.indexOf('?') > -1)
            $get('contentframe').src = path + '&mode=sub';
        else
            $get('contentframe').src = path + '?mode=sub';
    }
}
