//############### //# EVENTS //############### function evntobj(e) { this.src = e.target ? e.target : e.srcElement; this.x = e.pageX ? e.pageX : e.clientX; this.y = e.pageY ? e.pageY : e.clientY; this.e = e ? e : window.event; } evntobj.prototype.consume = function () { if (this.e.stopPropagation) { this.e.stopPropagation(); this.e.preventDefault(); } else if (this.e.cancelBubble) { this.e.cancelBubble = true; this.e.returnValue = false; } } evntobj.addEventListener = function(obj,evnt,func) { if (document.addEventListener) { obj.addEventListener(evnt,func,false); } else if (document.attachEvent) { obj.attachEvent("on"+evnt,func,false); } else { obj["on"+evnt] = func; } } evntobj.removeEventListener = function(obj,evnt,func) { if (document.removeEventListener) { obj.removeEventListener(evnt,func,false); } else if (document.detachEvent) { obj.detachEvent("on"+evnt,func,false); } else { obj["on"+evnt] = null; } } function maddEventListener(obj,evnt,func) { if (window.attachEvent) { obj.attachEvent("on" + evnt,func); } else if (window.addEventListener) { if (evnt = "load") {evnt == "DOMContentLoaded"} document.addEventListener(evnt,func,true); } else { obj["on" + evnt] = func; } } function removeEventListener(obj,evnt,func) { if (window.detachEvent) { obj.detachEvent("on" + evnt,func); } else if (window.removeEventListener) { obj.removeEventListener(evnt,func,false); } else { obj["on" + evnt] = ""; } } //############### //# FORMS //############### maddEventListener(window,"load",initforms); function initforms() { this.name = "home"; var input = document.getElementsByTagName("INPUT"); for (i=0;i=0;i--) { select.remove(i); } } function activate(e) { var e = e ? e : window.event; var obj = e.target ? e.target : e.srcElement; obj.onkeypress = autocomplete; selectobj = obj; } function deactivate(e) { var e = e ? e : window.event; var obj = e.target ? e.target : e.srcElement; obj.onkeypress = function donothing() {}; //selectobj.selectedIndex = selectindex; keystack = ""; selectobj = ""; } function autocomplete(e) { keystack = keystack + String.fromCharCode(window.event.keyCode).toLowerCase(); for (i=0;i < selectobj.options.length-1;i++) { var str = selectobj.options[i].text.toLowerCase(); if(str.indexOf(keystack) == 0) { selectobj.selectedIndex = i; selectindex = i; return(false); } } } //############### //# COOKIES //############### function getcookie(name) { var start = document.cookie.indexOf(name + "="); var end = document.cookie.indexOf(";", start + name.length + 1); if (end == -1) { end = document.cookie.length; } if ((!start && name != document.cookie.substring(0,name.length)) || start == -1) { return null; } else { return unescape(document.cookie.substring(start + name.length + 1, end)); } } //############### //# OBJECTS //############### function getoffsetx(obj) { if(obj.offsetParent != null) { return(obj.offsetLeft + getoffsetx(obj.offsetParent)); } else { return(0); } } function getoffsety(obj) { if(obj.offsetParent != null) { return(obj.offsetTop + getoffsety(obj.offsetParent)); } else { return(0); } } function moveobj(objid,top,left) { if (document.getElementById) { document.getElementById("" + objid + "").style.position = "absolute"; document.getElementById("" + objid + "").style.top = top; document.getElementById("" + objid + "").style.left = left; } } function setopacity(obj,val) { if (obj.filters) { try { obj.filters["alpha"].opacity = val*100; } catch (e) { } } else if (obj.style.opacity) { obj.style.opacity = val; } } //############### //# TABLES //############### var lastsort = null; function sorttable(col,tablename) { var tablearray = new Array(); var sortarray = new Array(); var tableobj = document.getElementById(tablename); var tablerows = parseInt(tableobj.rows.length); var tablecols = tableobj.getAttribute("cols"); for (i=1; i < tablerows; i++) { tablearray[i-1] = new Array(); for (c=0; c < tablecols; c++) { tablearray[i-1][c] = tableobj.rows[i].cells[c].innerHTML; } } sortarray = bubblesort(tablearray,col,lastsort!=col); for (i=0; i < sortarray.length; i++) { for (c=0; c < sortarray[i].length; c++) { tableobj.rows[i+1].cells[c].innerHTML = sortarray[i][c]; } } if(lastsort != col) { lastsort = col; } else { lastsort = null; } } function bubblesort(sortarray,col,sortorder) { for(n=0; n < sortarray.length; n++) { for(c=n; c < sortarray.length; c++) { var l = sortarray[n][col].toString().replace(/<[^>]+>/g,"").replace(/[^0-9\/a-z\/A-Z\/.]/g,""); var r = sortarray[c][col].toString().replace(/<[^>]+>/g,"").replace(/[^0-9\/a-z\/A-Z\/.]/g,""); var s = false; if (isdate(l) && isdate(r)) { if(sortorder && (Date.parse(l) - Date.parse(r) > 0)) { s = true; } if(!sortorder && (Date.parse(l) - Date.parse(r) < 0)) { s = true; } } else if (isnumeric(l) && isnumeric(r)) { if(sortorder && (parseFloat(l) - parseFloat(r) > 0)) { s = true; } if(!sortorder && (parseFloat(l) - parseFloat(r) < 0)) { s = true; } } else { if(sortorder && (l.toLowerCase() > r.toLowerCase())) { s = true; } if(!sortorder && (l.toLowerCase() < r.toLowerCase())) { s = true; } } if (s) { for (x=0; x < sortarray[n].length; x++) { var t = sortarray[n][x]; sortarray[n][x] = sortarray[c][x]; sortarray[c][x] = t; } } } } return(sortarray); } //############### //# CALENDAR //############### var browserName=navigator.appName; var selecteddate = new Date(); var currentdate = new Date(); var comparedate = new Date(); var maxdate = new Date(); var mindate = new Date(); var rolloverobj = null; var dateformname = "schedule"; var datefieldname = "datevalue"; var ondateselect = false; maddEventListener(window,"load",initcalendar); function initcalendar() { var calendar = document.createElement("div"); var calendarHTML = ""; calendar.id = "calendar"; calendar.style.position = "absolute"; calendar.style.zIndex = "10"; calendar.style.top= "0"; calendar.style.left = "0"; calendar.style.display = "none"; calendarHTML = calendarHTML + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + ""; for (w=0; w<6; w++) { calendarHTML = calendarHTML + "" for (d=0; d<7; d++) { calendarHTML = calendarHTML + ""; } calendarHTML = calendarHTML + "" } calendarHTML = calendarHTML + "
" + "

