// define aaijs namespaces
if (typeof (aaijs) == "undefined") aaijs = function() { }
if (typeof (aaijs.Debug) == "undefined") aaijs.Debug = function() { }
if (typeof (aaijs.UI) == "undefined") aaijs.UI = function() { }
if (typeof (aaijs.Forms) == "undefined") aaijs.Forms = function() { }
if (typeof (aaijs.Chat) == "undefined") aaijs.Chat = function() { }

/***********************POPUP******************************************/
function popup_window(url) {
    //remove a attribute if you don't want it to show up
    var popit = window.open(url, 'console', 'menubar=no,toolbar=no,status=yes,scrollbars=yes,resizable=yes');
}

/*************************NOTES****************************************/
var strg, ss, obj, lbl;
function ProcessClientClick(real, hid) {
    strg = new String(GetSelection());
    if (document.all) {
        obj = document.all(real);
        ss = document.all(hid);
    }
    else {
        obj = document.getElementById(real);
        ss = document.getElementById(hid);
    }

    if (strg.length > 0) {
        ss.value = strg;
    }
    if (ss.value.length > 0) {
        obj.value = ss.value;
    }
}
function ClearQuote(real, hid) {
    if (document.all) {
        obj = document.all(real);
        ss = document.all(hid);
    }
    else {
        obj = document.getElementById(real);
        ss = document.getElementById(hid);
    }
    obj.value = '';
    ss.value = '';
    ClearSelection();
}
/***************************END NOTES**********************************/
/********************GLOSSARY MULTILINE TOOLTIPS***********************/
function findPosX(obj) {
    var curleft = 0;
    if (obj.offsetParent) {
        while (obj.offsetParent) {
            curleft += obj.offsetLeft
            obj = obj.offsetParent;
        }
    }
    else if (obj.x)
        curleft += obj.x;
    return curleft;
}
function findPosY(obj) {
    var curtop = 0;
    if (obj.offsetParent) {
        while (obj.offsetParent) {
            curtop += obj.offsetTop
            obj = obj.offsetParent;
        }
    }
    else if (obj.y)
        curtop += obj.y;
    return curtop;
}
function xstooltip_show(tooltipId, parentId) {
    it = document.getElementById(tooltipId);
    img = document.getElementById(parentId);

    // if tooltip is too wide, shift left to be within parent 
    //    if (posX + it.offsetWidth > img.offsetWidth) posX = img.offsetWidth - it.offsetWidth;
    //    if (posX < 0 ) posX = 0; 

    //    x = findPosX(img) + posX;
    //    y = findPosY(img) + posY;
    x = findPosX(img);
    y = findPosY(img);
    it.style.top = y - 35;
    it.style.left = x - 40;

    it.style.visibility = 'visible';
}
function xstooltip_hide(id) {
    it = document.getElementById(id);
    it.style.visibility = 'hidden';
    //setLyr(parentId, tooltipId);

}
/********************GLOSSARY MULTILINE TOOLTIPS***********************/


//SELECTION, for notes
function GetSelection() {
    var txt = '';
    if (window.getSelection) {
        txt = window.getSelection();
    }
    else if (document.getSelection) {
        txt = document.getSelection();
    }
    else if (document.selection) {
        txt = document.selection.createRange().text;
    }
    else return;

    return txt;
}

function ClearSelection() {
    if (window.getSelection) {
        var sel = window.getSelection();
        sel.removeAllRanges();
    }
    else if (document.getSelection) {
        var sel = document.getSelect();
        sel.removeAllRanges();
    }
    else if (document.selection) {
        document.selection.empty();
    }
}

//Timer
function AlertValue(res) {
    if (res.value != '')
        alert(res.value);
}
function MessageValue(res) {
    if (res.value != '')
        document.getElementById("reopen").click();
}

function popUp(URL, width, height) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=" + width + ",height=" + height + "');");
}

//Function that will take a control name and focus/select it.  Typically for linkable error messages.
function GoToField(name) {
    if (document.getElementById) {
        try {
            document.getElementById(name).focus();
            document.getElementById(name).select();
        }
        catch (e) {
            //do nothing since this is just a focus/select issue.
        }
    }
    else if (document.all) {
        try {
            document.all(name).focus();
            document.all(name).select();
        }
        catch (e) {
            //do nothing since this is just a focus/select issue.
        }
    }
}

function gridEX1_Load(gridex) {
    var rootTable = gridex.getRootTable();
    var l = rootTable.getColumns().Count();
    for (var i = 0; i < l; i++) {
        var column = rootTable.getColumns().getGridEXColumn(i);
        if (column.getVisible())
            column.AutoSize();
    }
}

// Component Art Popup Calendar javascript functions
function onPickerChange(picker) {
    GradingPeriodItemInformation_Calendar1.SetSelectedDate(picker.GetSelectedDate());
}
function onCalendarChange(calendar) {
    GradingPeriodItemInformation_Picker1.SetSelectedDate(calendar.GetSelectedDate());
}
// This gets lame with multiple calendars
function onPickerChangeQuestionnaireStart(picker) {
    QuestionnaireInformation1_Calendar1.SetSelectedDate(picker.GetSelectedDate());
}
function onPickerChangeQuestionnaireEnd(picker) {
    QuestionnaireInformation1_Calendar2.SetSelectedDate(picker.GetSelectedDate());
}
function onCalendarChangeQuestionnaireStart(calendar) {
    QuestionnaireInformation1_calStartDate.SetSelectedDate(calendar.GetSelectedDate());
}
function onCalendarChangeQuestionnaireEnd(calendar) {
    QuestionnaireInformation1_calEndDate.SetSelectedDate(calendar.GetSelectedDate());
}

function SelectTemplate(grid, dropdown, ddl2, cb) {
    var select = document.getElementById(dropdown);
    var tosplit = select.options[select.selectedIndex].value;
    var chked = document.getElementById(ddl2).options[select.selectedIndex].value;
    document.getElementById(cb).checked = (chked == "true") ? true : false;

    SelectTemplateItems(tosplit, grid);
}

