// Arrow keys functions

function eegetdropdownvalue(B) { if (B[0].type == "radio") { return getvalue_radiobuttons(B, "number") } else { return B.selectedIndex >= 0 && B[B.selectedIndex] ? B[B.selectedIndex].value : 0 } } function getvalue_radiobuttons(F, G) { var H, I; var J = false; for (H = 0; H < F.length; H++) { if (F[H].checked == true) { J = true; I = H; break } } if (J == true) { return F[I].value } else { if (G == "text") { return "" } else { return 0 } } } function eegetdropdownvalue_str(B) { if (B[0].type == "radio") { return getvalue_radiobuttons(B, "text") } else { return B.selectedIndex >= 0 && B[B.selectedIndex] ? B[B.selectedIndex].value : "" } } function myIsNaN(B) { return (isNaN(B) || (typeof B == "number" && !isFinite(B))) } function upper(B) { return B.toUpperCase() } function round(G, H) { if (isFinite(G) && isFinite(H)) { var F = (G < 0) ? -1 : 1; var I = Math.abs(G); var J = Math.pow(10, H); return F * Math.round(I * J) / J } else { return NaN } } function s2n(D) { D = String(D).replace(eedecreg, "."); D = D.replace(eethreg, ""); D = D.replace(eecurrencyreg, ""); var C = parseFloat(D); if (myIsNaN(C)) { C = 0 } if (D.search(eepercentreg) >= 0) { C = C / 100 } return C } function v2n(B) { switch (typeof B) { case "number": return B; case "string": return s2n(B); case "boolean": return B ? 1 : 0; case "object": if (B.constructor == Number) { return B } if (B.constructor == String) { return s2n(B) } if (B.constructor == Boolean) { return B ? 1 : 0 } return Number.NaN; default: return Number.NaN } } var near0RegExp = new RegExp("[.](.*0000000|.*9999999)"); function eedisplayFloat(C) { if (myIsNaN(C)) { return Number.NaN } else { var D = String(C); if (near0RegExp.test(D)) { C = round(C, 8); D = String(C) } return D.replace(/\./g, eedec) } } var eeparseFloatVreg = new RegExp("^ *-?[0-9.]+ *$"); function eeparseFloatV(D) { if (D == "") { return D } D = String(D).replace(eedecreg, "."); if (!eeparseFloatVreg.test(D)) { return D } var C = parseFloat(D); if (isNaN(C)) { return D } else { return C } }
function onEnterPress(D) {
    document.onkeydown = C; function C(I) {
        var L; if (window.event) { L = window.event.keyCode } else { if (I) { L = I.which } } switch (L) {
            case 13: case 40: var K = document.getElementById(D).getAttribute("downkey"); if (K != null) {
                    if (document.getElementById(K).getAttribute("readonly") == null) {
                        document.getElementById(K).select()
                    } 
                } break; case 37: var B = document.getElementById(D).getAttribute("leftkey"); if (B != null) { if (document.getElementById(B).getAttribute("readonly") == null) { document.getElementById(B).select() } } break; case 38: var J = document.getElementById(D).getAttribute("upkey"); if (J != null) { if (document.getElementById(J).getAttribute("readonly") == null) { document.getElementById(J).select() } } break; case 39: var A = document.getElementById(D).getAttribute("rightkey"); if (A != null) { if (document.getElementById(A).getAttribute("readonly") == null) { document.getElementById(A).select() } } break; default: void (0)
        } 
    } 
} function HandleCancel(B) { window.location.replace(B) }
function SetRatingStart(A, B, C, D) { num = parseInt(A); document.getElementById(C).value = A; ii = 1; while (ii <= B) { if (ii <= num) { document.getElementById(D + ii).className = "starActive" } else { document.getElementById(D + ii).className = "starComplete" } ii++ } };
//captcha_requiredcontrols_script

function getPageSize() {
    var xScroll, yScroll;
    if (window.innerHeight && window.scrollMaxY) {
        xScroll = document.body.scrollWidth;
        yScroll = window.innerHeight + window.scrollMaxY;
    } else if (document.body.scrollHeight > document.body.offsetHeight) { // all but Explorer Mac
        xScroll = document.body.scrollWidth;
        yScroll = document.body.scrollHeight;
    } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
        xScroll = document.body.offsetWidth;
        yScroll = document.body.offsetHeight;
    }

    var windowWidth, windowHeight;
    if (self.innerHeight) {	// all except Explorer
        windowWidth = self.innerWidth;
        windowHeight = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
        windowWidth = document.documentElement.clientWidth;
        windowHeight = document.documentElement.clientHeight;
    } else if (document.body) { // other Explorers
        windowWidth = document.body.clientWidth;
        windowHeight = document.body.clientHeight;
    }

    // for small pages with total height less then height of the viewport
    if (yScroll < windowHeight) {
        pageHeight = windowHeight;
    } else {
        pageHeight = yScroll;
    }
    // for small pages with total width less then width of the viewport
    if (xScroll < windowWidth) {
        pageWidth = windowWidth;
    } else {
        pageWidth = xScroll;
    }
    var yScroll;
    if (self.pageYOffset) {
        yScroll = self.pageYOffset;
    } else if (document.documentElement && document.documentElement.scrollTop) {	 // Explorer 6 Strict
        yScroll = document.documentElement.scrollTop;
    } else if (document.body) {// all other Explorers
        yScroll = document.body.scrollTop;
    }
    arrayPageSize = new Array(pageWidth, pageHeight, windowWidth, windowHeight, yScroll);
    return arrayPageSize;
}