<

" + "
" + "

" + "
" + "

>

" + "
" + "

S

" + "
" + "

M

" + "
" + "

T

" + "
" + "

W

" + "
" + "

T

" + "
" + "

F

" + "
" + "

S

" + "
" calendar.innerHTML = calendarHTML; if(document.body ) { document.body.appendChild(calendar); updatecalendar(currentdate.getYear(),currentdate.getMonth()); } } function showcalendar(x,y,min,max,formname,fieldname) { var windowwidth = document.body.offsetWidth ? document.body.offsetWidth : window.innerWidth; dateformname = formname; datefieldname = fieldname; maxdate = new Date(max); mindate = new Date(min); selecteddate = new Date("1/1/1900"); updatecalendar(currentdate.getYear(),currentdate.getMonth()); document.getElementById("calendar").style.top = y; if ((x + 182) > windowwidth) { x = x - 159; } document.getElementById("calendar").style.left = x; document.getElementById("calendar").style.display = "block"; var select = document.getElementsByTagName("SELECT"); for (i=0;i parseInt(document.body.clientWidth)) { tt.style.left = parseInt(document.body.clientWidth - 10 - tt.clientWidth) + parseInt(document.body.scrollLeft) + "px"; } else { tt.style.left = parseInt(eo.x + 10) + parseInt(document.body.scrollLeft) + "px"; } if (parseInt(eo.y + tt.clientHeight + 15) > parseInt(document.body.clientHeight)) { tt.style.top = parseInt(eo.y - 15 - tt.clientHeight) + "px"; } else { tt.style.top = parseInt(eo.y + 15) + "px"; } tt.style.position = "absolute"; tt.style.display = "block"; //evntobj.addEventListener(document,"mousemove",move_tt); } } function hide_tt() { var tt = document.getElementById("tooltip"); if (tt) { tt.style.display = "none"; tt.style.width = "300px"; removeEventListener(document,"mousemove",move_tt); } } function move_tt(e) { var tt = document.getElementById("tooltip"); var eo = new evntobj(e); if (parseInt(eo.x + tt.clientWidth + 10) > parseInt(document.body.clientWidth)) { tt.style.left = parseInt(document.body.clientWidth - 10 - tt.clientWidth) + parseInt(document.body.scrollLeft) + "px"; } else { tt.style.left = parseInt(eo.x + 10) + parseInt(document.body.scrollLeft) + "px"; } if (parseInt(eo.y + tt.clientHeight + 15) > parseInt(document.body.clientHeight)) { tt.style.top = parseInt(eo.y - 15 - tt.clientHeight) + parseInt(document.body.scrollTop) + "px"; } else { tt.style.top = parseInt(eo.y + 15) + parseInt(document.body.scrollTop) + "px"; } eo.consume(); }