// (c) Carbonite, Inc., 2005-2009 All rights reserved /* Carbonite Service included file /scripts/machinerecord.class.js */ // (c) Carbonite, Inc., 2005-2009 All rights reserved BaseMachineRecord = function() { // HTML Objects this.Name = null; this.Number = null; this.Description = null; this.LastBackupDate = null; this.MachineType = null; this.Platform = null; this.HtmlNode = null; // defining string this.definingString = null; // classes this.SELECTCLASS = null; this.UNSELECTCLASS = null; this.HOVERCLASS = null; // hover tip position, null will place it automatically this.tipX = null; this.tipY = null; } BaseMachineRecord.prototype.parseString = function() { var NVs = this.definingString.split(";"); var NVindex = 0; while (NVs[NVindex]) { var NV = NVs[NVindex].split("="); this[NV[0]] = NV[1]; NVindex++; } // default values for those that are not provided if ("" == this.MachineType) this.MachineType = "desktop"; } BaseMachineRecord.prototype.Select = function(bSelect) { this.HtmlNode.className = (bSelect ? this.SELECTCLASS : this.UNSELECTCLASS) + " " + this.Platform; } BaseMachineRecord.prototype.Hover = function(bOver) { if (this.HtmlNode.className.indexOf(this.SELECTCLASS) < 0) this.HtmlNode.className = (bOver ? this.HOVERCLASS : this.UNSELECTCLASS) + " " + this.Platform; if (null == this.tipX || null == this.tipY) { // position the tip so that it shows the description at the bottom of the box var machineBox = GetChildWithId(this.HtmlNode, "machineBoxBody") if (null != machineBox) { var mbPos = FindObjectPosition(machineBox); this.tipX = mbPos[0] + 20; this.tipY = mbPos[1] + machineBox.offsetHeight - 20; } } if (bOver) ShowTipString(this.Description, this.tipX, this.tipY); else HideTipString(this.Description); } function MachineRecordHover() { this.MachineRecord.Hover(true); } function MachineRecordOut() { this.MachineRecord.Hover(false); } function MachineRecordClick() { Installation.ChooseComputer(this.MachineRecord); } MachineRecordBlock = function(str) { // defining string this.definingString = str; this.parseString(); this.SELECTCLASS = "SelectedMachine"; this.UNSELECTCLASS = "UnselectedMachine"; this.HOVERCLASS = "HoverMachine"; this.insertIntoUI(); } MachineRecordBlock.prototype = new BaseMachineRecord; MachineRecordBlock.prototype.insertIntoUI = function() { this.HtmlNode = document.getElementById('crbMachineRecordTemplate').cloneNode(true); this.insertValue("Name"); this.insertValue("Description"); this.insertValue("LastBackupDate"); GetChildWithId(this.HtmlNode, "machineType").className += " " + this.MachineType; this.HtmlNode.MachineRecord = this; this.HtmlNode.onmouseover = MachineRecordHover; this.HtmlNode.onmouseout = MachineRecordOut; this.HtmlNode.onclick = MachineRecordClick; document.getElementById('crbShortMachineList').appendChild(this.HtmlNode); this.HtmlNode.style.display = "inline"; this.HtmlNode.className += " " + this.Platform; } MachineRecordBlock.prototype.insertValue = function(valueName) { var populateNode = GetChildWithId(this.HtmlNode, "machine" + valueName); populateNode.innerHTML = this[valueName]; } MachineRecordRow = function(str) { // defining string this.definingString = str; this.parseString(); this.SELECTCLASS = "SelectedMachineRow"; this.UNSELECTCLASS = "UnselectedMachineRow"; this.HOVERCLASS = "HoverMachineRow"; this.insertIntoUI(); } MachineRecordRow.prototype = new BaseMachineRecord; MachineRecordRow.prototype.insertIntoUI = function() { var table = document.getElementById('crbMachineTable'); var tbody = table.getElementsByTagName('tbody')[0]; this.HtmlNode = document.createElement('tr'); this.HtmlNode.className = "UnselectedMachineRow"; var col = document.createElement('td'); col.className = this.MachineType + "Small"; var incompatMsg = document.getElementById('crbIncompatiblePlatform').cloneNode(true); col.appendChild(incompatMsg); this.HtmlNode.appendChild(col); col = document.createElement('td'); col.innerText = this.Name; this.HtmlNode.appendChild(col); col = document.createElement('td'); col.innerText = this.Description; this.HtmlNode.appendChild(col); col = document.createElement('td'); col.innerText = this.LastBackupDate; this.HtmlNode.appendChild(col); this.HtmlNode.MachineRecord = this; this.HtmlNode.onmouseover = MachineRecordHover; this.HtmlNode.onmouseout = MachineRecordOut; this.HtmlNode.onclick = MachineRecordClick; this.HtmlNode.className += " " + this.Platform; tbody.appendChild(this.HtmlNode); } MachineChosen = function(str) { // defining string this.definingString = str; this.parseString(); this.insertIntoUI(); } MachineChosen.prototype = new BaseMachineRecord; MachineChosen.prototype.insertIntoUI = function() { this.HtmlNode = document.getElementById('chosenMachineDisplay'); this.insertValue("Name"); this.insertValue("Description"); this.insertValue("LastBackupDate"); GetChildWithId(this.HtmlNode, "machineType").className += " " + this.MachineType; this.HtmlNode.style.display = ""; } MachineChosen.prototype.insertValue = function(valueName) { var populateNode = GetChildWithId(this.HtmlNode, "machine" + valueName); populateNode.innerHTML = this[valueName]; } /* End included file /scripts/machinerecord.class.js */ /* Carbonite Service included file /scripts/table.class.js */ // (c) Carbonite, Inc., 2005-2009 All rights reserved /* Carbonite Service included file /scripts/draganddrop.js */ // (c) Carbonite, Inc., 2005-2009 All rights reserved /* Carbonite Service included file /scripts/columninfo.class.js */ // (c) Carbonite, Inc., 2005-2009 All rights reserved ColumnInfo = function(obj) { this.Column = obj; this.MinSize = parseInt(this.ColumnStyle().minWidth); if (isNaN(this.MinSize)) this.MinSize = 20; this.MaxSize = parseInt(this.ColumnStyle().maxWidth); if (isNaN(this.MaxSize)) this.MaxSize = 1000; this.RelativeSize = 1; } ColumnInfo.prototype.ColumnStyle = function() { var colStyle = this.Column.currentStyle ? this.Column.currentStyle : window.getComputedStyle(this.Column, null); return colStyle; } ColumnInfo.prototype.SetWidth = function(width) { width = Math.max(this.MinSize, width); width = Math.min(this.MaxSize, width); this.Column.style.width = width + 'px'; } ColumnInfo.prototype.GetCurrentWidth = function() { return this.Column.offsetWidth; } // priovides some backward compatibility; these should be gone when we no longer use the non-htmltable tables ColumnInfoOld = function(sName) { this.Column = document.getElementById(sName); this.Header = document.getElementById(sName + "Header"); this.MinSize = parseInt(this.Column.currentStyle.minWidth); if (isNaN(this.MinSize)) this.MinSize = 20; this.MaxSize = parseInt(this.Column.currentStyle.maxWidth); if (isNaN(this.MaxSize)) this.MaxSize = 1000; this.RelativeSize = 1; } ColumnInfoOld.prototype.SetWidth = function(width, headerOffset) { width = Math.max(this.MinSize, width); width = Math.min(this.MaxSize, width); var cols = document.all.item(this.Column.id); for (var col = 0; col < cols.length; col++) { cols[col].style.width = width + 'px'; } this.Column.style.width = width + 'px'; this.Header.style.width = (width - headerOffset) + 'px'; } ColumnInfoOld.prototype.GetCurrentWidth = function() { return parseInt(this.Column.currentStyle.width); } /* End included file /scripts/columninfo.class.js */ /* Carbonite Service included file /scripts/draginfo.class.js */ // (c) Carbonite, Inc., 2005-2009 All rights reserved DragInfo = function(obj) { this.debug = document.getElementById('DebugDrags'); this.dodebug('DragInfo created for object' + obj.id); this.dragger = obj; this.init(); } DragInfo.prototype.FindCol = function(headerObj) { this.Columns = new Array(); this.DragIndex = null; var tParent = headerObj; while (tParent && tParent.nodeName != "TABLE") tParent = tParent.parentNode; // find the column position within the table var cols = tParent.getElementsByTagName('TH'); for (i = 0; i < cols.length && null == this.DragIndex; i++) { if (cols[i] == headerObj) this.DragIndex = i; } var totalToRight = 0; for (i = 0; i < cols.length; i++) { this.dodebug(cols[i].outerHTML); var colInfo = new ColumnInfo(cols[i]); if (i > this.DragIndex) totalToRight += colInfo.GetCurrentWidth(); this.Columns.push(colInfo); } // final pass through all the columns to the right in order to figure out their relative width for (i = this.DragIndex + 1; i < this.Columns.length; i++) this.Columns[i].RelativeSize = this.Columns[i].GetCurrentWidth() / totalToRight; } DragInfo.prototype.init = function() { this.FindCol(this.dragger.parentNode); this.draggerPos = FindObjectPosition(this.dragger.parentNode); this.originalMouse = mouseCoords(event); this.mouseOffset = getMouseOffset(this.dragger.parentNode, event); this.originalMouse.x -= this.mouseOffset.x; this.originalMouse.y -= this.mouseOffset.y; this.dodebug("X:" + this.originalMouse.x + ", Y:" + this.originalMouse.y); } DragInfo.prototype.FixColSizes = function(lastIndex, desiredWidth, relativeTotal) { if (lastIndex <= this.DragIndex) return; // Basically, the idea here is to share out the sizing to the right amongst the columns to the right. // The columns will not allow themselves to be set smaller than the minimum or larger than the maximum // So, we need to track if we have too much left over in the last column and fix up the rest if necessary // Most of the time the recursion is not necessary, and so it should be smooth. // default relativeTotal to 1 if (relativeTotal == null) relativeTotal = 1; // First pass, find out how much we need to share var newRelTotal = 0, leftover = desiredWidth; for (var i = this.DragIndex + 1; i < lastIndex; i++) { this.Columns[i].SetWidth(Math.round(this.Columns[i].RelativeSize * desiredWidth / relativeTotal)); newRelTotal += this.Columns[i].RelativeSize; leftover -= this.Columns[i].GetCurrentWidth(); } this.Columns[lastIndex].SetWidth(leftover); if (this.Columns[lastIndex].GetCurrentWidth() != leftover) this.FixColSizes(lastIndex - 1, desiredWidth - this.Columns[i].GetCurrentWidth(), newRelTotal); } DragInfo.prototype.MoveTo = function(ev) { //var mo = getMouseOffset(this.dragger, event); var xMove = ev.clientX - this.mouseOffset.x; this.dodebug(xMove); var movedBy = xMove - this.originalMouse.x; this.originalMouse.x = xMove; var newLeft = this.Columns[this.DragIndex].GetCurrentWidth() + movedBy; // Figure out total space left to the right var oldRight = 0, maxRight = 0, minRight = 0; for (var i = this.DragIndex + 1; i < this.Columns.length; i++) { oldRight += this.Columns[i].GetCurrentWidth(); maxRight += this.Columns[i].MaxSize; minRight += this.Columns[i].MinSize; } var newRight = oldRight - movedBy; // this.dodebug("oldRight:" + oldRight + ", newRight:" + newRight + ", newLeft:" + newLeft + ", newSum:" + newLeft + newRight + ", oldSum:" + this.Columns[this.DragIndex].GetCurrentWidth() + oldRight); // Only change if we're within the allowable limits if (newLeft >= this.Columns[this.DragIndex].MinSize && newLeft <= this.Columns[this.DragIndex].MaxSize && newRight <= maxRight && newRight >= minRight) { this.Columns[this.DragIndex].SetWidth(newLeft); this.FixColSizes(this.Columns.length - 1, newRight); this.dodebug("LASTLY - movedBy:" + movedBy + ", newLeft:" + newLeft + ", curWidth:" + this.Columns[this.DragIndex].GetCurrentWidth()); } } DragInfo.prototype.dodebug = function(msg) { if (this.debug) this.debug.value = msg; } // backward compatibility version - should eventally be replaced by iuseage of tables that use the above // (c) Carbonite, Inc., 2005-2009 All rights reserved DragInfoOld = function(obj) { this.debug = document.getElementById('DebugDrags'); this.dragger = obj; this.rightCols = new Array(); this.init(); } DragInfoOld.prototype.init = function() { var cols = this.dragger.id.split("|"); this.leftCol = new ColumnInfoOld(cols[0]); var rCols = cols[1].split(";"); var totalRight = 0, i = 0; for (i = 0; i < rCols.length; i++) { this.rightCols.push(new ColumnInfoOld(rCols[i])); totalRight += this.rightCols[i].GetCurrentWidth(); } for (i = 0; i < rCols.length; i++) this.rightCols[i].RelativeSize = this.rightCols[i].GetCurrentWidth() / totalRight; this.draggerPos = FindObjectPosition(this.dragger); this.headerOffset = parseInt(this.dragger.currentStyle.width); this.originalMouse = mouseCoords(event); this.mouseOffset = getMouseOffset(this.dragger, event); this.originalMouse.x -= this.mouseOffset.x; this.originalMouse.y -= this.mouseOffset.y; this.dodebug("X:" + this.originalMouse.x + ", Y:" + this.originalMouse.y); } DragInfoOld.prototype.FixColSizes = function(lastIndex, desiredWidth, relativeTotal) { if (lastIndex < 0) return; // Basically, the idea here is to share out the sizing to the right amongst the columns to the right. // The columns will not allow themselves to be set smaller than the minimum or larger than the maximum // So, we need to track if we have too much left over in the last column and fix up the rest if necessary // Most of the time the recursion is not necessary, and so it should be smooth. // default relativeTotal to 1 if (relativeTotal == null) relativeTotal = 1; // First pass, find out how much we need to share var newRelTotal = 0, leftover = desiredWidth; for (i = 0; i < lastIndex; i++) { this.rightCols[i].SetWidth(Math.round(this.rightCols[i].RelativeSize * desiredWidth / relativeTotal), this.headerOffset); newRelTotal += this.rightCols[i].RelativeSize; leftover -= this.rightCols[i].GetCurrentWidth(); } this.rightCols[lastIndex].SetWidth(leftover, this.headerOffset); if (this.rightCols[lastIndex].GetCurrentWidth() != leftover) this.FixColSizes(lastIndex - 1, desiredWidth - this.rightCols[i].GetCurrentWidth(), newRelTotal); } DragInfoOld.prototype.MoveTo = function(ev) { //var mo = getMouseOffset(this.dragger, event); var xMove = ev.clientX - this.mouseOffset.x; var movedBy = xMove - this.originalMouse.x; this.originalMouse.x = xMove; var newLeft = this.leftCol.GetCurrentWidth() + movedBy; // Figure out total space left to the right var oldRight = 0, maxRight = 0, minRight = 0, i = 0; for (i = 0; i < this.rightCols.length; i++) { oldRight += this.rightCols[i].GetCurrentWidth(); maxRight += this.rightCols[i].MaxSize; minRight += this.rightCols[i].MinSize; } var newRight = oldRight - movedBy; // Only change if we're within the allowable limits if (newLeft >= this.leftCol.MinSize && newLeft <= this.leftCol.MaxSize && newRight <= maxRight && newRight >= minRight) { this.leftCol.SetWidth(newLeft, this.headerOffset); this.FixColSizes(this.rightCols.length - 1, newRight); this.dodebug("movedBy:" + movedBy + ", newRight:" + newRight + ", X:" + ev.clientX + ", xMove:" + xMove); } } DragInfoOld.prototype.dodebug = function(msg) { if (this.debug) this.debug.value = msg; } /* End included file /scripts/draginfo.class.js */ /* Carbonite Service included file /scripts/dragrow.class.js */ // (c) Carbonite, Inc., 2005-2009 All rights reserved DragRow = function(row, dropAreaId) { this.dropArea = document.getElementById(dropAreaId); this.RowAccessor = row; this.debug = document.getElementById('DebugDrags'); this.dodebug('DragRow created for object' + this.RowAccessor.GetRow().id); this.isDroppable = false; this.dropOKIndicator = null; this.dropArea.onmouseup = EndDrag; this.lastX = 0; this.lastY = 0; var self = this; this.showDropIndicator = function() { self.showIndicatorTimeout = null; if (null == self.dropOKIndicator) { self.dropOKIndicator = document.createElement('div'); self.dropOKIndicator.innerHTML = self.RowAccessor.GetColumn("Name").innerHTML; self.dropOKIndicator.className = "dropNO"; self.dropOKIndicator.style.position = "absolute"; document.body.appendChild(self.dropOKIndicator); self.UpdateDropIndicator(); } } this.showIndicatorTimeout = setTimeout(this.showDropIndicator, 100); document.body.style.cursor = "hand"; } DragRow.prototype.UpdateDropIndicator = function() { if (this.dropOKIndicator) { this.dropOKIndicator.style.left = this.lastX + "px"; this.dropOKIndicator.style.top = this.lastY + "px"; } } DragRow.prototype.UpdateCursor = function(ev) { this.testDroppable(ev); // indicate that it is movable or show that it is droppable if (this.dropOKIndicator) this.dropOKIndicator.className = this.isDroppable ? "dropOK" : "dropNO"; this.UpdateDropIndicator(); } DragRow.prototype.Drop = function() { if (this.showIndicatorTimeout) clearTimeout(this.showIndicatorTimeout); if (this.isDroppable && !IsInCheckList(this.RowAccessor)) AddToCheckList(this.RowAccessor); if (this.dropOKIndicator) document.body.removeChild(this.dropOKIndicator); this.dropOKIndicator = null; document.body.style.cursor = "default"; } DragRow.prototype.testDroppable = function(ev) { // test the drop location and if it is somewhere in the target table this.lastX = ev.clientX; this.lastY = ev.clientY; if (IsInCheckList(this.RowAccessor)) this.isDroppable = false; else { // if the location is over the table var tpos = FindObjectPosition(this.dropArea); this.isDroppable = (this.lastX > tpos[0]) && (this.lastX < (tpos[0] + this.dropArea.offsetWidth)) && (this.lastY > tpos[1]) && (this.lastY < (tpos[1] + this.dropArea.offsetHeight)); } this.dodebug(this.isDroppable); } DragRow.prototype.dodebug = function(msg) { // if (this.debug) // this.debug.value += msg + " "; if (this.debug) this.debug.value = msg; } /* End included file /scripts/dragrow.class.js */ /* Carbonite Service included file /scripts/commonfunctions.js */ // (c) Carbonite, Inc., 2005-2009 All rights reserved // Used in InfoCenter-Alerts.js // /* Carbonite Service included file /scripts/string.class.js */ // (c) Carbonite, Inc., 2005-2009 All rights reserved String.prototype.trim = function () { return this.replace(/^\s+|\s+$/g, ''); // here's a potential alternative // var str = this.replace(/^\s*/, ""); // str = str.replace(/\s*$/, ""); // return str; } String.prototype.splitOnFirst = function(splitString) { var splitAt = this.indexOf(splitString); return [this.substring(0, splitAt), this.substring(splitAt + 1)]; } /* End included file /scripts/string.class.js */ function queryString(name, defaultvalue) { //return the value of the named parameter from the page Url query = decodeURI(window.location.search); if ((nQueryPos = query.indexOf('?')) != -1) { //break out the name/value pairs into an array arNameValuePairs = query.substring(nQueryPos + 1).split('&'); //iterate over the array splitting the names and values, stopping when the name is matched (case-insensitively) for (n = 0; n < arNameValuePairs.length; n++) { arNameValuePair = arNameValuePairs[n].split('='); if (arNameValuePair[0].toLowerCase() == name.toLowerCase()) return arNameValuePair[1]; } } return defaultvalue; } // MessageBox.js // InfoCenter-Schedule.js var isIE_ = null; var isIE6_ = null; var isIE7_ = null; function setIEVersionInfo() { var browser = navigator.appName; var b_version = navigator.appVersion; var version = parseFloat(b_version); var MSIETag = b_version.indexOf("MSIE"); if (MSIETag > -1) { var EndTag = b_version.indexOf(";", MSIETag); version = parseFloat(b_version.substring(MSIETag + 4, EndTag)); } isIE_ = browser == "Microsoft Internet Explorer"; isIE6_ = (isIE_ && version < 7); isIE7_ = !isIE6_ && (isIE_ && version < 8); } function IsIE6() { if (null == isIE6_) setIEVersionInfo(); return isIE6_; } function IsIE7() { if (null == isIE7_) setIEVersionInfo(); return isIE7_; } function IsIE() { if (null == isIE_) setIEVersionInfo(); return isIE_; } function CheckObject(obj, bCheckOn) { if (IsIE6() || IsIE7()) { var attr = document.createAttribute("checked"); attr.value = "checked"; if (!bCheckOn) obj.attributes.removeNamedItem("checked"); else obj.setAttributeNode(attr); } if (!IsIE6()) obj.checked = bCheckOn; } // TreeControl.js // InfoCenter-Schedule.js function getPageSize() { var xScroll, yScroll; if (window.innerHeight && window.scrollMaxY) { xScroll = window.innerWidth + window.scrollMaxX; yScroll = window.innerHeight + window.scrollMaxY; } else if (document.body.scrollHeight > document.body.offsetHeight) { // all but Explorer Mac xScroll = document.body.scrollWidth; yScroll = document.body.scrollHeight; } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari xScroll = document.body.offsetWidth; yScroll = document.body.offsetHeight; } var windowWidth, windowHeight; // console.log(self.innerWidth); // console.log(document.documentElement.clientWidth); if (self.innerHeight) { // all except Explorer if (document.documentElement.clientWidth) { windowWidth = document.documentElement.clientWidth; } else { windowWidth = self.innerWidth; } windowHeight = self.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode windowWidth = document.documentElement.clientWidth; windowHeight = document.documentElement.clientHeight; } else if (document.body) { // other Explorers windowWidth = document.body.clientWidth; windowHeight = document.body.clientHeight; } // for small pages with total height less then height of the viewport if (yScroll < windowHeight) { pageHeight = windowHeight; } else { pageHeight = yScroll; } // console.log("xScroll " + xScroll) // console.log("windowWidth " + windowWidth) // for small pages with total width less then width of the viewport if (xScroll < windowWidth) { pageWidth = xScroll; } else { pageWidth = windowWidth; } // console.log("pageWidth " + pageWidth) arrayPageSize = new Array(pageWidth, pageHeight, windowWidth, windowHeight) return arrayPageSize; } function getAll(obj, theArray) { var children = obj.childNodes; if (null == children) return; for (var i = 0; i < children.length; i++) { if ("#text" != children[i].nodeName) { theArray.push(children[i]); getAll(children[i], theArray); } } } function AllChildren(obj) { if (null == obj) return null; if (obj.all) return obj.all; var allArray = new Array(); getAll(obj, allArray); return allArray; } function GetChildWithId(parent, findId) { var children = AllChildren(parent); var foundChild = null; for (var i = 0; i < children.length && !foundChild; i++) { if (children[i].id == findId) foundChild = children[i]; } return foundChild; } function FindObjectPosition(obj, stopObj) { var leftP = 0; var topP = 0; do { leftP += obj.offsetLeft; topP += obj.offsetTop; if (stopObj && stopObj == obj) break; } while (obj = obj.offsetParent); return [leftP, topP]; } function getLeaf(str) { /* Windows will not have forward slash in its path name. So check for it first. */ if (str.indexOf("/") > -1) { /* Not a Win32 path. We are in Mac. */ var arr = str.split("/"); if (arr.length >= 1) { str = arr[arr.length - 1]; } } else { var arr = str.split("\\"); if (arr.length >= 1) { str = arr[arr.length - 1]; } } return str; } /* C:\Margaret scan functions -- used on Backup tab and in the alert-backup-folders-discovered dialog. Note that these are dependent on functions in ServiceInterconnect.js which is not explicitly included here. */ function onchkAllowFolderScan() { serviceCall("/backup-discoverer?cmd=" + (crbBackupDiscoverer.checked ? "enable" : "disable")); } function onScanNow() { serviceCall("/backup-discoverer?cmd=scan"); } function ResizeWindow(windowAttributes, bUseCurrentPosition) { if (typeof(external.Redecorate) != 'undefined') { var attributes = windowAttributes; attributes += (bUseCurrentPosition) ? ";xpos=current;ypos=current;" : ""; external.Redecorate(attributes); } } // Show/hide the video. You'll need to call this before displaying any HTML popups on top of the // video area because Flash always wants to be on top of all HTML. function showRelaxVideo(bShow) { if (typeof ($f) != 'function') { return; } var pl = $f('crbPlayer1'); if (!pl) { return; } if (bShow === false) { pl.style.display = "none"; } else { pl.style.display = "block"; } } // When the close button on the popup header is clicked, this function gets called function doPopupCloseAction(elt) { //Walk up the DOM to get the parent DIV with class "InfoCenterPopup" function testFunction(el) { return usesClass(el, "InfoCenterPopup"); }; var parentElt = ancestorNode(elt, testFunction); if (undefined == parentElt || null == parentElt) return; //Find the crbCloseAction element within that div (can't use the ID since there may be multiple popups defined on one page) var arrChildren = parentElt.children; var closeActionElement = elementByAttribute("class", "crbCloseAction", arrChildren); //Click the crbCloseAction element if(undefined != closeActionElement) closeActionElement.click(); } //Format Days Left message function formatTimeLeft(daysLeft) { var strDay = "DAY"; var strDays = "DAYS"; var strYear = "YEAR"; var strYears = "YEARS"; var formattedTime, elt; if (null != (elt = top.document.getElementById("crbStrDay"))) { strDay = elt.innerText; } if (null != (elt = top.document.getElementById("crbStrDays"))) { strDays = elt.innerText; } if (null != (elt = top.document.getElementById("crbStrYear"))) { strYear = elt.innerText; } if (null != (elt = top.document.getElementById("crbStrYears"))) { strYears = elt.innerText; } if (Math.floor(daysLeft / 365) == 1) { formattedTime = 1 + " " + strYear + " " + (daysLeft % 365) + " " + strDays; } else if ((daysLeft / 365) >= 2) { formattedTime = Math.floor(daysLeft / 365) + " " + strYears + " " + (daysLeft % 365) + " " + strDays; } else { daysLeft = daysLeft % 365; // 1 day, 2 days, etc. var dayLabel = daysLeft == 1 ? strDay : strDays; formattedTime = daysLeft + " " + dayLabel; } return formattedTime; } /* End included file /scripts/commonfunctions.js */ function mouseCoords(ev) { if (ev.pageX || ev.pageY) { return { x: ev.pageX, y: ev.pageY }; } return { x: ev.clientX + document.body.scrollLeft - document.body.clientLeft, y: ev.clientY + document.body.scrollTop - document.body.clientTop }; } function getMouseOffset(target, ev) { ev = ev || window.event; var docPos = FindObjectPosition(target); var mousePos = mouseCoords(ev); return { x: mousePos.x - docPos[0], y: mousePos.y - docPos[1] }; } var dragCol = null; var dragRow = null; // old start drag to support file selector function StartDrag(obj) { dragRow = null; dragCol = new DragInfoOld(obj); } function StartColDrag() { dragRow = null; dragCol = new DragInfo(this); } function StartRowDrag() { HideLastTip(); dragCol = null; dragRow = new DragRow(new RowDataAccess(this, DisplayTable), dragTo); dragRow.UpdateCursor(event); } function DoDrag() { if (dragCol != null) { dragCol.MoveTo(event); } if (dragRow != null) { dragRow.UpdateCursor(event); } } function EndDrag() { dragCol = null; if (dragRow) dragRow.Drop(); dragRow = null; document.body.style.cursor = "default"; } var leftCol = null; var rightCols = null; /* End included file /scripts/draganddrop.js */ function GetTipRow() { var rowObj = event.srcElement; while (rowObj.nodeName.toLowerCase() != 'tr') rowObj = rowObj.parentNode; return rowObj; } function ShowMyTip() { var tipString = GetTipRow().getAttribute("tipstring"); ShowTipString(tipString); } function HideMyTip() { var tipString = GetTipRow().getAttribute("tipstring"); HideTipString(tipString); } Table = function(tableNode, onRowAdded, onRowRemoved) { this.onRowAdded = (undefined == onRowAdded) ? null : onRowAdded; this.onRowRemoved = (undefined == onRowRemoved) ? null : onRowRemoved; this.table = tableNode; this.tableBody = this.table.getElementsByTagName('tbody')[0]; this.columnMaps = new Object(); } Table.prototype.copyProperty = function(srcObj, targetObj, propertyName) { var val = srcObj[propertyName]; if (null != val && "" != val) targetObj[propertyName] = val; } Table.prototype.copyAttributes = function(srcObj, targetObj) { this.copyProperty(srcObj, targetObj, "className"); this.copyProperty(srcObj.style, targetObj.style, "backgroundImage"); this.copyProperty(srcObj, targetObj, "onmouseover"); this.copyProperty(srcObj, targetObj, "onmouseout"); this.copyProperty(srcObj, targetObj, "onmousedown"); this.copyProperty(srcObj, targetObj, "onmouseup"); this.copyProperty(srcObj, targetObj, "onclick"); this.copyProperty(srcObj, targetObj, "id"); for (var j = 0; j < srcObj.attributes.length; j++) { switch (srcObj.attributes[j].name) { case "filelastModified": case "tipstring": case "filePath": case "fileVersion": case "filesize": case "purgetime": case "filelastmodified": case "href": switch (srcObj.attributes[j].value) { case "null": case "": break; default: targetObj.setAttribute(srcObj.attributes[j].name, srcObj.attributes[j].value); break; } break; default: break; } } } // This may be a useful general method, but it seems to be only necessary when there appears to be // a problem specifically with IE7 adding rows that were part of one table as part of another table. // So for now, it's here so that it only included when you need it; but should we find other cases // where necessary then we should be able to move it to a general function collection Table.prototype.createCopy = function(srcObj) { var retObj = null; if ("#text" != srcObj.nodeName) { retObj = document.createElement(srcObj.nodeName); this.copyAttributes(srcObj, retObj); for (var i = 0; i < srcObj.childNodes.length; i++) retObj.appendChild(this.createCopy(srcObj.childNodes[i])); } else { retObj = document.createTextNode(srcObj.nodeValue); } return retObj; } Table.prototype.appendRow = function(rowObj) { /* There is a problem in IE7 where making the append of the child directly does not work, even though it does in IE8 Indeed, the same problem occurs if we clone the node. Therefore, we create a "hand-spun" copy of the row, and append that instead. */ var rowAdded = rowObj; try { this.tableBody.appendChild(rowObj); // works in IE8 & Safari, just won't in IE7, also tried appending a clone, still won't work (very generic object does not support this method error) } catch (e) { // ignore error, create a "hand-spun" copy to avoid the error rowAdded = this.createCopy(rowObj); this.tableBody.appendChild(rowAdded); // remove the original row from its parent; so that the behaviour is the same rowObj.parentNode.removeChild(rowObj); } // returning the row that is added is important in case we were assuming we'd retain a reference to the actual row in question return rowAdded; } Table.prototype.AddRow = function(rowObj) { var rowAdded = this.appendRow(rowObj); var tipString = rowObj.getAttribute("tipstring"); rowObj.onmouseover = ShowMyTip; rowObj.onmouseout = HideMyTip; if (this.onRowAdded) this.onRowAdded(rowObj); return rowAdded; } Table.prototype.RemoveRow = function(rowObj) { this.tableBody.removeChild(rowObj); if (this.onRowRemoved) this.onRowRemoved(rowObj); } Table.prototype.ClearData = function() { var rows = this.tableBody.getElementsByTagName('tr'); for (var i = rows.length - 1; i > 0; i--) // don't remove first row - that's the one with the headers this.RemoveRow(rows[i]); } Table.prototype.ColumnIndexOf = function(id) { return this.columnMaps[id]; } Table.prototype.MakeResizable = function() { var headers = this.table.getElementsByTagName('TH'); var lastResize = false; for (var i = 0; i < headers.length; i++) { if (headers[i].id) this.columnMaps[headers[i].id] = i; if (lastResize) { if (headers[i].className.indexOf('leftBump') < 0) headers[i].className += ' leftBump'; } lastResize = headers[i].className.indexOf('resize') > -1; if (lastResize) { var dragIndicator = document.createElement('span'); dragIndicator.className = "draggerIndicator"; var dragger = document.createElement('span'); dragger.className = "dragger"; dragger.onmousedown = StartColDrag; dragger.appendChild(dragIndicator); headers[i].appendChild(dragger); } } // Now add the functions to allow the dragging document.body.onmouseup = function() { EndDrag(); } document.body.onmousemove = function() { DoDrag(); } } /* End included file /scripts/table.class.js */ /* Carbonite Service included file /scripts/serviceinterconnect.js */ // (c) Carbonite, Inc., 2005-2009 All rights reserved /* Carbonite Service included file /scripts/serviceinterconnect.class.js */ // (c) Carbonite, Inc., 2005-2009 All rights reserved /* Carbonite Service SKIPPING already included file /scripts/string.class.js */ /* Carbonite Service included file /scripts/domhelper.js */ // (c) Carbonite, Inc., 2005-2009 All rights reserved /* Carbonite Service SKIPPING already included file /scripts/commonfunctions.js */ //shows or removes the element from the flow //note: block/inline is not required if you use //SPAN for inline, DIV for block function showElement(el, show) { if (undefined == show) show = true; el.style.display = show ? '' : 'none'; } //use this function when you want the element space //to remain, whether it is visible or not function visibleElement(el, visible) { if (undefined == visible) visible = true; el.style.visibility = visible ? 'visible' : 'hidden'; } function elementsByClass(className, elements) { var results = new Array(); if (undefined == elements) { elements = document.all; } for (var n = 0; n < elements.length; n++) { if (usesClass(elements[n], className)) { results.push(elements[n]); } } return results; } /* * return the element(s) having a given attribute/value combination * (either from the whole doc or a set of elements) */ function elementsByAttribute(attrName, attrValue, elements) { var results = new Array(); if (undefined == elements) elements = document.all; for (var n = 0; n < elements.length; n++) { var attr = null == elements[n].attributes ? null : elements[n].attributes[attrName]; if (null != attr && attr.value == attrValue) results.push(elements[n]); } return results; } function elementByAttribute(attrName, attrValue, elements) { var results = elementsByAttribute(attrName, attrValue, elements); switch (results.length) { case 1: return results[0]; case 0: return undefined; default: return results; } } function nodeById(root, id) { for (var n = 0; n < root.all.length; n++) { if (root.all[n].id == id) { return root.all[n]; } } return null; } function element(name) { return document.getElementById(name); } function setAttribute(el, attr, value) { try { el.setAttribute(attr, value); } catch (e) { logException("DomHelper setAttribute : ", e); } } function attribute(el, attr) { try { var oAttr = el.attributes[attr]; return oAttr ? oAttr.value : ""; } catch (e) { logException("DomHelper attribute : ", e); return ""; } } function frobClassName(el, remove, add) { if (null == el) return; dropClass(el, remove); useClass(el, add); } /* * remove any of the space-separated classes from the given element's className */ function dropClass(el, classList) { var dropClasses = classList.split(' '); var classes = el.className.split(' '); for (var nDrop = 0; nDrop < dropClasses.length; nDrop++) { for (var nClass = 0; nClass < classes.length; nClass++) { if (dropClasses[nDrop].toLowerCase() == classes[nClass].toLowerCase()) classes[nClass] = ''; } } classes.sort(); el.className = classes.join(' ').replace(/ /g, ''); } /* * add the class to the element's classname if not already in the list */ function useClass(el, className) { if (usesClass(el, className)) return; var classes = el.className.split(' '); classes.push(className); el.className = classes.join(' '); } function usesClass(el, className) { var classes = el.className.split(' '); for (var n = 0; n < classes.length; n++) { if (className.toLowerCase() == classes[n].toLowerCase()) return true; } return false; } // Determines if an element uses any of the classes specified in classNames. // classNames can be either a space-delimited list of class names, or an array // of class names. function usesAnyClass(el, classNames) { var classNamesArray; if (typeof (classNames) == 'string') { classNamesArray = classNames.split(' '); } else if (classNames instanceof Array) { classNamesArray = classNames; } else { return false; } for (var i = 0; i < classNamesArray.length; i++) { if (usesClass(el, classNamesArray[i])) { return true; } } return false; } function ancestorNodeById(node, id) { while (node) { if (node.id.indexOf(id) == 0) return node; node = node.parentElement; } return null; } /* Find an ancestor node that meets the specified test criteria. testFunction must take an element as a parameter */ function ancestorNode(node, testFunction) { while (node) { if (testFunction(node)) return node; node = node.parentElement; } return null; } // Array of functions that will get called when the DOM is ready. var OnDOMReadyNotifications__ = new Array(); // Registers a function that'll get called when the DOM is ready. This is currently // only implemented for IE. // // Create a "defer" script element and wait for it to go to the "complete" // readyState. When that happens, call all of the functions that have been // registered. function onDomReady(func) { if (!IsIE()) { log("onDomReady only implemented for IE"); return; } var id = "__crb_dom_ready"; var script = document.getElementById(id); if (script == undefined) { document.write("