//captcha_script

function checkcaptcha(B) {
    if (document.getElementById("txtcaptcha").value == document.getElementById("captchaid").innerHTML) {
        document.getElementById("xl_an").value=document.getElementById("txtcaptcha").value;
		document.formc.submit();
    }
    else {
        document.getElementById("errmsg").value = B;
        document.getElementById("light").style.display = "none";
        document.getElementById("fade").style.display = "none";
        check_submit();
    }
}

function GenerateCaptID() {
    randomNum = Math.floor((Math.random() * 8888) + 1000);
    document.getElementById("captchaid").innerHTML = randomNum;
	document.getElementById("xl_ex").value=randomNum;
}

function CancelCaptcha() {
    document.getElementById("light").style.display = "none";
    document.getElementById("fade").style.display = "none";
}

function CancelCaptchaalert() {
    document.getElementById("lightalert").style.display = "none";
    document.getElementById("fadealert").style.display = "none";
}

// scriptrequired

function checkrequired(reqlist, frompanel) {
    //var statusfunc = new Boolean(false);
    var statusfunc = false, ll, reqvalue, reqctrl, panelname, elementid, starid;
    for (ll = 0; ll < reqlist.length; ll++) {
        reqvalue = reqlist[ll].split('_');
        reqctrl = reqvalue[1];
        panelname = reqvalue[0];
        if (frompanel === "nopanel") // called from checksubmit() to check all the controls
        {
            elementid = document.getElementById(reqctrl);
            if (elementid != null) {
                //starid = reqctrl + "Required";
				starid = reqctrl;
                if (elementid.type === "text" || elementid.type === "textarea") {
                    if (strtrim(elementid.value) === "0" || strtrim(elementid.value) === "") {
                        statusfunc = true;
                        document.getElementById(starid).style.border = '2px inset red';
                        document.getElementById("panelidz").value = panelname.substring(5);
                        break;
                    }
                    else {
                        document.getElementById(starid).style.border = '';
                    }
                }

                else if (elementid.type === "select-one") {
                    if (elementid.selectedIndex === 0) {
                        statusfunc = true;
                        document.getElementById(starid).style.border = '2px inset red';
                        document.getElementById("panelidz").value = panelname.substring(5);
                        break;
                    }
                    else {
                        document.getElementById(starid).style.border = '';
                    }
                }
            }  // closing of if(frompanel==="nopanel")
            else {
                var staridradio, radioelem, innerstatusfunc, rad;
                //staridradio = reqctrl + "Required";
				staridradio = reqctrl;
                radioelem = document.getElementsByName(reqctrl);
                innerstatusfunc = false;
                for (rad = 0; rad < radioelem.length; rad++) {
                    if (radioelem[rad].checked) {
                        innerstatusfunc = true; break;
                    }
                }
                if (innerstatusfunc === false) {
                    statusfunc = true;
                    document.getElementById("panelidz").value = panelname.substring(5);
                    document.getElementById(staridradio).style.border = '2px inset red';
                }
                else {
                    document.getElementById(staridradio).style.border = '';
                }
            }
        }
        else // called from next or previous button to check only the controls inside the panel.
        {
            if (frompanel === panelname) {
                var elementid = document.getElementById(reqctrl);
                if (elementid != null) {
                    //var starid = reqctrl + "Required";
					var starid = reqctrl;
                    if (elementid.type === "text" || elementid.type === "textarea") {
                        if (strtrim(elementid.value) === "0" || strtrim(elementid.value) === "") {
                            statusfunc = true;
                            document.getElementById(starid).style.border = '2px inset red';
                            break;
                        }
                        else {
                            document.getElementById(starid).style.border = '';
                        }
                    }

                    else if (elementid.type === "select-one") {
                        if (elementid.selectedIndex === 0) {
                            statusfunc = true;
                            document.getElementById(starid).style.border = '2px inset red';
                            break;
                        }
                        else {
                            document.getElementById(starid).style.border = '';
                        }
                    }
                }
                else {
                    var staridradio, radioelem, innerstatusfunc, rad;
                    //staridradio = reqctrl + "Required";
					staridradio = reqctrl;
                    radioelem = document.getElementsByName(reqctrl);
                    innerstatusfunc = false;
                    for (rad = 0; rad < radioelem.length; rad++) {
                        if (radioelem[rad].checked) {
                            innerstatusfunc = true; break;
                        }
                    }
                    if (innerstatusfunc === false) {
                        statusfunc = true;
                        document.getElementById(staridradio).style.border = '2px inset red';
                    }
                    else {
                        document.getElementById(staridradio).style.border = '';
                    }
                }
            }
        }
    };
    return statusfunc;
}

function strtrim(val) {
    return val.replace(/^\s+/, '').replace(/\s+$/, '');
}

// for cookie

function CookieExpiryDate(B, A) {
    B.setMonth(B.getMonth() + A);
    return B;
}

function GetPageName() {
    var A = window.location.pathname;
    var B = A.substring(A.lastIndexOf("/") + 1);
    return B;
}