function SelectTemplateItems(tosplit, grid) {
    if (tosplit) {
        var radgrid = $find(grid);
        var indexes = tosplit.split(',');
        if (indexes[indexes.length - 1] >= radgrid.get_masterTableView().get_dataItems().length)
            return;

        for (templateidx = 0; templateidx < indexes.length; templateidx++) {
            radgrid.get_masterTableView().selectItem(indexes[templateidx]);
        }
    }
}

function DisplaySelectionTest(grid, adisp, rdisp, tdisp, lows, highs, names, costs, terms, amount, bracket, adjusted, terminput, termlbl, maxterm) {
    //values
    var lowarr = document.getElementById(lows).value.split(',');
    var higharr = document.getElementById(highs).value.split(',');
    var namearr = document.getElementById(names).value.split(',');
    var costarr = document.getElementById(costs).value.split(',');
    var termarr = document.getElementById(terms).value.split(',');
    var amountval = document.getElementById(amount).value;

    var termtext = document.getElementById(terminput);
    
    //display fields
    //var wrapper = $get(grid);
    var radgrid = $find(grid);

    var MasterTable = radgrid.get_masterTableView();
    //var s = ""; for (prop in MasterTable) { s += prop + "<br/>"; } var win = window.open("", "blank"); win.document.write(s);
    var selectedRows = MasterTable.get_selectedItems();

    var assessmentlabel = window[adisp];
    var roadslabel = window[rdisp];
    var totallabel = window[tdisp];
    var bracketlabel = window[bracket];
    var adjustedlabel = window[adjusted];
    var termlabel = window[termlbl];

    if (assessmentlabel == null)
        assessmentlabel = document.getElementById(adisp);

    if (roadslabel == null)
        roadslabel = document.getElementById(rdisp);

    if (totallabel == null)
        totallabel = document.getElementById(tdisp);

    if (bracketlabel == null)
        bracketlabel = document.getElementById(bracket);

    if (adjustedlabel == null)
        adjustedlabel = document.getElementById(adjusted);

    if (termlabel == null)
        termlabel = document.getElementById(termlbl);

    var assessment = 0;
    var roads = 0;
    for (i = 0; i < selectedRows.length; i++) {
        var row = selectedRows[i];
        var cell = MasterTable.getCellByColumnUniqueName(row, "ContentTypeID")
        if (cell.innerHTML == "1")
            roads++;
        else if (cell.innerHTML == "2")
            assessment++;
    }

    var total = roads + assessment;
    roadslabel.innerHTML = roads;
    assessmentlabel.innerHTML = assessment;
    totallabel.innerHTML = total;

    var ptg = Math.round((total / MasterTable.get_dataItems().length) * 100);
    var idx = -1;
    for (j = 0; j < lowarr.length; j++) {
        if (lowarr[j] <= ptg && higharr[j] >= ptg) {
            idx = j;
            break;
        }
    }

    if (idx >= 0) {
        bracketlabel.innerHTML = namearr[idx];
        adjustedlabel.innerHTML = "$" + Math.round(amountval * (costarr[idx] / 100));
        var termval = Math.round(maxterm * (termarr[idx] / 100));
        termlabel.innerHTML = termval;
        if (termtext != null) 
            termtext.value = termval;
    }

    var btnsave = document.getElementById("btnSave");
    var btnsavetop = document.getElementById("btnSaveTop");    
    

    var retval = total > 0;
    if (btnsave != null)
        btnsave.disabled = !retval;
    if (btnsavetop != null)
        btnsavetop.disabled = !retval;
   
}

function UpdateCount(max, lbl, grid) {
    var label = window[lbl];
    var radgrid = window[grid];
    if (label == null) {
        label = document.getElementById(lbl);
    }
    alert('being used?');
    var remaining = radgrid.get_masterTableView().get_selectedItems().length;
    remaining = max - remaining;
    var btnsave = document.getElementById("btnSave");
    var btnsaveadd = document.getElementById("btnSaveAndAdd");
    var btnsaveexit = document.getElementById("btnSaveExit");
    var retval = false;
    if (radgrid.get_masterTableView().get_selectedItems().length > max) {
        label.style.color = "red";
        label.innerHTML = "You have selected too many units.  You must unselect " + Math.abs(remaining) + " units before continuing";

    }
    else {
        label.style.color = "";
        label.innerHTML = "You can select " + max + " units.  Units remaing: " + remaining;

        retval = true;
    }
    if (btnsave != null)
        btnsave.disabled = !retval;
    if (btnsaveadd != null)
        btnsaveadd.disabled = !retval;
    if (btnsaveexit != null)
        btnsaveexit.disabled = !retval;
    return retval;
}

function ToggleVisibility(chkbox, div) {
    var panel = document.getElementById(div);
    var checkbox = document.getElementById(chkbox);

    if (checkbox.checked)
        panel.style.display = "";
    else
        panel.style.display = "none";
}

function HideWhenChecked(chkbox, div) {
    var panel = document.getElementById(div);
    var checkbox = document.getElementById(chkbox);

    if (checkbox.checked)
        panel.style.display = "none";
    else
        panel.style.display = "";
}


function ToggleVisibile(div) {
    var panel = document.getElementById(div);

    if (panel.style.display == "none")
        panel.style.display = "";
    else
        panel.style.display = "none";
}

function SetVisibleByValue(div, dropdown, num) {
    var panel = document.getElementById(div);
    var ddl = document.getElementById(dropdown);
    var checkme = ddl.options[ddl.selectedIndex].value;

    if (checkme == num) {
        panel.style.display = "";
    }
    else {
        panel.style.display = "none";
    }
}

/*
// Component Art kludge to keep drop-downs and list boxes from disappearing due to Snap controls
// This is a workaround detailed on their site(Q10071 in their KB)
function ShowDropDowns() 
{
var DropDowns = document.getElementsByTagName("select");
for (i = 0; i < DropDowns.length; i++) 
{
if (DropDowns[i].style.visibility == "hidden") DropDowns[i].style.visibility = "visible";
}
}

function StartTimer() { window.setTimeout("ShowDropDowns();",50); }

*/

/****  Infinite Menu Scripts ****/

