// load random flash content on homepage
            var swfArray = new Array ();
            swfArray [0] = "../../assets/swf/topFlash.swf";

            var selectedswf = Math.floor (Math.random () * swfArray.length);

            function insert_flash_content ()
            {
                  var elem = document.createElement ("embed");
                  elem.setAttribute ("src", swfArray [selectedswf]);
                  elem.setAttribute ("width", "900px");  
                  elem.setAttribute ("height", "325px");  
                  elem.setAttribute ("scale", "100%");
                  elem.setAttribute("wmode", "transparent");
                  elem.setAttribute("quality", "high");

                  document.getElementById("homeflash").appendChild(elem);
            }

// Open the Email Article window
function emailThis() {

    window.open('../../Email_Article.aspx', 'Email', 'toolbar=no,menubar=no,location=no,resizable=no,status=no,width=500,height=325,scrollbars=no,scroll=no')
}

// Show/Hide div
function ShowHide(elementId)
{
	var element = document.getElementById(elementId);
	if(element.style.display != "block")
	{
		element.style.display = "block";
	}
	else
	{
		element.style.display = "none";
	}
}

// Close window
function clswin() {
    close();
} 

// Just return the HTML data for IFRAME
function remoteloaddata(url)
{
  var uniq = 'remote' + (Math.floor(Math.random() * 1000000));
  var data = '<iframe class="remoteload" src="' + url + '" id="iframe' + uniq + '" ';
  data += 'onload="remoteload_handler(this, \'' + uniq + '\');" ';
  data += 'style="display: block; top: -100px; left: -100px; ';
  data += 'position: absolute; width: 1px; height: 1px;"></iframe>';
  data += '<div id="'+uniq+'"></div>';
  return data;
}

function remoteload(url) {
  document.write(remoteloaddata(url));
}


var IE4 = document.all;
var NN7 = (!IE4 && document.getElementById);
var IE5 = (IE4 && navigator.userAgent.indexOf("Mac") == -1 && (navigator.userAgent.indexOf("MSIE 5") != -1 || navigator.userAgent.indexOf("MSIE 4") != -1));
//if (!(NN7 || IE4) && location.href.indexOf("nonstandard.htm") == -1) location.replace("nonstandard.htm");
if (IE4 && navigator.userAgent.indexOf("Opera") != -1) {
    NN7 = true;
    IE4 = false;
}
var safari = (navigator.userAgent.indexOf("Safari") != -1);

function getStyleObject(obj) {
    var theObj = (IE4 ? document.all[obj] : document.getElementById(obj));
    return (theObj ? theObj.style : null);
}

function getObject(obj) {
    return (IE4 ? document.all[obj] : document.getElementById(obj));
}

function checkMenuStatus(e) {
    if (listcheck)
        listcheck = false;
    else {
        e = (e ? e : window.event);
        var element = (IE4 ? e.srcElement : e.currentTarget);
        if (element.className != "weblink" && element.id != "weblist" && element.id != "network" && element.id != "dropmenu") {
            getStyleObject("weblist").display = "none";
            getStyleObject("listarrow").visibility = "hidden";
        }
    }
}

function printThis() {
    if (typeof print == "object" || typeof print ==
"function")
        print();
}

// FUNCTION FOR POPUP WINDOWS
function popup(url, winname, w, h, feat) {
    if (!(isNaN(w) || isNaN(h))) {
        var adjust = 20;
        var x = parseInt((screen.width - w) / 2);
        var y = parseInt(((screen.height - h) / 2 - adjust));
        if (x < 0) x = 0;
        if (y < 0) y = 0;

        if (feat != null && feat != "") {
            feat = "," + feat;
        }
        else {
            feat = "";
        }
        feat = "left=" + x + ",top=" + y + ",width=" + w + ",height=" + h + feat;
    }
    var this_win = window.open(url, winname, feat);
    this_win.focus();
}

