//GENERAL UTILITY FUNCTIONS AND VARIABLES //PAGE DIMENSION FUNCTIONS function PageDim(){ //Get the page width and height this.W = 600; this.H = 400; this.W = document.getElementsByTagName('body')[0].clientWidth; this.H = document.getElementsByTagName('body')[0].clientHeight; } var pg = null; function GetPageXY(El) { var XY = {x: 0, y: 0}; while(El){ XY.x += El.offsetLeft; XY.y += El.offsetTop; El = El.offsetParent; } return XY; } function GetScrollTop(){ if (typeof(window.pageYOffset) == 'number'){ return window.pageYOffset; } else{ if ((document.body)&&(document.body.scrollTop)){ return document.body.scrollTop; } else{ if ((document.documentElement)&&(document.documentElement.scrollTop)){ return document.documentElement.scrollTop; } else{ return 0; } } } } function GetViewportHeight(){ if (typeof window.innerHeight != 'undefined'){ return window.innerHeight; } else{ if (((typeof document.documentElement != 'undefined')&&(typeof document.documentElement.clientHeight != 'undefined'))&&(document.documentElement.clientHeight != 0)){ return document.documentElement.clientHeight; } else{ return document.getElementsByTagName('body')[0].clientHeight; } } } function TopSettingWithScrollOffset(TopPercent){ var T = Math.floor(GetViewportHeight() * (TopPercent/100)); return GetScrollTop() + T; } //CODE FOR AVOIDING LOSS OF DATA WHEN BACKSPACE KEY INVOKES history.back() var InTextBox = false; function SuppressBackspace(e){ if (InTextBox == true){return;} if (C.ie) { thisKey = window.event.keyCode; } else { thisKey = e.keyCode; } var Suppress = false; if (thisKey == 8) { Suppress = true; } if (Suppress == true){ if (C.ie){ window.event.returnValue = false; window.event.cancelBubble = true; } else{ e.preventDefault(); } } } if (C.ie){ document.attachEvent('onkeydown',SuppressBackspace); window.attachEvent('onkeydown',SuppressBackspace); } else{ if (window.addEventListener){ window.addEventListener('keypress',SuppressBackspace,false); } } function ReduceItems(InArray, ReduceToSize){ var ItemToDump=0; var j=0; while (InArray.length > ReduceToSize){ ItemToDump = Math.floor(InArray.length*Math.random()); InArray.splice(ItemToDump, 1); } } function Shuffle(InArray){ var Num; var Temp = new Array(); var Len = InArray.length; var j = Len; for (var i=0; i InArray[Longest].length){ Longest = i; } } return Longest; } //UNICODE CHARACTER FUNCTIONS function IsCombiningDiacritic(CharNum){ var Result = (((CharNum >= 0x0300)&&(CharNum <= 0x370))||((CharNum >= 0x20d0)&&(CharNum <= 0x20ff))); Result = Result || (((CharNum >= 0x3099)&&(CharNum <= 0x309a))||((CharNum >= 0xfe20)&&(CharNum <= 0xfe23))); return Result; } function IsCJK(CharNum){ return ((CharNum >= 0x3000)&&(CharNum < 0xd800)); } //SETUP FUNCTIONS //BROWSER WILL REFILL TEXT BOXES FROM CACHE IF NOT PREVENTED function ClearTextBoxes(){ var NList = document.getElementsByTagName('input'); for (var i=0; i -1)||(NList[i].id.indexOf('Gap') > -1)){ NList[i].value = ''; } if (NList[i].id.indexOf('Chk') > -1){ NList[i].checked = ''; } } } //EXTENSION TO ARRAY OBJECT function Array_IndexOf(Input){ var Result = -1; for (var i=0; i