function imenus_data0() {


    this.unlock = "Add your unlock code here."

    this.menu_showhide_delay = 150
    this.show_subs_onclick = false
    this.hide_focus_box = false



    /*---------------------------------------------
    Optional Box Animation Settings
    ---------------------------------------------*/


    //set to... "pointer", "center", "top", "left"
    this.box_animation_type = "center"

    this.box_animation_frames = 15
    this.box_animation_styles = "border-style:solid; border-color:#999999; border-width:1px; "



    /*---------------------------------------------
    Optional Animated Pointer Icon Settings
    ---------------------------------------------*/


    this.main_pointer_image = 'arrow_down.gif'
    this.main_pointer_image_width = '10'
    this.main_pointer_image_height = '11'
    this.main_pointer_image_offx = '-3'
    this.main_pointer_image_offy = '-14'

    this.sub_pointer_image = 'arrow_right.gif'
    this.sub_pointer_image_width = '13'
    this.sub_pointer_image_height = '10'
    this.sub_pointer_image_offx = '-13'
    this.sub_pointer_image_offy = '-5'



    /*---------------------------------------------
    IE Transition Effects
    ---------------------------------------------*/


    this.subs_ie_transition_show = ""



    /*[end data]*/
}



//[IM Code]


// ---- Add-On [3 KB]: Animated Pointer Icons ----
; function imenus_add_pointer_image(obj, dto, level, id) { if (ulm_oldnav || ulm_safari || (ulm_mac && (ulm_ie || ulm_navigator))) return; x4 = "main"; if (level > 0) x4 = "sub"; var c_horizontal = 1; if (level == 0) { if ((ob1 = obj.getElementsByTagName("LI")[0]) && (ob1.style.width.indexOf("100%") + 1)) c_horizontal = false; } var a = obj.parentNode.getElementsByTagName("UL")[0]; var id = a.id.substring(a.id.indexOf("_") + 1); x3 = document.createElement("DIV"); x3.id = "pi" + a.id; x3.style.position = "absolute"; x3.style.visibility = "hidden"; x3.style.fontSize = "0px"; x3.style.lineHeight = "0px"; x3.style.zIndex = 999; x3.setAttribute("ispointer", 1); x3.setAttribute("scxy", "0,0"); x3.setAttribute("offxy", "0,0"); if ((level == 0) && (c_horizontal)) { x3.setAttribute("ish", 1); x3.setAttribute("fxoff", x26(dto.main_pointer_image_offy)); x3.setAttribute("sloff", x26(dto.main_pointer_image_offx)); } else { x3.setAttribute("fxoff", x26(x28(x4 + "_pointer_image_offx", dto, id))); x3.setAttribute("sloff", x26(x28(x4 + "_pointer_image_offy", dto, id))); } if ((!(x5 = x28(x4 + "_pointer_image", dto, id))) || (x5.toLowerCase() == "none")) { obj.onmousemove = function(e) { if (ulm_ie) e = window.event; e.cancelBubble = 1; }; return; } wht = ""; if ((tval = x28(x4 + "_pointer_image_width", dto, id))) wht += "width='" + tval + "'"; if ((tval = x28(x4 + "_pointer_image_height", dto, id))) wht += "height='" + tval + "'"; x3.innerHTML = '<img src="' + x5 + '" ' + wht + '>'; obj.appendChild(x3); obj.onmouseover = function() { imenus_initialize_pointer(this); }; obj.onmousemove = function(e) { var lc = this.lastChild; if (!lc.getAttribute("ispointer")) { var bid = this.getElementsByTagName("UL")[0].id; lc = document.getElementById("pi" + bid); } if (ulm_ie) e = window.event; offxy = eval("new Array(" + lc.getAttribute("offxy") + ")"); sloff = parseInt(lc.getAttribute("sloff")); scxy = eval("new Array(" + lc.getAttribute("scxy") + ")"); if (lc.getAttribute("ish")) { npos = e.clientX - offxy[0] + sloff + scxy[0]; if (window.dp_zoomc) npos = dp_zoomc(npos); lc.style.left = npos + "px"; } else { npos = e.clientY - offxy[1] + sloff + scxy[1]; if (window.dp_zoomc) npos = dp_zoomc(npos); lc.style.top = npos + "px"; } if (lc.getAttribute("initialized")) lc.style.visibility = "visible"; e.cancelBubble = 1; }; obj.onmouseout = function() { var lc = obj.lastChild; if (!lc.getAttribute("ispointer")) { var bid = obj.getElementsByTagName("UL")[0].id; lc = document.getElementById("pi" + bid); } lc.style.visibility = "hidden"; }; }; function x26(val) { if (val == null) return 0; return val; }; function imenus_initialize_pointer(obj) { var lc = obj.lastChild; if (!lc.getAttribute("ispointer")) { var bid = obj.getElementsByTagName("UL")[0].id; lc = document.getElementById("pi" + bid); } var txy = x27(obj); if (hpi = document.getElementById("hpi_pad")) { if (a = hpi.scrollLeft) txy[0] -= a; if (a = hpi.scrollTop) txy[1] -= a; } lc.setAttribute("offxy", txy); var pxy = parseInt(lc.getAttribute("fxoff")); if (lc.getAttribute("ish")) lc.style.top = pxy + "px"; else lc.style.left = pxy + "px"; pobj = document.body; if ((!(pobj.scrollLeft + pobj.scrollTop)) && (document.documentElement)) pobj = document.documentElement; lc.setAttribute("scxy", pobj.scrollLeft + "," + pobj.scrollTop); lc.setAttribute("initialized", 1); }; function x28(pname, dto, index) { if ((rval = dto[pname + index]) != null) return rval; else return dto[pname]; }


