// Other Default / Nifty Functions
function checkedAll(frm,checked){var aa = document.getElementById(frm);for(var i =0; i < aa.elements.length;i++){if (aa.elements[i].disabled != true){aa.elements[i].checked = checked;}}}
function getStyle(oElm, strCssRule){var strValue = "";if(document.defaultView && document.defaultView.getComputedStyle){strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);}else if(oElm.currentStyle){strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){return p1.toUpperCase();});strValue = oElm.currentStyle[strCssRule];}return strValue;}
function disp(div){GetElm(div).style.display="block";}
function hide(div){GetElm(div).style.display="none";}
function dispHide(ElementID){if(!GetElm(ElementID)){return;}else{if(GetElm(ElementID).style.display == "none"){disp(ElementID);GetElm('btnDispHide' + ElementID).innerHTML = "-";}else if(GetElm(ElementID).style.display == "block"){hide(ElementID);GetElm('btnDispHide' + ElementID).innerHTML = "+";}}}
function confirmAct(){var conf = confirm("Are you sure you want to take this action?");if(true == conf){return true;}else if(false == conf){return false;}}
function confirmDel(){var conf = confirm("Are you sure you want to delete the selected items?");if(true == conf){return true;}else if(false == conf){return false;}}
function fixForURL(val){return escape(encodeURI(val));}
function GetElm(fld){return document.getElementById(fld);}
function GetElmVal(fld){if(GetElm(fld)){return GetElm(fld).value;}}
function Trim(s) {while ((s.substring(0,1) == ' ') || (s.substring(0,1) == '\n') || (s.substring(0,1) == '\r')){ s = s.substring(1,s.length); }while ((s.substring(s.length-1,s.length) == ' ') || (s.substring(s.length-1,s.length) == '\n') || (s.substring(s.length-1,s.length) == '\r')){ s = s.substring(0,s.length-1); }return s;}
function Left(str, n){if (n <= 0){return "";} else if (n > String(str).length){return str;} else {return String(str).substring(0,n);}}
function Right(str, n){if (n <= 0){return "";} else if (n > String(str).length){return str;} else {var iLen = String(str).length;return String(str).substring(iLen, iLen - n);}}
function PopWindow(url,name,h,w,left,top) {var optiontxt;optiontxt = "height=" + h + ",width=" + w + ",left=" + left + ",top=" + top + ",status=0,location=0,scrollbars=1,toolbar=0,resizable=1";var w = window.open(url,name,optiontxt);w.focus();return false;}
function scrollToMark(mrk){$('html, body').animate({scrollTop: $("#" + mrk).offset().top}, 2000);}
function FollowMouse(ElmID){document.onmousemove = MoveElm;function MoveElm(){if(GetElm(ElmID)){if (!posx){mX = 10;} else {mX = posx + 5;}if (!posy){mY = 10;} else {mY = posy + 5;}GetElm(ElmID).style.left = mX + "px";GetElm(ElmID).style.top = mY + "px";}}}
function DoCheckedBox(id,tf){if(tf){if (tf=="t"){GetElm(id).checked = true;}if(tf=="f"){GetElm(id).checked = false;}} else {if(GetElm(id).checked == false){GetElm(id).checked = true;}else if(GetElm(id).checked == true){GetElm(id).checked = false;}}}
function doHighlight(Container, searchTerm, highlightStartTag, highlightEndTag){bodyText = GetElm(Container).innerHTML;if ((!highlightStartTag) || (!highlightEndTag)) {highlightStartTag = "<span style='color: blue; background-color: yellow;'>";highlightEndTag = "</span>";}var newText = "";var i = -1;var lcSearchTerm = searchTerm.toLowerCase();var lcBodyText = bodyText.toLowerCase();while (bodyText.length > 0) {i = lcBodyText.indexOf(lcSearchTerm, i+1);if (i < 0) {newText += bodyText;bodyText = "";} else {if (bodyText.lastIndexOf(">", i) >= bodyText.lastIndexOf("<", i)) {if (lcBodyText.lastIndexOf("/script>", i) >= lcBodyText.lastIndexOf("<script", i)) {newText += bodyText.substring(0, i) + highlightStartTag + bodyText.substr(i, searchTerm.length) + highlightEndTag;bodyText = bodyText.substr(i + searchTerm.length);lcBodyText = bodyText.toLowerCase();i = -1;}}}}GetElm(Container).innerHTML = newText;}
