﻿//function CheckJScript() {
//    if (window.location.contains("?")) {
//        window.location = window.location + "&jscript";
//    }
//    else {
//        window.location = window.location + "?jscript";
//    }
//}
var fadingEnabled = false;
function ClearText(ctrl, text) {
    if (ctrl.value == text) {
        ctrl.value = "";
    }
}
function SetDefaultText(ctrl, text) {
    if (ctrl.value == "") {
        ctrl.value = text;
    }
}
var t;
function CheckSearchValue(id, ss, len) {
    ClearTimeouts();
    if (document.getElementById(id).value.length >= len) {
        t = setTimeout("__doPostBack('" + id + "', '')", 1000);
    } else {
        ToggleDisplay(ss, "none");
    }
}

function ClearTimeouts() {
    clearTimeout(t);
}

function ToggleDisplay(id, val) {
    document.getElementById(id).style.display = val;
}

function FormFieldFocused(elem, row) {
    document.getElementById(row).className = document.getElementById(row).className + " formrowfocus";
}

function FormFieldBlurred(elem, row) {
    document.getElementById(row).className = document.getElementById(row).className.replace(" formrowfocus", "").replace("formrowfocus", "");
}

function SetMaxHeight(IDs) {
    //document.getElementById("TopRow_RightCol").innerHTML += IDs;
    var offset = 0;
    var splitStrings = IDs.split("|");
    for (i = 0; i < splitStrings.length; i++) {
        //document.getElementById("TopRow_RightCol").innerHTML += splitStrings[i];
        if (document.getElementById(splitStrings[i]).offsetHeight > offset) {
            offset = document.getElementById(splitStrings[i]).offsetHeight;
        }
    }
    for (i = 0; i < splitStrings.length; i++) {
        document.getElementById(splitStrings[i]).style.height = offset+"px";
    }
}

function SetExactHeight(elem1, elem2) {
    //document.write(document.getElementById(elem1).offsetHeight + "px");
    document.getElementById(elem2).style.height = document.getElementById(elem1).offsetHeight+"px";
}
var u;
function FadeIn(elem, delay, delaystep, startpos, fadestep, endpos) {
    if (fadingEnabled) {
        for (var i = startpos; i < endpos; i += fadestep) {
            u = setTimeout("Fade('" + elem + "', " + i + ");", delay);
            delay += delaystep;
            //document.getElementById("TopRow_RightCol").innerHTML += i + " " + starttime + "<br />";
        }
    }
}
var v;
function FadeOut(elem, delay, delaystep, startpos, fadestep, endpos) {
    if (fadingEnabled) {
        for (var i = startpos; i > endpos; i -= fadestep) {
            u = setTimeout("Fade('" + elem + "', " + i + ");", delay);
            delay += delaystep;
            //document.getElementById("TopRow_RightCol").innerHTML += i + " " + starttime + "<br />";
        }
    }
}

function Fade(elem, i) {
    document.getElementById(elem).className = document.getElementById(elem).className + " opacity" + i;
    document.getElementById(elem).className = document.getElementById(elem).className.replace(" opacity" + (i + 1), "").replace("opacity" + (i + 1), "");
    document.getElementById(elem).className = document.getElementById(elem).className.replace(" opacity" + (i - 1), "").replace("opacity" + (i - 1), "");
}