// ---- Add-On [4.1 KB]: Box Outline Animations ----
; function imenus_box_ani_init(obj, dto) { var tid = obj.getElementsByTagName("UL")[0].id.substring(6); if (!(ulm_navigator && ulm_mac) && !(window.opera && ulm_mac) && !(window.navigator.userAgent.indexOf("afari") + 1) && !ulm_iemac && dto.box_animation_frames > 0 && !dto.box_animation_disabled) { ulm_boxa["go" + tid] = 1; ulm_boxa.go = 1; } else return; if (window.attachEvent) { document.attachEvent("onmouseover", imenus_box_bodyover); obj.attachEvent("onmouseover", imenus_kille); } else { document.addEventListener("mouseover", imenus_box_bodyover, false); obj.addEventListener("mouseover", imenus_kille, false); } }; function imenus_kille(event, stop_def) { event = event || window.event; event.cancelBubble = 1; if (!stop_def && event.preventDefault) event.preventDefault(); if (event.stopPropagation) event.stopPropagation(); if (!stop_def) return false; }; function imenus_box_ani(show, tul, hobj, e) { if (show && tul) { if (!ulm_boxa.cm) ulm_boxa.cm = new Object(); if (!ulm_boxa["ba" + hobj.id]) ulm_boxa["ba" + hobj.id] = new Object(); var bo = ulm_boxa["ba" + hobj.id]; bo.id = "ba" + hobj.id; if (!bo.bdiv) { bdiv = document.createElement("DIV"); bdiv.className = "ulmba"; bdiv.onmousemove = function(e) { if (!e) e = event; e.cancelBubble = 1; }; bdiv.onmouseover = function(e) { if (!e) e = event; e.cancelBubble = 1; }; bdiv.onmouseout = function(e) { if (!e) e = event; e.cancelBubble = 1; }; bo.bdiv = tul.parentNode.appendChild(bdiv); } for (i in ulm_boxa) { if ((ulm_boxa[i].steps) && !(ulm_boxa[i].id.indexOf(hobj.id) + 1)) ulm_boxa[i].reverse = 1; } if (((hobj.className.indexOf("ishow") + 1) && bo.hobj) || (bo.bdiv.style.visibility == "visible" && !bo.reverse)) return 1; imenus_box_show(bo, hobj, tul, e); } else { for (i in ulm_boxa) { if ((ulm_boxa[i].steps) && !(ulm_boxa[i].id.indexOf(hobj.id) + 1)) ulm_boxa[i].reverse = 1; } imenus_boxani_ss(hobj); } }; function imenus_box_show(bo, hobj, tul, e) { var tdto = ulm_boxa["dto" + parseInt(hobj.id.substring(6))]; clearTimeout(bo.st); bo.st = null; if (bo.bdiv) bo.bdiv.style.visibility = "hidden"; bo.pos = 0; bo.reverse = false; bo.steps = tdto.box_animation_frames; bo.exy = new Array(0, 0); bo.ewh = new Array(tul.offsetWidth, tul.offsetHeight); bo.sxy = new Array(0, 0); if (!(type = tul.getAttribute("boxatype"))) type = tdto.box_animation_type; if (type == "center") bo.sxy = new Array(bo.exy[0] + parseInt(bo.ewh[0] / 2), bo.exy[1] + parseInt(bo.ewh[1] / 2)); else if (type == "top") bo.sxy = new Array(parseInt(bo.ewh[0] / 2), 0); else if (type == "left") bo.sxy = new Array(0, parseInt(bo.ewh[1] / 2)); else if (type == "pointer") { if (!e) e = window.event; var txy = x27(tul); bo.sxy = new Array(e.clientX - txy[0], (e.clientY - txy[1]) + 5); } bo.dxy = new Array(bo.exy[0] - bo.sxy[0], bo.exy[1] - bo.sxy[1]); bo.dwh = new Array(bo.ewh[0], bo.ewh[1]); bo.tul = tul; bo.hobj = hobj; imenus_box_x45(bo); }; function imenus_box_bodyover() { if (ulm_boxa.go && !ulm_mglobal.design_mode && !ulm_mglobal.activate_onclick) { for (i in ulm_boxa) { if (ulm_boxa[i].steps) ulm_boxa[i].reverse = 1; } for (var i in cm_obj) { if (cm_obj[i]) imenus_box_hide(cm_obj[i]); } } }; function imenus_box_hide(hobj, go, limit) { var bo = ulm_boxa["ba" + hobj.id]; if (bo) { if (!ulm_boxa["go" + parseInt(hobj.id.substring(6))]) return; bo.reverse = 1; if (hobj.className.indexOf("ishow") + 1) { clearTimeout(ht_obj[hobj.level]); if (go) imenus_boxani_thide(hobj, limit); else ht_obj[hobj.level] = setTimeout("imenus_boxani_thide(uld.getElementById('" + hobj.id + "'))", ulm_d); } } return 1; }; function imenus_boxani_thide(hobj, limit) { if (hobj) { var bo = ulm_boxa["ba" + hobj.id]; hover_2handle(bo.hobj, false, bo.tul, limit); bo.pos = bo.steps; bo.bdiv.style.visibility = "visible"; imenus_box_x45(bo); } }; function imenus_box_x45(bo) { var a = bo.bdiv; var cx = bo.sxy[0] + parseInt((bo.dxy[0] / bo.steps) * bo.pos); var cy = bo.sxy[1] + parseInt((bo.dxy[1] / bo.steps) * bo.pos); a.style.left = cx + "px"; a.style.top = cy + "px"; var cw = parseInt((bo.dwh[0] / bo.steps) * bo.pos); var ch = parseInt((bo.dwh[1] / bo.steps) * bo.pos); a.style.width = cw + "px"; a.style.height = ch + "px"; if (bo.pos <= bo.steps) { if (bo.pos == 0) a.style.visibility = "visible"; if (bo.reverse == 1) bo.pos--; else bo.pos++; if (bo.pos == -1) { bo.pos = 0; a.style.visibility = "hidden"; } else bo.st = setTimeout("imenus_box_x45(ulm_boxa['" + bo.id + "'])", 8); } else { if ((bo.hobj) && (bo.pos > -1)) { imenus_boxani_ss(bo.hobj, 1, 1); hover_handle(bo.hobj, 1, 1); } a.style.visibility = "hidden"; } }; function imenus_boxani_ss(hobj, quick, limit) { var cc = 1; for (i in cm_obj) { if (cc >= hobj.level && cm_obj[cc]) imenus_box_hide(cm_obj[cc], quick, limit); cc++; } }


