/* AnimLyte ©2007 Dan Schellhas */ var isIE = navigator.userAgent.indexOf('MSIE') + 1; var isSafari = navigator.userAgent.indexOf('Apple') + 1; function pDefault(e) { if (e.preventDefault) e.preventDefault(); e.returnValue = false; } function getOffsetLeft(obj) { if (obj.parentNode != undefined) { return parseInt(getOffsetLeft(obj.parentNode)) + parseInt(obj.offsetLeft); } return 0; } function getOffsetTop(obj) { if (obj.parentNode != undefined) { return parseInt(getOffsetTop(obj.parentNode)) + parseInt(obj.offsetTop); } return 0; } var screenX, screenY, scrollX, scrollY; window.onscroll = getScreen; function getScreen() { if( typeof( window.innerWidth ) == 'number' ) { //Non-IE screenX = window.innerWidth; screenY = window.innerHeight; scrollX = window.pageXOffset; scrollY = window.pageYOffset; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' screenX = document.documentElement.clientWidth; screenY = document.documentElement.clientHeight; scrollX = document.documentElement.scrollLeft; scrollY = document.documentElement.scrollTop; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible screenX = document.body.clientWidth; screenY = document.body.clientHeight; scrollX = document.body.scrollLeft; scrollY = document.body.scrollTop; } } function ani(e, t, p1) { this.e = e; this.t = t; this.p1 = p1; } function dropStack(e, t, p1) { this.anim = new Array(); var a = new ani(e, t, p1); if (e) { this.anim.push(a); } } function pushAnim (e, index, t, p1) { var tempa = new ani(e, t, p1); for (var i = 0; i <= index; i++) { if (!a[index]) { a.push(new dropStack(null, null, null)); } } a[index].anim.push(tempa); } function dePX (s) { if (s.substr(s.length - 2) == 'px') { return parseInt(s.substr(0, s.length - 2)); } else { if (!s) { s = 0; } return parseInt(s); } } var ECONOMY = 1000 / 24; var AVERAGE = 40; var QUALITY = 20; var an = setInterval(Animate, ECONOMY); var idle = false; var noClick = false; var clicked = false; var a = new Array(); a.push(new dropStack(function () { idle = true; noClick = false; }, null, null)); //a.pushAnim(function () { alert("Huh?"); }, 5, "Me!", null); function deIdle() { idle = false; } function Animate() { var curAnims = a.shift(); if (curAnims != undefined) { for (var i = 0; i < curAnims.anim.length; i++) { //if (curAnims[i].t) { alert(curAnims[i].t.id); } curAnims.anim[i].e(curAnims.anim[i].t, curAnims.anim[i].p1); } } } function expandDown(elHeight, ppf, baseHeight) { if (!ppf) { ppf = elHeight - baseHeight } var dHeight = elHeight - baseHeight; var frames = Math.ceil(dHeight / ppf); var targets = new Array(); var temp = this; while (temp.nodeName == "DIV") { targets.push(temp); temp = temp.parentNode; } for (var i = 1; i <= frames; i++) { var p1 = baseHeight + dHeight - (dHeight * ((frames - i) / frames)); for (var j = 0; j < targets.length; j++) { curHeight = targets[j].offsetHeight; //if (!isIE) { curHeight += ((dePX(this.style.borderWidth) * 2) + dePX(this.style.paddingTop) + dePX(this.style.paddingBottom) + dePX(this.style.marginTop) + dePX(this.style.marginBottom)); //} var pt = curHeight + dHeight - (dHeight * ((frames - i) / frames)); if (j > 0) { pushAnim(function (t,p1) { t.style.height = p1 + "px"; }, i, targets[j], pt); } else { pushAnim(function (t,p1) { t.style.height = p1 + "px"; }, i, targets[j], p1); } } } } function shrinkUp(elHeight, ppf) { var targets = new Array(); var temp = this; while (temp.nodeName == "DIV") { targets.push(temp); temp = temp.parentNode; } if (!ppf) { ppf = targets[0].offsetHeight - elHeight; } var dHeight = targets[0].offsetHeight - elHeight; var frames = Math.ceil(dHeight / ppf); for (var i = 1; i <= frames; i++) { var p1 = targets[0].offsetHeight - dHeight + (dHeight * ((frames - i) / frames)); for (var j = 0; j < targets.length; j++) { curHeight = targets[j].offsetHeight; var pt = curHeight - dHeight + (dHeight * ((frames - i) / frames)); if (j) { pushAnim(function (t,p1) { t.style.height = p1 + "px"; }, i, targets[j], pt); } else { pushAnim(function (t,p1) { t.style.height = p1 + "px"; }, i, targets[j], p1); } } } } function expandUR(baseX, baseY, size, ppf, delay) { if (!ppf) { ppf = size; } if (!delay) { delay = 0; } var frames = Math.ceil(size / ppf); this.style.left = baseX; pushAnim(function (t) { t.style.visibility = 'visible'; }, delay + 1, this); for (var i = 1; i <= frames; i++) { pushAnim(function (t, p1) { t.style.width = t.style.height = p1 + "px"; }, delay + i, this, (size * i / frames)) pushAnim(function (t, p1) { t.style.top = p1 + "px"; }, delay + i, this, baseY - (size * i / frames)) } } function expandU(baseX, baseY, size, ppf, delay) { if (!ppf) { ppf = size; } if (!delay) { delay = 0; } var frames = Math.ceil(size / ppf); if (!frames) { frames = 1; } this.style.left = baseX; pushAnim(function (t) { t.style.visibility = 'visible'; }, delay + 1, this); for (var i = 1; i <= frames; i++) { pushAnim(function (t, p1) { t.style.height = p1 + "px"; }, delay + i, this, (size * i / frames)) pushAnim(function (t, p1) { t.style.top = p1 + "px"; }, delay + i, this, baseY - (size * i / frames)) } } function zoomIn(centerX, centerY, sizeX, sizeY, frames, delay) { if (!delay) { delay = 0; } if (!frames) { frames = 1; } //this.style.overflow = 'hidden'; this.style.height = '0px'; this.style.width = '0px'; this.style.top = centerY; this.style.left = centerX; pushAnim(function (t) { t.style.visibility = 'visible'; }, delay + 1, this); for (var i = 1; i <= frames; i++) { pushAnim(function (t, p1) { t.style.width = p1 + "px"; }, delay + i, this, (sizeX * i / frames)) pushAnim(function (t, p1) { t.style.height = t.style.fontSize = p1 + "px"; }, delay + i, this, (sizeY * i / frames)) pushAnim(function (t, p1) { t.style.top = p1 + "px"; }, delay + i, this, centerY - (sizeY / 2 * i / frames)) pushAnim(function (t, p1) { t.style.left = p1 + "px"; }, delay + i, this, centerX - (sizeX / 2 * i / frames)) } } function zoomVertical(centerX, centerY, sizeX, sizeY, frames, delay) { if (!delay) { delay = 0; } if (!frames) { frames = 1; } this.style.overflow = 'hidden'; this.style.height = '0px'; this.style.width = '0px'; this.style.top = centerY; this.style.left = centerX; pushAnim(function (t) { t.style.visibility = 'visible'; }, delay + 1, this); for (var i = 1; i <= frames; i++) { pushAnim(function (t, p1) { t.style.width = t.style.fontSize = t.style.lineHeight = p1 + "px"; }, delay + i, this, (sizeX * i / frames)) pushAnim(function (t, p1) { t.style.height = p1 + "px"; }, delay + i, this, (sizeY * i / frames)) pushAnim(function (t, p1) { t.style.top = p1 + "px"; }, delay + i, this, centerY - (sizeY / 2 * i / frames)) pushAnim(function (t, p1) { t.style.left = p1 + "px"; }, delay + i, this, centerX - (sizeX / 2 * i / frames)) } } function pushLeft(baseX, size, ppf, delay) { if (!delay) { delay = 0; } if (!ppf) { ppf = size; } var frames = Math.ceil(size / ppf); this.overflow = 'hidden'; this.style.width = '0px'; this.style.left = baseX; pushAnim(function (t) { t.style.visibility = 'visible'; }, delay + 1, this); for (var i = 1; i <= frames; i++) { pushAnim(function (t, p1) { t.style.width = p1 + "px"; }, delay + i, this, (size * i / frames)) pushAnim(function (t, p1) { t.style.left = p1 + "px"; }, delay + i, this, baseX - (size * i / frames)) } } function slideDown(startY, endY, ppf, delay) { var delta = endY - startY; if (!delay) { delay = 0; } if (!ppf) { ppf = delta; } var frames = Math.ceil(delta / ppf); pushAnim(function (t) { t.style.visibility = 'visible'; }, delay + 1, this); for (var i = 1; i <= frames; i++) { pushAnim(function (t, p1) { t.style.top = p1 + "px"; }, delay + i, this, startY + (delta * i / frames)) } } function expandIn(sX, sY, eX, eY, ppf, delay) { if (!ppf) { ppf = size; } if (!delay) { delay = 0; } var xDif = eX - sX; var yDif = eY - sY; if (yDif > xDif) { var frames = Math.ceil(yDif / ppf); } else { var frames = Math.ceil(xDif / ppf); } this.style.left = sX; this.style.top = sY; pushAnim(function (t) { t.style.visibility = 'visible'; }, delay + 1, this); for (var i = 1; i <= frames; i++) { pushAnim(function (t, p1) { t.style.width = p1 + "px"; }, delay + i, this, (xDif * i / frames)) pushAnim(function (t, p1) { t.style.height = p1 + "px"; }, delay + i, this, (yDif * i / frames)) if (xDif < 0) { pushAnim(function (t, p1) { t.style.left = p1 + "px"; }, delay + i, this, sX - (xDif * i / frames)) } if (yDif < 0) { pushAnim(function (t, p1) { t.style.top = p1 + "px"; }, delay + i, this, sY - (yDif * i / frames)) } } } function shrinkOut(ppf, delay) { if (!ppf) { ppf = this.offsetWidth; } if (!delay) { delay = 0; } var xDif = this.offsetWidth; var yDif = this.offsetHeight; var frames = Math.ceil(xDif / ppf); for (var i = 1; i <= frames; i++) { pushAnim(function (t, p1) { t.style.width = p1 + "px"; }, delay + i, this, (xDif * (frames - i) / frames)) pushAnim(function (t, p1) { t.style.height = p1 + "px"; }, delay + i, this, (yDif * (frames - i) / frames)) } pushAnim(function (t, p1) { t.style.visibility = 'hidden'; }, delay + i, this, this); } var calBox; function absOffsetLeft(target) { if (target.parentNode) { parents = absOffsetLeft(target.parentNode); } else { parents = 0; } if ((!isNaN(target.offsetLeft) && ((target.nodeName == "TD")))||(!target.firstChild)) { return target.offsetLeft + parents; } else { return parents; } } function absOffsetTop(target) { if (target.parentNode) { parents = absOffsetTop(target.parentNode); } else { parents = 0; } if ((!isNaN(target.offsetTop) && ((target.nodeName == "DIV" && target.style.position == "absolute")||(target.nodeName == "TD")))||(!target.firstChild)) { return target.offsetTop + parents; } else { return parents; } } function lyteCal(target, def, box) { calBox = document.getElementById(box); calBox.style.visibility = "hidden"; calBox.style.border = "2px solid #383838"; calBox.style.backgroundColor = "#ffd"; calBox.style.position = "absolute"; calBox.style.width = "250px"; var targetBox = document.getElementById(target); //calBox.style.left = absOffsetLeft(targetBox) + 'px'; //calBox.style.top = absOffsetTop(targetBox) + 'px'; calBox.innerHTML = showCal(def, target); calBox.style.visibility = "visible"; } function showCal(def, target) { var yy = 0; var mm = 0; if (def) { yy = def.substr(0,4); mm = def.substr(4,2); } else { var temp = new Date(); yy = temp.getFullYear(); mm = temp.getMonth(); } var dow = ['Mon','Tue','Wed','Thu','Fri','Sat', 'Sun']; var moy = ['January','February','March','April','May','June','July','August','September','October','November','December']; if (mm < 0 || mm > 12) {alert('month must be between 1 and 12'); return false;} if (yy != 0 && (yy < 1901 || yy > 2100)) {alert('year must be after 1900 and before 2101'); return false;} var calendar = new Date(); var today = calendar.getDate(); calendar.setDate(1); if (yy > 1900) calendar.setFullYear(yy); if (mm > 0) calendar.setMonth(mm - 1); var yy = year = calendar.getFullYear(); var month = calendar.getMonth(); calendar.setDate(today); var weekday = calendar.getDay() - 1; var dd = new Date(year, month + 1, 0); var dim = dd.getDate(); var td_start = ''; var cal = '
' if (document.getElementById) { var mmb = month; mm = month + 1; var yya = yyb = yy; if (mmb <1) {mmb += 12; yyb--;} var mma = month + 2; if (mma > 12) {mma -= 12; yya++;} var yb = yy -1; var ya = yy +1; cal += '
<<<>>>
'; } else {cal += '
';} cal += ''; for(dex=0; dex < 7; dex++) { cal += td_start + dow[dex] + '';} cal += ''; var day2 = today; for (dex = today; dex > 6; dex -=7) day2 = dex; weekday -= day2 - 1; while (weekday < 0) weekday += 7; for(dex=0; dex < weekday; dex++) cal += td_start + ' '; for(dex=1; dex <= dim; dex++) { if(weekday == 7) {cal += ''; weekday = 0;} cal += td_start + ''+ dex + ''; weekday += 1; } for(dex=weekday; dex < 7; dex++) cal += td_start + ' '; cal += '
' + moy[month] + ' ' + year + '
'; cal += '
'; return cal; } function calSelect(val, target) { calBox.style.visibility='hidden'; calBox = ""; var targetBox = document.getElementById(target); targetBox.value = val; targetBox.onchange(); } // Calendar Popup // copyright 11Nov2001, 8dec2007 by Stephen Chapman, Felgall Pty Ltd var pagebg = '#add9f5'; // pop-up background colour var headbg = '#cccccc'; // table heading background colour var todaybg = '#9999cc'; // current day of month background colour // valid range for yy is 1901 to 2100 inclusive or zero for current year // valid range for mm is 1 to 12 or zero for current month // permission is granted to use this javascript provided that the below code is not altered function monthlength(month,year) { var dd = new Date(year, month, 0); return dd.getDate(); } function dispCal(yy,mm) { var dow = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']; var moy = ['January','February','March','April','May','June','July','August','September','October','November','December']; if (mm < 0 || mm > 12) {alert('month must be between 1 and 12'); return false;} if (yy != 0 && (yy < 1901 || yy > 2100)) {alert('year must be after 1900 and before 2101'); return false;} var calendar = new Date(); var today = calendar.getDate(); calendar.setDate(1); if (yy > 1900) calendar.setFullYear(yy); if (mm > 0) calendar.setMonth(mm - 1); var yy = year = calendar.getFullYear(); var month = calendar.getMonth(); calendar.setDate(today); var weekday = calendar.getDay(); var daysInMonth = monthlength(month,year); var hilite_start = ''; var td_start = ''; var cal = '
'; for(dex=0; dex < 7; dex++) {if(weekday == dex) cal += td_start + '' + dow[dex] + ''; else cal += td_start + dow[dex] + '';} cal += ''; var day2 = today; for (dex = today; dex > 6; dex -=7) day2 = dex; weekday -= day2 - 1; while (weekday < 0) weekday += 7; for(dex=0; dex < weekday; dex++) cal += td_start + ' '; for(dex=1; dex <= daysInMonth; dex++) { if(weekday == 7) {cal += ''; weekday = 0;} if(today==dex) cal += hilite_start + dex + ''; else cal += td_start + dex + ''; weekday += 1; } for(dex=weekday; dex < 7; dex++) cal += td_start + ' '; cal += '
' + moy[month] + ' ' + year + '
'; if (document.getElementById && arguments.length == 2) { var mmb = month; mm = month + 1; var yya = yyb = yy; if (mmb <1) {mmb += 12; yyb--;} var mma = month + 2; if (mma > 12) {mma -= 12; yya++;} var yb = yy -1; var ya = yy +1; cal += '
<<<>>>
'; } else {cal += '
';} cal += '
'; return cal; } function calendar(yy,mm) {var cal = dispCal(yy,mm); if (!cal) return false; TheNewWin = window.open('','calendar','height=255,width=260,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no'); TheNewWin.document.write('Calendar<\/title>'); if (document.getElementById) TheNewWin.document.write('<script>var pagebg = "'+pagebg+'";var headbg = "'+headbg+'";var todaybg = "'+todaybg+'";'+dispCal.toString()+'<\/script>'); TheNewWin.document.write('<\/head><body style="overflow:hidden;background:'+ pagebg + '">' + cal + '<div style="text-align:center; width:250px"><a href="#" onclick="self.close();return false;">Close Window<\/a><\/div><div style="text-align:center; width:250px;font-size:8px;>Calendar Javascript by <a href="http://www.felgall.com/" target="_blank">Felgall Pty Ltd</a>.</div><\/body><\/html>'); return true;} var uploadWindow = false; var timer = false; var uploadIFrame; function newFile(event, curFolder) { var x, y; if (!e) var e = event; if (e.pageX || e.pageY) { x = e.pageX; y = e.pageY; } else if (e.clientX || e.clientY) { x = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft; y = e.clientY + document.body.scrollTop + document.documentElement.scrollTop; } if (!uploadWindow) { getScreen(); uploadWindow = document.createElement("div"); uploadWindow.style.position = "absolute"; uploadWindow.style.left = (x + scrollX) + "px"; uploadWindow.style.top = (y + scrollY) + "px"; uploadWindow.style.height = "0px"; uploadWindow.style.width = "0px"; uploadWindow.style.overflow = "hidden"; uploadWindow.style.border = "2px solid #383838"; uploadWindow.style.backgroundColor = "#fff"; //uploadWindow.target = folderDiv; uploadWindow.innerHTML = "<div style='border-bottom:2px solid #383838; width:260px; height:15px;'><span style='font-family: Verdana, Arial, Helvetica, sans-serif; margin-left:2px;margin-top:0px; font-size:13px; font-weight:bold; float:left;clear:left;'>New File</span><span style='float:right; clear:right;'><a href='javascript:closeWindow();' style='color:#f00; margin-right:3px;'>X</a></span></div>"; uploadIFrame = document.createElement("iframe"); uploadIFrame.src = "cabinetUpload.php"; uploadIFrame.style.border = "none"; uploadIFrame.style.height = "100px"; uploadIFrame.style.height = "245px"; uploadIFrame.name = "uploadIFrame"; uploadIFrame.id = "uploadIFrame"; document.body.appendChild(uploadWindow); uploadWindow.appendChild(uploadIFrame); uploadWindow.draw = expandIn; uploadWindow.erase = shrinkOut; uploadWindow.draw(x, y, x + 260, y + 100, 30, 0); pushAnim(function (t, p1) { var iFrame = document.frames ? document.frames[0] : document.getElementById('uploadIFrame'); var jTarget = iFrame.document || iFrame.contentWindow.document; var uploadForm = jTarget.getElementById('uploadForm'); var hiddenEl = jTarget.createElement('input'); hiddenEl.type = 'hidden'; hiddenEl.name = 'where'; hiddenEl.value = p1; uploadForm.appendChild(hiddenEl);}, 36, this, curFolder); } } function newFolder(event, curFolder) { var x, y; if (!e) var e = event; if (e.pageX || e.pageY) { x = e.pageX; y = e.pageY; } else if (e.clientX || e.clientY) { x = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft; y = e.clientY + document.body.scrollTop + document.documentElement.scrollTop; } getScreen(); if (!uploadWindow) { uploadWindow = document.createElement("div"); uploadWindow.style.position = "absolute"; uploadWindow.style.left = (x + scrollX) + "px"; uploadWindow.style.top = (y + scrollY) + "px"; uploadWindow.style.height = "0px"; uploadWindow.style.width = "0px"; uploadWindow.style.overflow = "hidden"; uploadWindow.style.border = "2px solid #383838"; uploadWindow.style.backgroundColor = "#fff"; uploadWindow.innerHTML = "<div style='border-bottom:2px solid #383838; width:200px; height:15px;'><span style='font-family: Verdana, Arial, Helvetica, sans-serif; margin-left:2px;margin-top:0px; font-size:13px; font-weight:bold; float:left;clear:left;'>New Subfolder</span><span style='float:right; clear:right;'><a href='javascript:closeWindow();' style='color:#f00; margin-right:3px;'>X</a></span></div><div style='padding:5px;'><input type='textbox' class='textbox' id='folderName' value='Type new folder name here' size='26' onclick='javascript:this.value=\"\";'/><br/><input type='button' value='Create' class='button' onclick='createFolder(\"" + escape(curFolder) + "\");' /></div>"; document.body.appendChild(uploadWindow); uploadWindow.draw = expandIn; uploadWindow.erase = shrinkOut; uploadWindow.draw(x, y, x + 200, y + 68, 30, 0); } } function showLink(event, curLabel) { var x, y; if (isIE) { x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;// - getOffsetLeft(this); y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;// - getOffsetTop(this); } else { x = event.clientX + window.scrollX;// - getOffsetLeft(this); y = event.clientY + window.scrollY;// - getOffsetTop(this); } getScreen(); if (!uploadWindow) { uploadWindow = document.createElement("div"); uploadWindow.style.position = "absolute"; uploadWindow.style.left = (x + scrollX) + "px"; uploadWindow.style.top = (y + scrollY) + "px"; uploadWindow.style.height = "0px"; uploadWindow.style.width = "0px"; uploadWindow.style.overflow = "hidden"; uploadWindow.style.border = "2px solid #383838"; uploadWindow.style.backgroundColor = "#fff"; uploadWindow.innerHTML = "<div style='border-bottom:2px solid #383838; width:200px; height:15px;'><span style='font-family: Verdana, Arial, Helvetica, sans-serif; margin-left:2px;margin-top:0px; font-size:13px; font-weight:bold; float:left;clear:left;'>Link</span><span style='float:right; clear:right;'><a href='javascript:closeWindow();' style='color:#f00; margin-right:3px;'>X</a></span></div><div style='padding:5px;'>#" + curLabel + "</div>"; document.body.appendChild(uploadWindow); uploadWindow.draw = expandIn; uploadWindow.erase = shrinkOut; uploadWindow.draw(x, y, x + 200, y + 63, 30, 0); } } function showPop(event, curFolder) { var levels = curFolder.split("/"); var cur = cabinet; for (var i = 0; i < levels.length; i++) { for (var j = 0; j < cur.children.length; j++) { if (cur.children[j].label == levels[i]) { cur = cur.children[j]; break; } } } var x, y; if (isIE) { x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;// - getOffsetLeft(this); y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;// - getOffsetTop(this); } else { x = event.clientX + window.scrollX;// - getOffsetLeft(this); y = event.clientY + window.scrollY;// - getOffsetTop(this); } getScreen(); if (!uploadWindow && cur.href) { uploadWindow = document.createElement("div"); uploadWindow.style.position = "absolute"; uploadWindow.style.left = (x + scrollX + 5) + "px"; uploadWindow.style.top = (y + scrollY + 5) + "px"; //uploadWindow.style.height = "0px"; uploadWindow.style.width = "350px"; uploadWindow.style.overflow = "hidden"; uploadWindow.style.border = "2px solid #383838"; uploadWindow.style.backgroundColor = "#cff"; uploadWindow.style.padding = "10px"; uploadWindow.innerHTML = cur.href; document.body.appendChild(uploadWindow); //uploadWindow.draw = expandIn; uploadWindow.erase = shrinkOut; //uploadWindow.draw(x, y, x + 200, y + 63, 30, 0); } } function createFolder(curFolder) { curFolder = unescape(curFolder); var folderName = document.getElementById("folderName"); var newDiv = document.createElement("div"); var levels = curFolder.split("/"); var cur = cabinet; for (var i = 0; i < levels.length; i++) { for (var j = 0; j < cur.children.length; j++) { if (cur.children[j].label == levels[i]) { cur = cur.children[j]; break; } } } var newTree = new cabinetTree(folderName.value.safe(), "", false); cur.appendChild(newTree); updateXML(cabinet.makeXML(true)); uploadWindow.erase(30, 0); pushAnim(function () { closeWindow(); }, 11, 0, 0); } function togVis(event, curFolder) { var levels = curFolder.split("/"); var cur = cabinet; for (var i = 0; i < levels.length; i++) { for (var j = 0; j < cur.children.length; j++) { if (cur.children[j].label == levels[i]) { cur = cur.children[j]; break; } } } if (cur.vis == "true") { cur.vis = false; } else { cur.vis = true; } updateXML(cabinet.makeXML(true)); } function getPop(event, curFolder) { var levels = curFolder.split("/"); var cur = cabinet; for (var i = 0; i < levels.length; i++) { for (var j = 0; j < cur.children.length; j++) { if (cur.children[j].label == levels[i]) { cur = cur.children[j]; break; } } } var x, y; if (!e) var e = event; if (e.pageX || e.pageY) { x = e.pageX; y = e.pageY; } else if (e.clientX || e.clientY) { x = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft; y = e.clientY + document.body.scrollTop + document.documentElement.scrollTop; } getScreen(); if (!uploadWindow) { uploadWindow = document.createElement("div"); uploadWindow.style.position = "absolute"; uploadWindow.style.left = (x + scrollX) + "px"; uploadWindow.style.top = (y + scrollY) + "px"; uploadWindow.style.height = "0px"; uploadWindow.style.width = "0px"; uploadWindow.style.overflow = "hidden"; uploadWindow.style.border = "2px solid #383838"; uploadWindow.style.backgroundColor = "#fff"; uploadWindow.innerHTML = "<div style='border-bottom:2px solid #383838; width:270px; height:15px;'><span style='font-family: Verdana, Arial, Helvetica, sans-serif; margin-left:2px;margin-top:0px; font-size:13px; font-weight:bold; float:left;clear:left;'>Set Popup Text</span><span style='float:right; clear:right;'><a href='javascript:closeWindow();' style='color:#f00; margin-right:3px;'>X</a></span></div><div style='padding:5px;'><textarea id='popText' cols='30' rows='4'>" + cur.href + "</textarea><br/><input type='button' value='Update' class='button' onclick='newPop(\"" + escape(curFolder) + "\");' /></div>"; document.body.appendChild(uploadWindow); uploadWindow.draw = expandIn; uploadWindow.erase = shrinkOut; uploadWindow.draw(x, y, x + 270, y + 120, 30, 0); } } function newPop(curFolder) { curFolder = unescape(curFolder); var popText = document.getElementById("popText"); var levels = curFolder.split("/"); var cur = cabinet; for (var i = 0; i < levels.length; i++) { for (var j = 0; j < cur.children.length; j++) { if (cur.children[j].label == levels[i]) { cur = cur.children[j]; break; } } } cur.href = popText.value; updateXML(cabinet.makeXML(true)); uploadWindow.erase(30, 0); pushAnim(function () { closeWindow(); }, 11, 0, 0); } function updateXML(xml) { var httpRequest; // AJAX Initialization if (window.XMLHttpRequest) { // Mozilla, Safari, ... httpRequest = new XMLHttpRequest(); if (httpRequest.overrideMimeType) { httpRequest.overrideMimeType("text/xml"); // See note below about this line } } else if (window.ActiveXObject) { // IE try { httpRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { httpRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } httpRequest.onreadystatechange = function () { ajaxRefresh(httpRequest); }; /*httpRequest.CacheControl = "no-cache"; httpRequest.AddHeader("Pragma", "no-cache"); httpRequest.Expires = -1;*/ var parameters = "target=" + escape(cabinet.label) + "&xml=" + escape(xml); httpRequest.open("POST", "cabinetsXML.php", true); httpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); httpRequest.setRequestHeader("Content-length", parameters.length); httpRequest.setRequestHeader("Connection", "close"); httpRequest.send(parameters); } function confirmXML(httpRequest) { if (httpRequest.readyState == 4) { if (httpRequest.status == 200) { //alert(httpRequest.responseText); pushAnim(function () { refreshTree(); }, 24, 0, 0); } else { alert("There was a problem with the fill request.\nStatus: " + httpRequest.status); } } } function replaceHref(cur, oldLabel, newLabel) { for (var i = 0; i < cur.children.length; i++) { if (!cur.children[i].href) { replaceHref(cur.children[i], oldLabel, newLabel); } else { cur.children[i].href = cur.children[i].href.replace(oldLabel, newLabel); } } } function renameTree(dir) { var levels = new Array(); levels = dir.split("/"); var cur = cabinet; for (var i = 1; i < levels.length - 1; i++) { if (cur.children) { for (var j = 0; j < cur.children.length; j++) { if (cur.children[j].label == urldecode(levels[i])) { cur = cur.children[j]; break; } } } } cur = cur.parent; var newLabel = prompt("Enter a new label:", cur.children[j].label.unsafe()).safe(); for (j = 0; j < cur.children.length; j++) { if (cur.children[j].label == levels[levels.length - 2]) { var oldLabel = cur.children[j].label; cur.children[j].label = newLabel; replaceHref(cur.children[j], oldLabel, newLabel); break; } } var newDir = ""; for (var k = 0; k < levels.length - 2; k++) { newDir += levels[k] + "/"; } newDir += newLabel + "/"; var httpRequest; // AJAX Initialization if (window.XMLHttpRequest) { // Mozilla, Safari, ... httpRequest = new XMLHttpRequest(); if (httpRequest.overrideMimeType) { httpRequest.overrideMimeType("text/xml"); // See note below about this line } } else if (window.ActiveXObject) { // IE try { httpRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { httpRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } httpRequest.onreadystatechange = function () { ajaxCheck(httpRequest, false); }; httpRequest.open("GET", "cabinetUpload.php?mode=rename&old=" + escape(dir) + "&new=" + escape(newDir), true); httpRequest.send(null); updateXML(cabinet.makeXML(true)); } function moveDown(dir) { var levels = new Array(); levels = dir.split("/"); var cur = cabinet; for (var i = 1; i < levels.length - 1; i++) { if (cur.children) { for (var j = 0; j < cur.children.length; j++) { if (cur.children[j].label == urldecode(levels[i])) { cur = cur.children[j]; break; } } } } cur = cur.parent; for (j = 0; j < cur.children.length; j++) { if (cur.children[j].label == urldecode(levels[levels.length - 2])) { cur.children[j].moveDown(); break; } } updateXML(cabinet.makeXML(true)); } function moveUp(dir) { var levels = new Array(); levels = dir.split("/"); var cur = cabinet; for (var i = 1; i < levels.length - 1; i++) { if (cur.children) { for (var j = 0; j < cur.children.length; j++) { if (cur.children[j].label == urldecode(levels[i])) { cur = cur.children[j]; break; } } } } cur = cur.parent; for (j = 0; j < cur.children.length; j++) { if (cur.children[j].label == urldecode(levels[levels.length - 2])) { cur.children[j].moveUp(); break; } } updateXML(cabinet.makeXML(true)); } function deleteTree(dir) { dir = unescape(dir); if (confirm("Are you certain you want to delete this?")) { var levels = new Array(); levels = dir.split("/"); var cur = cabinet; for (var i = 1; i < levels.length - 1; i++) { if (cur.children) { for (var j = 0; j < cur.children.length; j++) { if (cur.children[j].label == urldecode(levels[i])) { cur = cur.children[j]; break; } } } } cur = cur.parent; for (j = 0; j < cur.children.length - 1; j++) { if (cur.children[j].label == urldecode(levels[levels.length - 2])) { cur.children[j].moveDown(); } } var dead = cur.children.pop(); if (dead.children.length) { for (var i = 0; i < dead.children.length; i++) { deleteTree(dir + dead.children[i].label); } } if (dead.href) { var httpRequest; // AJAX Initialization if (window.XMLHttpRequest) { // Mozilla, Safari, ... httpRequest = new XMLHttpRequest(); if (httpRequest.overrideMimeType) { httpRequest.overrideMimeType("text/xml"); // See note below about this line } } else if (window.ActiveXObject) { // IE try { httpRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { httpRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } httpRequest.onreadystatechange = function () { ajaxCheck(httpRequest, false); }; httpRequest.open("GET", "cabinetUpload.php?mode=delete&file=" + escape(dead.href), true); httpRequest.send(null); } //cur.children.push(dead); updateXML(cabinet.makeXML(true)); } } function ajaxCheck(httpRequest, show) { if (httpRequest.readyState == 4) { if (httpRequest.status == 200) { if (show) { alert(httpRequest.responseText); } } else { alert("There was a problem with the fill request.\nStatus: " + httpRequest.status); } } } function closeWindow(fast) { if (!fast) { uploadWindow.erase(30, 0); pushAnim(function (t, p1) { document.body.removeChild(uploadWindow); uploadWindow = false; }, Math.ceil(uploadWindow.offsetWidth / 30), document, document); } else { document.body.removeChild(uploadWindow); uploadWindow = false; } } var symbols = new Array("+", " ", "!", '"', "#", "$", "&", "'", "(", ")", "*", ",", "/", ":", ";", "<", "=", ">", "?", "@", "[", "\\", "]"); var php = new Array("%2B", "+", "%21", "%22", "%23", "%24", "%26", "%27", "%28", "%29", "%2A", "%2C", "%2F", "%3A", "%3B", "%3C", "%3D", "%3E\n", "%3F", "%40", "%5B", "%5C", "%5D"); function urlencode(str) { for (var i = 0; i < symbols.length; i++) { while (str.indexOf(symbols[i]) > -1) { str = str.replace(symbols[i], php[i]); } } return str; } function urldecode(str) { for (var i = 0; i < symbols.length; i++) { while (str.indexOf(php[i]) > -1) { str = str.replace(php[i], symbols[i]); } } return str; } function cabinetTree( label, href, children, vis) { this.label = label; this.href = href; this.children = children; this.parent = false; this.vis = vis; for (var i = 0; i < children.length; i++) { children.parent = this; } } cabinetTree.prototype.appendChild = function (child) { child.parent = this; if (!this.children.length) { this.children = new Array(); } this.children.push(child); } cabinetTree.prototype.moveUp = function () { var temp = this; var kids = this.parent.children; for (var i = 0; i < kids.length; i++) { if (kids[i] == this) { kids[i] = kids[i - 1]; kids[i - 1] = temp; } } } cabinetTree.prototype.moveDown = function () { var temp = this; var kids = this.parent.children; for (var i = kids.length - 1; i >= 0 ; i--) { if (kids[i] == this) { kids[i] = kids[i + 1]; kids[i + 1] = temp; } } } cabinetTree.prototype.showTree = function (editMode) { var showMe = ""; if (this.vis == "true" || this.vis == undefined || editMode) { var temp = this; var dir = ""; while (temp.label) { dir = temp.label + "/" + dir; temp = temp.parent; } if ((this.href.substr(0,8) != "cabinets") && (this.label)) { showMe = "<div style='font-size:18px; font-weight:500; "; if (this.parent.label) { showMe += "margin-left:40px; '>"; } else { showMe += "'>"; } } showMe += "<a name='" + this.label.safe() + "'></a>"; if (this.href.substr(0,8) == "cabinets") { showMe += "<br/><a href='" + this.href + "' style='font-size:14px;margin-left:40px;margin-right:5px;'>"; } if (this.href.substr(0,8) == "cabinets" || !editMode) { if (this.href.substr(0,8) != "cabinets") showMe += "<span style='font-size:18px; font-weight:500;' onmouseover='showPop(event,\"" + urldecode(dir) + "\");' onmouseout='closeWindow(\"fast\");'>"; showMe += this.label.unsafe(); if (this.href.substr(0,8) != "cabinets") showMe += "</span>"; } else { showMe += "<span style='font-size:18px; font-weight:500;' onclick='renameTree(\"" + urldecode(dir) + "\");'>" + urldecode(this.label).unsafe() + "</span>"; } if ((this.href.substr(0,8) != "cabinets") && (editMode) && (this.label)) { showMe += "<img src='images/folder.gif' alt='New Subfolder' style='height:20px; width:20px; margin-left:10px; cursor:pointer;' onmousedown='newFolder(event, \""; showMe += dir; showMe += "\");' />"; if (this.parent) showMe += "<img src='images/file.gif' alt='New File' style='height:20px; width:20px;cursor:pointer;' onmousedown='newFile(event, \"" + dir + "\");'/>"; } if (this.href.substr(0,8) == "cabinets") { showMe += "</a>"; } var childnum; var fileCount = 0; if (this.href.substr(0,8) == "cabinets" && editMode) { if (this.parent) { for (var i = 0; i < this.parent.children.length; i++) { if (this.parent.children[i].href) { fileCount++; } if (this.parent.children[i] == this) { childnum = i; } } if (childnum > 0) { showMe += "<img src='images/upArrow.gif' alt='Move Folder Up' style='height:20px; width:20px;cursor:pointer;' onmousedown='moveUp(\"" + urldecode(dir) + "\");'/>"; } if (childnum < fileCount - 1) { showMe += "<img src='images/downArrow.gif' alt='Move Folder Down' style='height:20px; width:20px;cursor:pointer;' onmousedown='moveDown(\"" + urldecode(dir) + "\");'/>"; } } showMe += "<span style='position:relative;top:-4px;font-size:14px'><a href='javascript:deleteTree(\"" + dir +"\");' style='color:#f00'>X</a></span>"; if (this.parent) showMe += "<img src='images/eye" + ((this.vis == "true")?"":"x") + ".gif' style='height:20px;width:20px;cursor:pointer;' onmousedown='togVis(event, \"" + dir + "\");' /><img src='images/link.gif' style='cursor:pointer;' onmousedown='showLink(event, \"" + this.label.safe() + "\");' />"; } else if (editMode) { if (this.parent) { for (var i = 0; i < this.parent.children.length; i++) { if (this.parent.children[i].href) { fileCount++; } if (this.parent.children[i] == this) { childnum = i; } } if (childnum - fileCount > 0) { showMe += "<img src='images/upArrow.gif' alt='Move Folder Up' style='height:20px; width:20px;cursor:pointer;' onmousedown='moveUp(\"" + urldecode(dir) + "\");'/>"; } if (childnum < this.parent.children.length - 1) { showMe += "<img src='images/downArrow.gif' alt='Move Folder Down' style='height:20px; width:20px;cursor:pointer;' onmousedown='moveDown(\"" + urldecode(dir) + "\");'/>"; } } if (cabinet != this) { showMe += "<span style='position:relative;top:-4px;font-size:14px'><a href='javascript:deleteTree(\"" + dir +"\");' style='color:#f00'>X</a></span>"; } if (this.parent) showMe += "<img src='images/eye" + ((this.vis == "true" || !this.parent)?"":"x") + ".gif' style='height:20px;width:20px;cursor:pointer;' onmousedown='togVis(event, \"" + dir + "\");' />"; if (dir.indexOf("/") != dir.lastIndexOf("/")) { showMe += "<img src='images/note.gif' style='height:20px;width:20px;cursor:pointer;' onmousedown='getPop(event, \"" + urldecode(dir) + "\");'/>";} showMe += "<img src='images/link.gif' style='cursor:pointer;' onmousedown='showLink(event,\"" + this.label.safe() + "\");' />"; } //showMe += "<br />"; for (var i = 0; i < this.children.length; i++) { showMe += this.children[i].showTree(editMode); } if ((this.href.substr(0,8) != "cabinets") && (this.label)) { showMe += "</div>"; } } else { } return showMe; } cabinetTree.prototype.makeXML = function (skip) { var xml = ''; if (!skip) { if (this.href.substr(0,8) != "cabinets") { xml = '<folder vis="' + this.vis + '" href="' + this.href.safe() + '">'; } else { xml = '<file'; xml += ' vis="' + this.vis + '" href="' + this.href.safe() + '">'; } xml += this.label; } for (var j = 0; j < this.children.length; j++) { xml += this.children[j].makeXML(false); } if (!skip) { if (this.href.substr(0,8) != "cabinets") { xml += '</folder>'; } else { xml += '</file>'; } } return xml; } var cabinet; function parseXML(xml, cabName) { var p = 0; var o = 0; var c = 0; var s = 0; cabinet = new cabinetTree(urldecode(cabName), "", false); var curLevel = cabinet; while (o >= 0) { var tag = ""; var vis = ""; var href = ""; var label = ""; c = xml.indexOf(">", o); s = xml.indexOf(" ", o); if (!((xml.indexOf(" ", xml.indexOf(" ", s) + 1) > c) && (xml.indexOf(" ", s) < c))) { if (xml.substr(o + 1, 1) != "/") { tag = xml.substr(o + 1, s - o - 1); var e = xml.indexOf("=", s); var q = xml.indexOf('"', xml.indexOf('"', e) + 1); vis = xml.substr(e + 2, q - e - 2); s = xml.indexOf(" ", q); e = xml.indexOf("=", s); q = xml.indexOf('"', xml.indexOf('"', e) + 1); href = xml.substr(e + 2, q - e - 2).unsafe(); } else { tag = xml.substr(o + 1, c - o); } } else { tag = xml.substr(o + 1, xml.indexOf(" ", o + 1) - o); var e = xml.indexOf("=", s); var q = xml.indexOf('"', xml.indexOf('"', e) + 1); vis = xml.substr(e + 2, q - e - 2); } o = xml.indexOf("<", o + 1); label = xml.substr(c + 1, o - c - 1); label = label.trim(); if (!label) label = "No Label"; if (tag.indexOf("/", 0) != 0) { var tempBranch = new cabinetTree( label, href, false, vis ); curLevel.appendChild(tempBranch); curLevel = tempBranch; } else { curLevel = curLevel.parent; } } } String.prototype.safe = function() { var ret = this.replace(/&/g, "ampersand"); ret = ret.replace(/#/g, "hashsign"); ret = ret.replace(/\(.\)/g, "periodsign"); ret = ret.replace(/"/g, """); ret = ret.replace(/</g, "<"); ret = ret.replace(/>/g, ">"); return ret; } String.prototype.unsafe = function() { var ret = this.replace(/ampersand/g, "&"); ret = ret.replace(/hashsign/g, "#"); ret = ret.replace(/periodsign/g, "."); ret = ret.replace(/"/g, '"'); ret = ret.replace(/</g, "<"); ret = ret.replace(/>/g, ">"); return ret; } String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g,""); } String.prototype.ltrim = function() { return this.replace(/^\s+/,""); } String.prototype.rtrim = function() { return this.replace(/\s+$/,""); } var autoBox; var dispBox; var hiddenBox; var getting = false; var oldSearch = ""; var oldObj; function autoComplete(obj, e, disp, val, n, db) { if (obj.value) { if (!autoBox) { autoBox = document.createElement("div"); } autoBox.style.position = "absolute"; autoBox.style.left = "1px"; autoBox.style.top = (obj.offsetTop + obj.offsetHeight + 1) + "px"; autoBox.style.color = "#000"; autoBox.style.border = "1px solid #000"; autoBox.style.width = "100%"; autoBox.style.zIndex = "10000"; //autoBox.innerHTML = ""; dispBox = obj; dispBox.onblur = function () { pushAnim(function () { autoBox.parentNode.removeChild(autoBox);}, 12, 0, 0); } dispBox.style.zIndex = "0"; if (!autoBox.offsetLeft) { dispBox.parentNode.appendChild(autoBox); } hiddenBox = document.getElementById(obj.id.substr(0, obj.id.length - 4)); if (!getting) { var httpRequestA; // AJAX Initialization if (window.XMLHttpRequest) { // Mozilla, Safari, ... httpRequestA = new XMLHttpRequest(); if (httpRequestA.overrideMimeType) { httpRequestA.overrideMimeType("text/xml"); // See note below about this line } } else if (window.ActiveXObject) { // IE try { httpRequestA = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { httpRequestA = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } httpRequestA.onreadystatechange = function() { getAuto(httpRequestA); }; httpRequestA.open("GET", "/egads/autoComplete.php?db=" + db + "&disp=" + disp +"&val=" + val + "&text=" + escape(obj.value), true); httpRequestA.send(null); oldSearch = obj.value; oldObj = obj; getting = true; } function getAuto(httpRequest) { if (httpRequest.readyState == 4) { if (httpRequest.status == 200) { var res = httpRequest.responseText; if (res != "none") { autoBox.innerHTML = res; getting = false; if (oldObj.value != oldSearch) { oldObj.onkeyup(); } } else { autoBox.parentNode.removeChild(autoBox); } } else { alert("There was a problem with the fill request.\nStatus: " + httpRequest.status); } } } } else { dispBox.parentNode.removeChild(autoBox); } } function acClick(disp, val) { dispBox.value = disp; hiddenBox.value = val; document.body.removeChild(autoBox); }