﻿// JavaScript Document

function MM_findObj(n, d) { //v4.01
    var p, i, x;
    if (!d) d = document;
    if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
        d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
    }
    if (!(x = d[n]) && d.all) x = d.all[n];
    for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
    for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
    if (!x && d.getElementById) x = d.getElementById(n);
    return x;
}

function test1(me) {
    alert('hi');
}

function MenuRO(menuobj, onoff, fontcolor) {
    if (onoff == 1) {
        MM_findObj(menuobj).style.backgroundColor = "#ffffff";
        MM_findObj(menuobj).style.color = fontcolor;
    } else {
        MM_findObj(menuobj).style.backgroundColor = "Transparent";
        MM_findObj(menuobj).style.color = fontcolor;
    }
}

function SaveDivData(dataobj, destinobj) {
    MM_findObj(destinobj).value = MM_findObj(dataobj).innerHTML;
}

function setMode(ditem, bMode) {
    var sTmp;
    isHTMLMode = bMode;
    if (isHTMLMode) { sTmp = eval(ditem).innerHTML; eval(ditem).innerText = sTmp; }
    else { sTmp = eval(ditem).innerText; eval(ditem).innerHTML = sTmp; }
    //document.focus();
}

function getNextHighestZindex(obj) {
    var highestIndex = 0;
    var currentIndex = 0;
    var elArray = Array();
    if (obj) { elArray = obj.getElementsByTagName('*'); } else { elArray = document.getElementsByTagName('*'); }
    for (var i = 0; i < elArray.length; i++) {
        if (elArray[i].currentStyle) {
            currentIndex = parseFloat(elArray[i].currentStyle['zIndex']);
        } else if (window.getComputedStyle) {
            currentIndex = parseFloat(document.defaultView.getComputedStyle(elArray[i], null).getPropertyValue('z-index'));
        }
        if (!isNaN(currentIndex) && currentIndex > highestIndex) { highestIndex = currentIndex; }
    }
    return (highestIndex + 1);
}