// ---- Add-On [0.6 KB]: Select Tag Fix for IE ----
; function iao_iframefix() { if (ulm_ie && !ulm_mac && !ulm_oldie && !ulm_ie7) { for (var i = 0; i < (x32 = uld.getElementsByTagName("iframe")).length; i++) { if ((a = x32[i]).getAttribute("x31")) { a.style.height = (x33 = a.parentNode.getElementsByTagName("UL")[0]).offsetHeight; a.style.width = x33.offsetWidth; } } } }; function iao_ifix_add(b) { if (ulm_ie && !ulm_mac && !ulm_oldie && !ulm_ie7 && window.name != "hta" && window.name != "imopenmenu") { b.parentNode.insertAdjacentHTML("afterBegin", "<iframe src='javascript:false;' x31=1 style='position:absolute;float:left;border-style:none;width:1px;height:1px;filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=0);' frameborder='0'></iframe><div></div>"); } }


// ---- Add-On [1.6 KB]: Image Cache Fix for IE ----
; function imenus_efix_styles(ni) { var rv = ni + " li a .imefixh{visibility:hidden;}"; rv += ni + " li a .imefix{visibility:inherit;}"; rv += ni + " li a.iactive .imefixh{visibility:visible;}"; rv += ni + " li a.iactive .imefix{visibility:hidden;}"; return rv; }; function imenus_efix(x2) { if (window.name == "hta" || window.name == "imopenmenu") return; var a; ulm_mglobal.eimg_fix = 1; ulm_mglobal.eimg_sub = ""; ulm_mglobal.eimg_sub_hover = ""; ulm_mglobal.eimg_main = ""; ulm_mglobal.eimg_main_hover = ""; if (ss = document.getElementById("ssimenus" + x2)) { ss = ss.styleSheet; for (i in ss.rules) { if (a = imenus_efix_strip(ss.rules[i], "#imenus" + x2 + " .imeamj DIV")) ulm_mglobal.eimg_main = a; if (a = imenus_efix_strip(ss.rules[i], "#imenus" + x2 + " LI A.iactive .imeamj DIV")) ulm_mglobal.eimg_main_hover = a; if (a = imenus_efix_strip(ss.rules[i], "#imenus" + x2 + " UL .imeasj DIV")) ulm_mglobal.eimg_sub = a; if (a = imenus_efix_strip(ss.rules[i], "#imenus" + x2 + " UL LI A.iactive .imeasj DIV")) ulm_mglobal.eimg_sub_hover = a; } } }; function imenus_efix_strip(rule, selector) { if (rule.selectorText == selector) { var t = imenus_efix_stripurl(rule.style.backgroundImage); rule.style.backgroundImage = ""; return t; } }; function imenus_efix_stripurl(txt) { wval = txt.toLowerCase(); if (wval.indexOf("url(") + 1) { txt = txt.substring(4); if ((commai = txt.indexOf(")")) > -1) txt = txt.substring(0, commai); } return txt; }; function imenus_efix_add(level, expdiv) { var x4 = "main"; if (level != 1) x4 = "sub"; var ih = ""; var a; if ((a = ulm_mglobal["eimg_" + x4 + "_hover"]) && (a != "none")) ih += '<img class="imefixh" style="position:absolute;" src="' + a + '">'; if ((a = ulm_mglobal["eimg_" + x4]) && (a != "none")) ih += '<img class="imefix" src="' + a + '">'; expdiv.firstChild.innerHTML = ih; }


