﻿OLDSelectedRow = 0;
OLDSelectedRowbgcolor = 0;
OLDSelectedRowDonus = 0;
OLDSelectedRowbgcolorDonus = 0;
function selectitem(obj, ID, HdnID) {
    if (OLDSelectedRow != 0) {//mOut(OLDSelectedRow,OLDSelectedRowbgcolor);
        OLDSelectedRow.style.backgroundColor = OLDSelectedRowbgcolor;

    }
    OLDSelectedRowbgcolor = obj.style.backgroundColor;
    obj.style.backgroundColor = '#999999';
    document.getElementById(eval(HdnID)).value = ID;
    OLDSelectedRow = obj;
}

function DoEmpty(HdnID) {
    document.getElementById(eval(HdnID)).value = '';
}


function checkselect(HdnID) {
    if (document.getElementById(eval(HdnID)).value == '') {
        return false;
    }

    return true;

}
function positionit() {

    //define universal reference to "staticcontent"
    var crossobj = document.all ? document.all.staticcontent : document.getElementById("staticcontent");
    var leftindent = document.getElementById("primaryContent").offsetWidth;
    var floatingdivwidth = crossobj.offsetWidth;
    var A = (window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0);

    var browser = navigator.appName;
    var browserversion = new String(navigator.appVersion);

    var deltaX = (document.body.offsetWidth - document.getElementById("contentPage").offsetWidth) / 2;
    if (document.getElementById("steps") != null) {
        var deltaY = document.getElementById("header").offsetHeight + document.getElementById("steps").offsetHeight
    } else {

        var deltaY = document.getElementById("header").offsetHeight
    }

    var bottomMax = document.getElementById("footer").offsetTop - crossobj.offsetHeight;
    //alert(document.body.offsetWidth);
    var left = 0;
    //if is normal window larger than the web page
    if (document.body.offsetWidth - leftindent > 0) {
        left = leftindent + deltaX - floatingdivwidth + "px";
        if (browserversion.indexOf("MSIE 6") > -1) {
            //calculate relative to aspnetForm
            left = (document.getElementById("aspnetForm").offsetWidth - document.getElementById("container").offsetWidth) / 2 + leftindent - floatingdivwidth + "px";
        }

    }
    else {
        //if the client window is smaller that webpage ....horizontal scrool are shown
        left = document.getElementById("contentPage").offsetWidth - floatingdivwidth + "px";
        //special calculation if IE6
        if (browserversion.indexOf("MSIE 6") > -1) {
            left = document.getElementById("contentPage").offsetWidth + "px";
        }

    }

    //if the user is using IE 4+ or Firefox/ NS6+
    if ((document.all || document.getElementById)) {
        crossobj.style.left = left;
        if (A > deltaY && A < bottomMax) {
            crossobj.style.top = A + "px";
        }
        if (A > bottomMax) {
            crossobj.style.top = bottomMax + "px";
        }
    }
}