// GENERIC TEST STRING IS BLANK FUNCTION
function isEmpty(field) {
    var re = /^\s{1,}$/g;
    if ((field.length == 0) || (field == null) || ((field.search(re)) > -1)) {
        return true;
    }
    else {
        return false;
    }
}
function addCssClass(className, elementId) {
    var myElement = document.getElementById(elementId);
    myElement.setAttribute("class", className); 		//for browsers that follow specs
    myElement.setAttribute("className", className); //for IE
    return false;
}

function javascriptRedirect() {
    var queryString = window.top.location.search.substring(1);
    if (queryString.length > 0) {
        var path = queryString.substring(4, queryString.length);
        document.location.href = path;
    } else {
        document.location.href = history.back(-2);
    }
}

// Return the specified request parameter value...
function getRequestParam(paramName) {
    var queryString = window.top.location.search.substring(1);
    if (queryString.length > 0) {
        var prms = queryString.split("&");
        for (i = 0; i < prms.length; i++) {
            var name = prms[i].substring(0, prms[i].indexOf("="));
            var value = prms[i].substring(prms[i].indexOf("=") + 1, prms[i].length);
            if (paramName == name) {
                return value;
            }
        }
        return null;
    } else {
        return null;
    }
}

function displayTime() {
    var localTime = new Date();
    var year = localTime.getYear();
    var month = localTime.getMonth() + 1;
    var date = localTime.getDate();
    var hours = localTime.getHours();
    var minutes = localTime.getMinutes();
    var seconds = localTime.getSeconds();
    var div = document.getElementById("div2");
    div.innerText = year + "-" + month + "-" + date + " " + hours + ":" + minutes;
}

function at_show_aux(parent, child) {
    var p = document.getElementById(parent);
    var c = document.getElementById(child);

    var top = (c["at_position"] == "y") ? p.offsetHeight + 2 : 0;
    var left = (c["at_position"] == "x") ? p.offsetWidth + 2 : 0;

    for (; p; p = p.offsetParent) {
        top += p.offsetTop;
        left += p.offsetLeft;
    }

    c.style.position = "absolute";
    c.style.top = top + 'px';
    c.style.left = left + 'px';
    c.style.visibility = "visible";
}

// ***** at_show *****

function at_show() {
    var p = document.getElementById(this["at_parent"]);
    var c = document.getElementById(this["at_child"]);

    at_show_aux(p.id, c.id);
    clearTimeout(c["at_timeout"]);
}

// ***** at_hide *****

function at_hide() {
    var p = document.getElementById(this["at_parent"]);
    var c = document.getElementById(this["at_child"]);

    c["at_timeout"] = setTimeout("document.getElementById('" + c.id + "').style.visibility = 'hidden'", 333);
}

// ***** at_click *****

function at_click() {
    var p = document.getElementById(this["at_parent"]);
    var c = document.getElementById(this["at_child"]);

    if (c.style.visibility != "visible") at_show_aux(p.id, c.id); else c.style.visibility = "hidden";
    return false;
}

// ***** at_attach *****

// PARAMETERS:
// parent   - id of the parent html element
// child    - id of the child  html element that should be droped down
// showtype - "click" = drop down child html element on mouse click
//            "hover" = drop down child html element on mouse over
// position - "x" = display the child html element to the right
//            "y" = display the child html element below
// cursor   - omit to use default cursor or specify CSS cursor name

function at_attach(parent, child, showtype, position, cursor) {
    var p = document.getElementById(parent);
    var c = document.getElementById(child);

    p["at_parent"] = p.id;
    c["at_parent"] = p.id;
    p["at_child"] = c.id;
    c["at_child"] = c.id;
    p["at_position"] = position;
    c["at_position"] = position;

    c.style.position = "absolute";
    c.style.visibility = "hidden";

    if (cursor != undefined) p.style.cursor = cursor;

    switch (showtype) {
        case "click":
            p.onclick = at_click;
            p.onmouseout = at_hide;
            c.onmouseover = at_show;
            c.onmouseout = at_hide;
            break;
        case "hover":
            p.onmouseover = at_show;
            p.onmouseout = at_hide;
            c.onmouseover = at_show;
            c.onmouseout = at_hide;
            break;
    }
}