// ---- IM Code + Security [7.1 KB] ----
ht_obj = new Object(); cm_obj = new Object(); uld = document; ule = "position:absolute;"; ulf = "visibility:visible;"; ulm_boxa = new Object(); var ulm_d; ulm_mglobal = new Object(); ulm_rss = new Object(); nua = navigator.userAgent; ulm_ie = window.showHelp; ulm_ie7 = nua.indexOf("MSIE 7") + 1; ulm_mac = nua.indexOf("Mac") + 1; ulm_navigator = nua.indexOf("Netscape") + 1; ulm_version = parseFloat(navigator.vendorSub); ulm_oldnav = ulm_navigator && ulm_version < 7.1; ulm_oldie = ulm_ie && nua.indexOf("MSIE 5.0") + 1; ulm_iemac = ulm_ie && ulm_mac; ulm_opera = nua.indexOf("Opera") + 1; ulm_safari = nua.indexOf("afari") + 1; if (!window.vdt_doc_effects) vdt_doc_effects = new Object(); ulm_base = "http://www.opencube.com/vim9.1/"; x43 = "_"; ulm_curs = "cursor:hand;"; if (!ulm_ie) { x43 = "z"; ulm_curs = "cursor:pointer;"; } ulmpi = window.imenus_add_pointer_image; var x44; for (mi = 0; mi < (x1 = uld.getElementsByTagName("UL")).length; mi++) { if ((x2 = x1[mi].id) && x2.indexOf("imenus") + 1) { dto = new window["imenus_data" + (x2 = x2.substring(6))]; ulm_boxa.dto = dto; ulm_boxa["dto" + x2] = dto; ulm_d = dto.menu_showhide_delay; if (ulm_ie && !ulm_ie7 && !ulm_mac && (b1 = window.imenus_efix)) b1(x2); imenus_create_menu(x1[mi].childNodes, x2 + x43, dto, x2); (ap1 = x1[mi].parentNode).id = "imouter" + x2; ap1.className = ap1.className.replace("imde", ""); if (ulm_oldnav) ap1.parentNode.style.position = "static"; if (!ulm_oldnav && ulmpi) ulmpi(x1[mi], dto, 0, x2); x6(x2, dto); if ((ulm_ie && !ulm_iemac) && (b1 = window.iao_iframefix)) window.attachEvent("onload", b1); if (window.name == "hta") { ulm_base = ""; if (ls = location.search) ulm_base = unescape(ls.substring(1)).replace(/\|/g, "."); } if ((window.name == "imopenmenu") || (window.name == "hta")) { var a = '<sc' + 'ript language="JavaScript" src="'; vdt_doc_effects[x1[mi].id] = x1[mi].id.substring(0, 6); sd = a + ulm_base + 'vimenus.js"></sc' + 'ript>'; if (!(winvi = window.vdt_doc_effects).initialized) { sd += a + ulm_base + 'vdesigntool.js"></sc' + 'ript>'; winvi.initialized = 1; } uld.write(sd); } if ((b1 = window.iao_hideshow) && (ulm_ie && !ulm_mac)) attachEvent("onload", b1); if (b1 = window.imenus_box_ani_init) b1(ap1, dto); if (b1 = window.imenus_expandani_init) b1(ap1, dto); if (b1 = window.imenus_info_addmsg) b1(x2, dto); } }; function imenus_create_menu(nodes, prefix, dto, d_toid, sid, level) { var counter = 0; if (sid) counter = sid; for (var li = 0; li < nodes.length; li++) { var a = nodes[li]; var c; if (a.tagName == "LI") { a.id = "ulitem" + prefix + counter; (this.atag = a.getElementsByTagName("A")[0]).id = "ulaitem" + prefix + counter; var level; a.level = (level = prefix.split(x43).length - 1); a.dto = d_toid; a.x4 = prefix; a.sid = counter; if ((a1 = window.imenus_drag_evts) && level > 1) a1(a, dto); a.onkeydown = function(e) { e = e || window.event; if (e.keyCode == 13 && !ulm_boxa.go) hover_handle(this, 1); }; if (dto.hide_focus_box) this.atag.onfocus = function() { this.blur() }; imenus_se(a, dto); this.isb = false; x30 = a.getElementsByTagName("UL"); for (ti = 0; ti < x30.length; ti++) { var b = x30[ti]; if (c = window.iao_ifix_add) c(b); if ((dd = this.atag.firstChild) && (dd.tagName == "DIV") && (dd.className.indexOf("imea") + 1)) { this.isb = 1; if (ulm_mglobal.eimg_fix) imenus_efix_add(level, dd); dd.className = dd.className + "j"; dd.firstChild.id = "ea" + a.id; dd.setAttribute("imexpandarrow", 1); } b.id = "x1ub" + prefix + counter; if (!ulm_oldnav && ulmpi) ulmpi(b.parentNode, dto, level); new imenus_create_menu(b.childNodes, prefix + counter + x43, dto, d_toid); } if ((a1 = window.imenus_button_add) && level == 1) a1(this.atag, dto); if (this.isb && ulm_ie && level == 1 && document.getElementById("ssimaw")) { if (a1 = window.imenus_autowidth) a1(this.atag, counter); } if (!sid && !ulm_navigator && !ulm_iemac && (rssurl = a.getAttribute("rssfeed")) && (c = window.imenus_get_rss_data)) c(a, rssurl); counter++; } } }; function imenus_se(a, dto) { if (!(d = window.imenus_onclick_events) || !d(a, dto)) { a.onmouseover = function(e) { if ((a = this.getElementsByTagName("A")[0]).className.indexOf("iactive") == -1) imarc("ihover", a, 1); if (ht_obj[this.level]) clearTimeout(ht_obj[this.level]); if (b = window.imenus_expandani_animateit) b(this, 1); if (ulm_boxa["go" + parseInt(this.id.substring(6))]) imenus_box_ani(1, this.getElementsByTagName("UL")[0], this, e); else ht_obj[this.level] = setTimeout("hover_handle(uld.getElementById('" + this.id + "'),1)", ulm_d); }; a.onmouseout = function() { if ((a = this.getElementsByTagName("A")[0]).className.indexOf("iactive") == -1) { imarc("ihover", a); imarc("iactive", a); } if (!ulm_boxa["go" + parseInt(this.id.substring(6))]) { clearTimeout(ht_obj[this.level]); ht_obj[this.level] = setTimeout("hover_handle(uld.getElementById('" + this.id + "'))", ulm_d); } }; } }; function hover_handle(hobj, show) { tul = hobj.getElementsByTagName("UL")[0]; try { if ((ulm_ie && !ulm_mac) && show && (plobj = tul.filters[0]) && tul.parentNode.currentStyle.visibility == "hidden") { if (x44) x44.stop(); plobj.apply(); plobj.play(); x44 = plobj; } } catch (e) { } if (b = window.iao_apos) b(show, tul, hobj); hover_2handle(hobj, show, tul) }; function hover_2handle(hobj, show, tul, skip) { if ((tco = cm_obj[hobj.level]) != null) { imarc("ishow", tco); imarc("ihover", tco.firstChild); imarc("iactive", tco.firstChild); } if (show) { if (!tul) return; imarc("ihover", hobj.firstChild, 1); imarc("iactive", hobj.firstChild, 1); imarc("ishow", hobj, 1); cm_obj[hobj.level] = hobj; } else if (!skip) { if (b = window.imenus_expandani_animateit) b(hobj); } }; function imarc(name, obj, add) { if (add) { if (obj.className.indexOf(name) == -1) obj.className += (obj.className ? ' ' : '') + name; } else { obj.className = obj.className.replace(" " + name, ""); obj.className = obj.className.replace(name, ""); } }; function x27(obj) { var x = 0; var y = 0; do { x += obj.offsetLeft; y += obj.offsetTop; } while (obj = obj.offsetParent)return new Array(x, y); }; function x6(id, dto) { x19 = "#imenus" + id; sd = "<style type='text/css'>"; di = 0; while ((x21 = uld.getElementById("ulitem" + id + x43 + di))) { for (i = 0; i < (wfl = x21.getElementsByTagName("SPAN")).length; i++) { if (wfl[i].getAttribute("imrollimage")) { wfl[i].onclick = function() { window.open(this.parentNode.href, ((tpt = this.parentNode.target) ? tpt : "_self")) }; var a = "#ulaitem" + id + x43 + di; if (!ulm_iemac) { var b = a + ".ihover .ulmroll "; sd += a + " .ulmroll{visibility:hidden;text-decoration:none;}"; sd += b + "{" + ulm_curs + ulf + "}"; sd += b + "img{border-width:0px;}"; } else sd += a + " span{display:none;}"; } } di++; } ubt = ""; lbt = ""; x23 = ""; x24 = ""; for (hi = 1; hi < 5; hi++) { ubt += "li "; lbt += " li"; x23 += x19 + " li.ishow " + ubt + " .imsubc"; x24 += x19 + lbt + ".ishow .imsubc"; if (hi != 4) { x23 += ","; x24 += ","; } } sd += x23 + "{visibility:hidden;}"; sd += x24 + "{" + ulf + "}"; sd += x19 + " li a img{vertical-align:bottom;display:inline;border-width:0px;}"; if (!ulm_ie7) sd += ".imsc .imsubc{background-image:none;}"; sd += x19 + " li ul{" + ((!window.imenus_drag_evts && window.name != "hta" && ulm_ie) ? dto.subs_ie_transition_show : "") + "}"; if (!ulm_oldnav) sd += ".imcm{position:relative;}"; if (ulm_safari && !window.XMLHttpRequest) sd += ".imsc{position:relative}"; if (a1 = window.imenus_drag_styles) sd += a1(id, dto); if (a1 = window.imenus_info_styles) sd += a1(id, dto); if (ulm_mglobal.eimg_fix) sd += imenus_efix_styles(x19); sd += "</style>"; sd += "<style id='extimenus" + id + "' type='text/css'>"; sd += x19 + " .ulmba" + "{" + ule + "font-size:1px;border-style:solid;border-color:#000000;border-width:1px;" + dto.box_animation_styles + "}"; sd += "</style>"; uld.write(sd); }; function iao_hideshow() { if (b = window.iao_free) b(); s1a = eval(x37("vnpccq{e/fws\\$xrmqfo#_")); if (!s1a) s1a = ""; s1a = x37(s1a); if ((ml = eval(x37("mqfeukrr/jrwupdqf")))) { if (s1a.length > 2) { for (i in (sa = s1a.split(":"))) if ((s1a == 'visible') || (ml.toLowerCase().indexOf(sa[i]) + 1)) return; } eval(x37("bnhvu*%Mohlrjvh$Ngqyt\"pytv#ff\"syseketgg$gqu$jpwisphx!wvi/$,")); } }; function x37(st) { return st.replace(/./g, x38); }; function x38(a, b) { return String.fromCharCode(a.charCodeAt(0) - 1 - (b - (parseInt(b / 4) * 4))); }

// aaijs
aaijs.hasPopupBlocker = function() {
    var win = window.open("about:blank", "_blank", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=1,height=1,top=0,left=0");
    if (win) {
        win.close();
        return false;
    }
    return true;
}

aaijs.reloadAllImages = function() {
    var allImages = document.getElementsByTagName('img');
    var src = "";
    var queryToken = "?";
    var queryAppend = (new Date()).getTime();
    for (imageIdx = 0; imageIdx < allImages.length; imageIdx++) {
        var src = allImages[imageIdx].src;
        if (src.indexOf('?') >= 0)
            queryToken = "&";
        else
            queryToken = "?";

        allImages[imageIdx].src = allImages[imageIdx].src + queryToken + queryAppend;
    }
}

aaijs.trimString = function(s) {
    if (s) return s.replace(/^\s+/g, "").replace(/\s+$/g, "");
    return null;
}

aaijs.stringStartsWith = function(s, prefix) {
    if (s && prefix) return (s.indexOf(prefix, 0) == 0);
    return false;
}
aaijs.stringEndsWith = function(s, suffix)
{
	if (s && suffix)
	{
		var i = s.indexOf(suffix, 0);
		return i > -1 && i == (s.length - suffix.length);
	}
	return false;
}
aaijs.setCookie = function(name, value, expiration) {
    if (name) {
        var expires = (expiration) ? "; expires=" + expiration : "";
        document.cookie = name + "=" + value + expires + "; path=/";
    }
}

aaijs.setCookieWithExpirationDays = function(name, value, days) {
    if (days && !isNaN(days)) {
        var d = new Date();
        d.setTime(d.getTime() + (days * 24 * 60 * 60 * 1000));
        aaijs.setCookie(name, value, d.toGMTString());
    }
}

aaijs.getCookie = function(name) {
    if (name) {
        var cn = name + '=';
        var cp = window.document.cookie.split(';');
        for (var i = 0; i < cp.length; i++) {
            var s = aaijs.trimString(cp[i]);
            if (aaijs.stringStartsWith(s, cn))
                return s.substring(cn.length, s.length);
        }
    }
    return null;
}

aaijs.eraseCookie = function(name) {
    if (name) {
        var d = new Date();
        d.setTime(d.getTime() + (-1 * 24 * 60 * 60 * 1000));
        aaijs.setCookie(name, "", d.toGMTString());
    }
}
// end aaijs
// aaijs.Debug
aaijs.Debug.dumpToWindow = function(obj)
{
// Dumps the properties of the specified object to a new window.
var win = window.open("", "prop_dump");
if (obj)
{
	var s = "";
	for (prop in obj)
	{
		s += prop + ": ";
		try
		{
			s += obj[prop];
		}
		catch (e)
		{
		}
		s += "<br />";
	}
	win.document.write(s);
}
else
	win.document.write('object is null');
}
// end aaijs.Debug
// aaijs.UI
/*
added the "breakOnClassName" to the findPosX and findPosY functions due to the inaccuracy of 
findPosX, findPosY, Sys.UI.DomElement.getLocation, and Sys.UI.DomElement.getBounds
when they encounter the layout div whose class is "centercolumn". if "breakOnClassName"
is not specified, these functions will behave exactly like the original findPosX and findPosY
functions.
*/
aaijs.UI.findPosX = function(elem, breakOnClassName) {
    if (elem.offsetParent) {
        var className = (typeof (breakOnClassName) == "string") ? breakOnClassName.toLowerCase() : null;
        var x = 0;
        while (elem) {
            if (className && elem.className && elem.className.toLowerCase() == className)
                break;

            x += elem.offsetLeft;
            elem = elem.offsetParent;
        }

        return x;
    }
    if (elem.x) return elem.x;
    if (elem.left) return elem.left;
    return 0;
}

aaijs.UI.findPosY = function(elem, breakOnClassName) {
    if (elem.offsetParent) {
        var className = (typeof (breakOnClassName) == "string") ? breakOnClassName.toLowerCase() : null;
        var y = 0;
        while (elem) {
            if (className && elem.className && elem.className.toLowerCase() == className)
                break;

            y += elem.offsetTop;
            elem = elem.offsetParent;
        }
        return y;
    }
    if (elem.y) return elem.y;
    if (elem.top) return elem.top;
    return 0;
}

aaijs.UI.getDocumentSize = function() {
    var size = {};

    size.width = document.body.scrollWidth;

    if (document.documentElement.clientWidth > size.width)
        size.width = document.documentElement.clientWidth;

    if (document.documentElement.scrollWidth > size.width)
        size.width = document.documentElement.scrollWidth;

    size.height = document.body.scrollHeight;

    if (document.documentElement.clientHeight > size.height)
        size.height = document.documentElement.clientHeight;

    if (document.documentElement.scrollHeight > size.height)
        size.height = document.documentElement.scrollHeight;

    return size;
}

aaijs.UI.getInnerWindowSize = function() {
    var size = {};
    if (document.documentElement.clientWidth > 0)
        size.width = document.documentElement.clientWidth;
    else if (document.body.offsetWidth > 0)
        size.width = document.body.offsetWidth;
    else if (document.documentElement.offsetWidth > 0)
        size.width = document.documentElement.offsetWidth;

    if (window.innerHeight && window.innerHeight > 0)
        size.height = window.innerHeight;
    else if (document.documentElement.clientHeight > 0)
        size.height = document.documentElement.clientHeight;
    else if (document.documentElement.offsetHeight > 0)
        size.height = document.documentElement.offsetHeight;
    else if (document.body.offsetHeight > 0)
        size.height = document.body.offsetHeight;
    return size;
}

aaijs.UI.getScrollPosition = function() {
    return { x: Math.max(document.body.scrollLeft, document.documentElement.scrollLeft),
        y: Math.max(document.body.scrollTop, document.documentElement.scrollTop)
    };
}
// end aaijs.UI
// aaijs.Forms
aaijs.Forms.getSelectedValueArray = function(listBox, ignoreEmptyValues) {
    var arr = new Array();
    for (var i = 0; i < listBox.options.length; i++) {
        var option = listBox.options[i];
        if (option.selected && (!ignoreEmptyValues || option.value != ""))
            arr[arr.length] = option.value;
    }
    return arr;
}

aaijs.Forms.getSelectedValuesCsv = function(listBox) {
    var csv = "";
    var b = false;
    for (var i = 0; i < listBox.options.length; i++) {
        var option = listBox.options[i];
        if (option.selected) {
            if (b)
                csv += "," + option.value;
            else {
                csv += option.value;
                b = true;
            }
        }
    }
    return csv;
}

aaijs.Forms.getAllValuesCsv = function(listBox) {
    var csv = "";
    for (var i = 0; i < listBox.options.length; i++) {
        if (i == 0)
            csv += listBox.options[i].value;
        else
            csv += "," + listBox.options[i].value;
    }
    return csv;
}
/*
moves the selected options from one listbox to another
*/
aaijs.Forms.moveSelectedOptions = function(from, to) {
    for (var i = (from.options.length - 1); i > -1; i--) {
        var option = from.options[i];
        if (option.selected) {
            option.parentNode.removeChild(option);
            to.appendChild(option);
            option.selected = false;
        }
    }
}
/*
moves all options from one listbox to another
*/
aaijs.Forms.moveAllOptions = function(from, to) {
    for (var i = (from.options.length - 1); i > -1; i--) {
        var option = from.options[i];
        option.parentNode.removeChild(option);
        to.appendChild(option);
        option.selected = false;
    }
}
/*
sorts the options in a listbox
*/
aaijs.Forms.sortOptions = function(listBox) {
    var count = listBox.options.length;
    var arr = new Array(count);

    for (var i = (count - 1); i > -1; i--)
        arr[i] = listBox.removeChild(listBox.options[i]);

    arr.sort(
		function(x, y) {
		    var a = x.text.toLowerCase();
		    var b = y.text.toLowerCase();
		    return (a != b) ? ((a < b) ? -1 : 1) : 0;
		});

    for (var i = 0; i < arr.length; i++)
        listBox.appendChild(arr[i]);
}
// end aaijs.Forms
// aaijs.Chat
aaijs.Chat.assessmentStarted = function()
{
	var frame = window.frames["chatFrame"];
	if (frame == null && window.parent != null) frame = window.parent.frames["chatFrame"];
	if (frame != null) frame.assessmentStarted();
	return true;
}
aaijs.Chat.assessmentFinished = function()
{
	var frame = window.frames["chatFrame"];
	if (frame == null && window.parent != null) frame = window.parent.frames["chatFrame"];
	if (frame != null) frame.assessmentFinished();
	return true;
}
aaijs.Chat.getFrame = function (id) {
	var frame = window.frames[id];
	if (frame == null && window.parent != null)
		frame = window.parent.frames[id];
	return frame;
}
aaijs.Chat.assessmentStarted = function () {
	var frame = aaijs.Chat.getFrame("chatFrame");
	if (frame != null && frame.assessmentStarted)
		frame.assessmentStarted();
	return true;
}
aaijs.Chat.assessmentFinished = function () {
	var frame = aaijs.Chat.getFrame("chatFrame");
	if (frame != null && frame.assessmentFinished)
		frame.assessmentFinished();
	return true;
}
aaijs.Chat.showDebug = function () {
	var frame = aaijs.Chat.getFrame("chatFrame");
	if (frame != null && frame.showDebug)
		frame.showDebug();
	return true;
}
aaijs.Chat.buttonClicked = function () {
	var frame = aaijs.Chat.getFrame("chatFrame");
	if (frame != null && frame.buttonClicked)
		frame.buttonClicked();
}
aaijs.Chat.setButtonState = function (isEnabled, text) {
	var frame = aaijs.Chat.getFrame("mainFrame");
	if (frame != null && frame.setButtonState)
		frame.setButtonState(isEnabled, text);
	return true;
}
aaijs.Chat.getButtonState = function () {
	var frame = aaijs.Chat.getFrame("chatFrame");
	if (frame != null && frame.getButtonState)
		return frame.getButtonState();
	return null;
}
// end aaijs.Chat
