// (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("<script id=" + id + " defer src=javascript:void(0)><\/script>");
script = document.getElementById(id);
script.onreadystatechange = function() {
if (this.readyState == "complete") {
for (var i = 0; i < OnDOMReadyNotifications__.length; i++) {
var f = OnDOMReadyNotifications__[i];
f();
}
}
};
}
OnDOMReadyNotifications__.push(func);
}
// For cases where you want to debug what's going on with keyboard focus. It overwrites all
// onfocus handlers for all elements in the document. When an element receives focus,
// it calls logDetail with the values.
function hookFocusForDebug() {
for (var i = 0; i < document.all.length; i++) {
document.all[i].onfocus = function() {
var s;
if (this.id) {
s = this.id;
}
else if (this.className && this.className != "") {
s = this.className;
}
else if (this.href) {
s = this.href;
}
else if (this.innerHTML) {
s = this.innerHTML;
}
else if (this.tagName) {
s = this.tagName;
}
else if (this.document && this.frame && this.history && this.location) {
// this seems to happens sometimes.
s = 'window object (probably)';
}
logDetail("Focus is on " + s);
}
}
}
/* End included file /scripts/domhelper.js */
/* Carbonite Service included file /scripts/logging.js */
// (c) Carbonite, Inc., 2005-2009 All rights reserved
//Log priorities from LogMsg.h
var LM_TIMESTAMP = 0;
var LM_TRACE = 1;
var LM_DETAIL = 2;
var LM_STANDARD = 3;
var LM_STARTUP = 4; //ignored
var LM_SHUTDOWN = 5; //ignored
var LM_WARNING = 6;
var LM_ERROR = 7;
var LM_FATAL = 8; //ignored
function trace(text)
{
try
{
external.Trace(text);
}
catch (nothing)
{
}
}
var reportErrors = true;
function log(text, priority)
{
try
{
if (typeof(external.LogMsg) == "undefined")
{
if (reportErrors && LM_ERROR == priority)
reportErrors = confirm('LogError:' + text + "\nClick OK to see further errors");
}
else
external.LogMsg(priority == undefined ? LM_STANDARD : parseInt(priority), text);
}
catch (nothing)
{
}
}
function logTime()
{
log('', LM_TIMESTAMP);
}
function logError(text)
{
log(text, LM_ERROR);
}
function logWarning(text)
{
log(text, LM_WARNING);
}
function logDetail(text)
{
log(text, LM_DETAIL);
}
function logTrace(text)
{
log(text, LM_TRACE);
}
function logException(text, e)
{
logError(text + ': ' + e.description + ':' + e.number);
}
/* End included file /scripts/logging.js */
/* Carbonite Service included file /js/config.js */
// (c) Carbonite, Inc., 2005-2011 All rights reserved
var Config__ = function ()
{
var self = this;
// Enable various debugging/diagnostics?
//
this.isDebug = function ()
{
return false;
}
// How many days left before we hide the number of days left? If the
// number of days left in the subscription is more than this value, the
// UI elements will be hidden.
//
this.getHideDaysLeftMessageDays = function ()
{
// 20 years, which effectively means that it'll always display.
//
return 20 * 365;
}
// Number of days left in the subscription before we show the "Renew now"
// button.
//
this.getRenewalDays = function ()
{
return 60;
}
// Return true to show the "Support" tab in Info Center.
// @todo As it stands, this is not ever used (the code that refs it is
// never called.
//
this.getExternalSupport = function ()
{
return false;
}
// Should we hide the purchase-related options (e.g. Buy now, Renew now, sub expires on date).
//
this.hidePurchaseOptions = function ()
{
var hidePurchaseOptions = false;
purchaseOption = document.getElementById('crbBuyFeature');
if (purchaseOption != undefined)
{
hidePurchaseOptions = (parseInt(purchaseOption.innerText) == 0);
}
return hidePurchaseOptions;
}
// Should we use our more advanced number formatting options?
//
this.useNumberFormatting = function ()
{
return true;
}
// What's the thousands separator (e.g. 10,000).
//
this.thousandsSeparator = function ()
{
return ",";
}
// What's the decimal seprator (e.g. 10.03).
//
this.decimalSeparator = function ()
{
return ".";
}
}
var Config = new Config__();
// When running in debug mode, make sure that there are no duplicate ID values.
//
if (Config.isDebug())
{
jQuery(document).ready(function ($) {
var counts = {};
var elements = document.all;
for (var i = 0; i < elements.length; i++)
{
var element = elements[i];
if (element.id != null && element.id.length > 0)
{
if (counts[element.id] == null)
counts[element.id] = 1;
else counts[element.id]++;
}
}
for (var id in counts)
{
if (id.length > 0 && counts[id] > 1)
alert("duplicate id: " + id);
}
});
}
/* End included file /js/config.js */
// Functions for dealing with the fact that there may exist multiple ServiceInterconnect objects
// on a single HTML page and for dealing with the fact that there may be multiple ServiceConfigItem
// elements that refer to the same variable.
//
var STOPALLINTERCONNECTS = false;
var __ServiceInterconnectElementCache = function ()
{
var self = this;
// For each fact that we receive might need to update multiple elements in
// the DOM. We don't want to go searching through the entire DOM for each
// fact we receive...so we store a cache of the name -> elements. We use
// this targetElementsCache_ as a "map". The key for the map is the name, the value
// is and array of DOM elements that have that name.
//
var targetElementsCache_ = {};
// Determines if el has a class of HiddenServiceConfigItem or VisibleServiceConfigItem.
//
function isServiceConfigItem(el)
{
var el$ = $(el);
return el$.hasClass('HiddenServiceConfigItem') || el$.hasClass('VisibleServiceConfigItem');
}
// Searches through the DOM for elements where attr=value *and* that
// have class="Hidden|VisibleServiceConfigItem".
//
function getServiceConfigElements(attr, value, targets)
{
var elements = elementsByAttribute(attr, value);
for(var i = 0; i < elements.length; i++)
{
var el = elements[i];
if(isServiceConfigItem(el))
targets.push(el);
}
}
// Sets the value (val) on the target DOM element. Special
// handling for checkbox and input elements.
//
function setValueInDOM(target, val)
{
//don't fail since page may not use the returned value
if(null == target)
{
}
else if(target.type == "checkbox")
{
if(val == "0" || val == "1")
target.checked = val == "1";
}
else if(target.nodeName.toLowerCase() == "input")
target.value = val;
else
target.innerHTML = val;
}
// Returns the array of DOM ServiceConfigItem elements that have the given id.
//
// Handles elements of the form:
//
// <span data-crbid="crbID" class="VisibleServiceConfigItem"/>
// <span data-crbid="ID" class="VisibleServiceConfigItem"/>
// <span id="crbID" class="VisibleServiceConfigItem"/>
// <span id="ID" class="VisibleServiceConfigItem"/>
//
// (Note the class can be either VisibleServiceConfigItem or
// HiddenServiceConfigItem).
//
// Uses targetElementsCache_ so it doesn't have to scan through the DOM every time
// it's called. If we've never been asked for 'id' before, then
// search through the DOM to see if we can find any elements that
// match (and store the result in the targetElementsCache_ for speedy access
// next time).
//
this.getTargetElementsForID = function (id)
{
id = id.replace(/^crb/, "");
var targets = targetElementsCache_[id];
if (null == targets)
{
targets = new Array();
getServiceConfigElements('data-crbid', 'crb' + id, targets);
getServiceConfigElements('data-crbid', id, targets);
var el = document.getElementById('crb' + id);
if(null != el && isServiceConfigItem(el))
targets.push(el);
el = document.getElementById(id);
if(null != el && isServiceConfigItem(el))
targets.push(el);
targetElementsCache_[id] = targets;
}
return targets;
}
// Stores value in all of the VisibleServiceConfigItem and
// HiddenServiceConfigItem DOM elements that have a matching id.
//
this.putValue = function (id, value)
{
// It'd be a problem for us if the caller is trying to use us before the
// DOM is ready since we rely on it for value storage.
//
if(!jQuery.isReady && Config.isDebug())
alert('ServiceInterconnect being used before DOM isReady');
var elements = self.getTargetElementsForID(id);
for(var i = 0; i < elements.length; i++)
{
setValueInDOM(elements[i], value);
}
}
}
var ServiceInterconnectElementCache = new __ServiceInterconnectElementCache();
ServiceInterconnect = function (args)
{
//Required args: name
//Optional args: items (default: all), onPush
//top.logTrace("ServiceInterconnect::ServiceInterconnect(" + args.interval + "," + args.uri + ")", false);
if(args.name == undefined)
{
throw "Must specify name!";
}
if(args.onPush == undefined)
{
args.onPush = null;
}
if(args.items == undefined)
{
args.items = null;
}
var self = this;
this.args = args;
this.internalStart = function ()
{
try
{
window.external.MonitorServiceState(self.args.name, self.observer, self.args.items);
}
catch(e)
{
// don't error in browser; gets in the way of debugging
}
}
this.internalStop = function ()
{
try
{
window.external.MonitorServiceState(self.args.name, null, "");
}
catch(e)
{
// don't error in browser; gets in the way of debugging
}
}
this.doPush = function (node)
{
try
{
if(self.args.onPush)
{
self.args.onPush(node);
}
}
catch(e)
{
// Need to ignore problems when push handlers fail
// Usually we have pulled the dom elements out of the document
// but the handler still tries to access them
if(Config.isDebug())
{
alert("Push handler threw exception: " + e.message);
}
}
}
this.observer = function (data)
{
if(STOPALLINTERCONNECTS)
return;
// Update all of the targets (elements) for each fact we've been
// sent. Note that there may be multiple elements for each fact.
// (Multiple elements may have the same data-crbid attribute.)
//
var facts = data.split('|');
for(n = 0; n < facts.length; n++)
{
var parts = facts[n].splitOnFirst('=');
var name = parts[0];
if(name.length < 1)
continue;
var val = parts[1];
// Update the cache with the new value.
//
ServiceInterconnectElementCache.putValue(name, val);
//now the pushHandler - if there is one
if(self.args.onPush)
{
var node = document.createElement("p");
node.id = name;
node.innerHTML = val;
self.doPush(node);
}
}
}
return this;
}
ServiceInterconnect.prototype.start = function (src)
{
this.InitialPushHandler();
setTimeout(this.internalStart, 0);
}
ServiceInterconnect.prototype.stop = function (src)
{
setTimeout(this.internalStop, 0);
}
ServiceInterconnect.prototype.InitialPushHandler = function()
{
if (this.args.onPush && this.args.items)
{
var itemList = this.args.items.split(",");
for (var i = 0; i < itemList.length; i++)
{
var nodes = ServiceInterconnectElementCache.getTargetElementsForID (itemList[i]);
for (var j = 0; j < nodes.length; j++)
{
var node = nodes[j];
var tempNode = document.createElement('p');
tempNode.id = itemList[i];
if (node.type == "checkbox")
tempNode.innerHTML = ((node.value == "on") ? "1" : "0");
else if (node.nodeName.toLowerCase() == "input")
tempNode.innerHTML = node.value;
else
tempNode.innerHTML = node.innerHTML;
this.doPush(tempNode);
}
}
}
}
/* End included file /scripts/serviceinterconnect.class.js */
/* Carbonite Service included file /scripts/traperror.js */
// (c) Carbonite, Inc., 2005-2009 All rights reserved
// This message will trap any script errors
function trapError(message, url, line)
{
// ensure that we eat the error even if the log fails
try
{
logError(url + "(" + line + ") : " + message);
}
catch (e)
{
}
return true;
}
window.onerror = trapError;
/* End included file /scripts/traperror.js */
/* Carbonite Service SKIPPING already included file /scripts/logging.js */
// backup states - from the CarboniteServiceTypes header
var Backup_State_Undefined = 0;
var Backup_State_Registration = 10;
var Backup_State_Stopped = 20;
var Backup_State_Startup = 25;
var Backup_State_Sleeping = 30;
var Backup_State_Starting = 40;
var Backup_State_Awaiting_Connection = 50;
var Backup_State_Awaiting_Server = 60;
var Backup_State_Scanning = 70;
var Backup_State_Transfering = 80;
var Backup_State_Finishing = 90;
// service states - from the CarboniteServiceTypes header
var Service_State_Undefined = 0;
//the following states indicate normal actiity
var Service_State_Normal_First = 1;
var Service_State_Registration = 2;
var Service_State_Initial_Backup = 3;
var Service_State_Restoring = 4;
var Service_State_Backup_Pending = 5;
var Service_State_Backing_Up = 6;
var Service_State_Scanning = 7;
var Service_State_Idle = 8;
var Service_State_Normal_Last = 9;
//the following states all require attention of the user
var Service_State_Alert_First = 10;
var Service_State_Alert_No_Service = 11;
var Service_State_Alert_Disabled = 12;
var Service_State_Alert_Paused = 13;
var Service_State_Alert_Retry = 14;
var Service_State_Alert_Bad_Config = 15;
var Service_State_Alert_Account_Disabled = 16;
var Service_State_Alert_Over_Quota = 17;
var Service_State_Alert_No_Internet = 18;
var Service_State_Alert_No_Server = 19;
var Service_State_Alert_Backup_Failed = 20;
var Service_State_Alert_Subscription_Expired = 21;
var Service_State_Alert_Backup_Overdue = 22;
var Service_State_Alert_Operations_Msg = 23;
var Service_State_Alert_Upgrade_Available = 24;
var Service_State_Alert_Recover_Mode = 25;
var Service_State_Alert_MissingVolumes = 26;
var Service_State_Alert_MissingFiles = 27;
var Service_State_Alert_Restore_Paused = 28;
var Service_State_Alert_Account_Over_Quota = 29;
var Service_State_Alert_MissingNetworkDrive = 30;
var Service_State_Alert_Last = 31;
var Service_State_Last = 32;
var ifrPoster = null;
function ServicePut(name, value)
{
//not yet - need to refactor first to make the trace function available
//logDetail('request to put ' + name + '=' + value);
//create posting frame?
if (!ifrPoster)
{
ifrPoster = document.createElement("iframe");
ifrPoster.style.visibility = "hidden";
ifrPoster.style.border = "0px";
ifrPoster.style.height = "0px";
ifrPoster.style.width = "0px";
body = document.getElementsByTagName("body")[0];
body.appendChild(ifrPoster);
}
ifrPoster.src = "/put-state.htm?" + name + "=" + value;
}
function serviceCall(requestURI, resultsHandler)
{
resultsHandler = undefined == resultsHandler ? null : resultsHandler;
var dc = new DeferredCall(requestURI, resultsHandler);
}
function DeferredCall(uri, resultsHandler)
{
var self = this;
self.resultsHandler = resultsHandler;
//create a frame to contain the call
self.ifrCall = document.createElement("iframe");
self.ifrCall.style.visibility = "hidden";
self.ifrCall.style.border = "0px";
self.ifrCall.style.height = "0px";
self.ifrCall.style.width = "0px";
self.body = document.getElementsByTagName("body")[0];
self.body.appendChild(self.ifrCall);
self.onreadystatechange = function()
{
window.status = self.ifrCall.src + ':' + self.ifrCall.readyState;
//wait for interactive on async calls, complete on sync - we need the reply on the latter
if ((null != self.resultsHandler && self.ifrCall.readyState == "complete") || (null == self.resultsHandler && self.ifrCall.readyState == "interactive"))
{
self.ifrCall.onreadystatechange = null;
//call the results handler, if there is one
if (null != self.resultsHandler)
{
self.resultsHandler(self.ifrCall.contentWindow.document.body);
}
self.body.removeChild(self.ifrCall);
}
}
self.ifrCall.onreadystatechange = self.onreadystatechange;
self.ifrCall.src = uri;
}
/* End included file /scripts/serviceinterconnect.js */
/* Carbonite Service included file /js/navigation.js */
// (c) Carbonite, Inc., 2005-2009 All rights reserved
/* Carbonite Service SKIPPING already included file /scripts/serviceinterconnect.js */
/* Carbonite Service SKIPPING already included file /scripts/commonfunctions.js */
/* Carbonite Service SKIPPING already included file /js/config.js */
var Navigation__ = function ()
{
var self = this;
/* InfoCenter-Nav.js
(1) Controls the buttons in the InfoCenter sidebar
(2) Controls the display of content in the InfoCenter content IFRAME
(3) Opens external links
*/
/* Default parameters for IE windows opened by the InfoCenter */
var strDefaultOpenURLParams = "height=600,width=1000,left=0,top=0,scrollbars=yes,location=yes,status=yes";
// AccountIsTrial and nExpiryDays are also used from alert.js
this.AccountIsTrial = false;
this.nExpiryDays = 0;
var arrEltsByTabIndex = new Array();
function getQueryString()
{
//return the entire query string
var query = decodeURI(window.location.search);
if((nQueryPos = query.indexOf('?')) != -1)
{
return query.substring(nQueryPos + 1);
}
return undefined;
}
function autoDecorateURL(strURL)
{
// protect around COM call to autodecorate the url. We'll fail silently, so that at least the undecorated url gets processed
var strDecoratedURL;
try
{
strDecoratedURL = external.DecorateURL(strURL);
}
catch(err)
{
try
{
external.LogMsg(7/*LM_ERROR*/, "Exception while decorating url; will decorate with any queryString paramters that already exist - description:" + err.description);
}
catch(err2)
{
}
// we know that the external.DecorateURL could not get called - a real scenario for this is
// when we've opened up a local page in a separate browser window (non InfoCenter window).
// In that case, there is the real possibility that there are links that use the autodecorate
// parameters therein, and so we should redecorate those here
strDecoratedURL = appendQueryString(strURL, getQueryString());
}
return strDecoratedURL;
}
function autoDecorateParams(params)
{
var fakeUrl = "?" + params; // in order to avoid automatically adding the ?
var decorated = autoDecorateURL(fakeUrl);
return decorated.substring(1);
}
function navigateToURL(url)
{
// check for typeof(external.NavigateToUrl) does not work on all broswers - throws exception, so the only real way to handle it is to try and catch when a problem
try
{
external.NavigateToUrl(url);
}
catch(e)
{
window.open(url, '_blank', strDefaultOpenURLParams);
}
}
/* Lil' helper function to make sure we have the right number of ?s and &s in our query strings*/
function appendQueryString(strURL, strQueryString)
{
var url = strURL;
if(undefined != url)
{
//Check to see whether the URL already has parameters appended to it. If so, use an ampersand instead of a question mark to append additional parameters
if(undefined != strQueryString)
url += (strURL.indexOf("?") == -1) ? "?" + strQueryString : "&" + strQueryString;
}
return url;
}
function parseURL(strURL, blnSSL)
{
if(strURL == "")
{
return undefined;
}
// If the URL starts with HTTP or is a FILE specification, use it as is
if(strURL.substring(0, 4).toLowerCase() == "http" || strURL.substring(0, 5).toLowerCase() == "file:")
{
return strURL;
}
else // Prepend the protocol string and download server
{
var strProtocol = (blnSSL == 1) ? "https://" : "http://";
if(strURL.substring(0, 1) != "/")
{
strURL = "/" + strURL;
}
var strServer = getServer();
if(strServer != undefined)
return strProtocol + strServer + strURL;
}
return undefined;
}
function isStringUndefinedOrEmpty(str)
{
return str == undefined || str.length == 0;
}
// Returns the "download server" to use. The value is taken from the crbDownloadServer
// element, if it exists. If it doesn't exist or has an empty value, we make a check
// for crbDefaultDownloadServer. We don't use crbDefaultDownloadServer in the standard
// skin, but it could be specified by a partner. If none of this yields a server, we'll
// fallback to using www.carbonite.com. That's about the best we can do here.
// This fixes WC-2593 (along with all other issues where a download server is needed
// before we get one from the service interconnect).
function getServer()
{
var strServer = getServiceVariable("crbDownloadServer");
if(isStringUndefinedOrEmpty(strServer))
{
strServer = getServiceVariable("crbDefaultDownloadServer");
if(isStringUndefinedOrEmpty(strServer))
{
strServer = "www.carbonite.com";
}
}
return strServer.toLowerCase();
}
function getServiceVariable(strVarName)
{
if(null != (elt = top.document.getElementById(strVarName)))
return elt.innerHTML;
return undefined;
}
function updateBuyStatus()
{
var showBuy = false;
var showRenew = false;
var showDaysLeft = false;
if(Config.hidePurchaseOptions() || isNaN(self.AccountIsTrial) || isNaN(self.nExpiryDays))
{
// Don't display anything.
//
}
else
{
var bAccountIsTrial = self.AccountIsTrial;
if(bAccountIsTrial)
{
// For trials, always show the buy button.
//
showBuy = true;
}
else
{
// This is a paid account, hide the Buy button and decide whether to show the Renew button.
//
if(self.nExpiryDays <= Config.getRenewalDays())
{
showRenew = true;
}
}
// Decide whether to display Days Left message based on number of days left in subscription
if(self.nExpiryDays < Config.getHideDaysLeftMessageDays())
{
showDaysLeft = true;
}
if(showDaysLeft)
{
var elt;
// Different expiration text for trial vs. paid account.
//
if(null != (elt = document.getElementById('crbTrialTimeLeftMessage')))
{
if(self.nExpiryDays <= 0)
{
elt.style.display = 'none';
}
else
{
elt.style.display = bAccountIsTrial ? 'inline' : 'none';
}
}
if(null != (elt = document.getElementById('crbSubTimeLeftMessage')))
{
if(self.nExpiryDays <= 0)
{
elt.style.display = 'none';
}
else
{
elt.style.display = bAccountIsTrial ? 'none' : 'inline';
}
}
}
}
var elt;
if(null != (elt = document.getElementById('crbBuyNow')))
elt.style.display = showBuy ? 'block' : 'none';
if(null != (elt = document.getElementById('crbRenewNow')))
elt.style.display = showRenew ? 'block' : 'none';
if(null != (elt = document.getElementById('crbDaysLeftMessage')))
elt.style.display = showDaysLeft ? 'block' : 'none';
}
// publically exposed functions
// @todo Is initialise ever used?
//
this.initialise = function ()
{
try
{
var getSupport = document.getElementById("support");
var getHelp = document.getElementById("GetHelp");
if(Config.getExternalSupport())
{
getSupport.style.display = "none";
getHelp.style.display = "inline";
}
else
{
getSupport.style.display = "inline";
getHelp.style.display = "none";
}
}
catch(e)
{
}
}
this.openURL = function (strURL, strQueryString, blnSSL)
{
var baseURL = parseURL(strURL, blnSSL);
if(undefined != baseURL)
{
var url = baseURL;
url = appendQueryString(url, strQueryString);
url = autoDecorateURL(url);
navigateToURL(url);
}
}
/* Open one of the external links that is managed via the ClientUIRedirect table */
this.openExternalURL = function (keyword, params, blnSSL)
{
var urlRedirect = self.getExternalURL(keyword, params);
if(undefined != urlRedirect)
{
self.openURL(urlRedirect, null, blnSSL);
}
else
{
logError("openExternalURL(): Couldn't open URL for " + keyword);
}
}
/* Get a fully-specified URL for one of the links that is managed via the ClientUIRedirect table
* "keyword" is the value that will be looked up in the ClientUIRedirect table
* "params" is a query string to be passed to the destination URL, e.g. name1=value1&name2=value2. Don't worry about URI-encoding since this function will handle it
* "autodecorate" specifies whether we should add the standard parameters (skinid and computeruid). If you are passing the result of this function to openURL, set it to false
*/
this.getExternalURL = function (keyword, params, autodecorate)
{
if(undefined == params)
params = "";
/* The redirect URL takes three parameters: a content keyword (where), a URI-encoded query string (querystring)
and the computer UID (computeruid) which gets automatically appended by autoDecorateURL */
var strRedirectURL = getServiceVariable("crbRedirectURL");
if((undefined != strRedirectURL) && (undefined != keyword) && ("" != keyword))
{
/* Expand to a fully-specified URL from a relative one */
var url = parseURL(strRedirectURL);
/* Add the standard parameters, skinid and computeruid if the autodecorate parameter is set */
if(autodecorate)
url = autoDecorateURL(url);
/* Add any additional specified parameters (params) */
var strQueryString = "&querystring=" + encodeURIComponent(autoDecorateParams(params));
url = appendQueryString(url, "where=" + keyword + strQueryString);
return url;
}
else
{
if(undefined == strRedirectURL)
logError("getExternalURL(): Couldn't get URL for " + keyword + " because crbRedirectURL is undefined. Check the HTML to ensure that it includes a span with id 'crbRedirectURL'");
else
logError("getExternalURL(): Called without specifying a keyword");
return undefined;
}
}
/* Go to online account management pages */
this.openManage = function ()
{
var strEmail = getServiceVariable("crbUserEmail");
var strQueryString = "";
if(strEmail != undefined)
{
strQueryString = "email=" + strEmail; // params get autodecorated within openExternalUrl
}
self.openExternalURL('accountmanagement', strQueryString, 1);
}
/* Change email or password */
this.changeAccountInfo = function (param)
{
var strEmail = getServiceVariable("crbUserEmail");
var strQueryString = "edit=" + param;
if(strEmail != undefined)
{
strQueryString += "email=" + strEmail;
}
self.openExternalURL('changeaccountinfo', strQueryString, 1);
//After 2 minutes, log in to update the account info
setTimeout("loginNow()", 2 * 60 * 1000);
}
/* Go to online order pages */
this.openOrder = function (sFrom)
{
/* Set query string parameters */
var strQueryString = "from=" + sFrom;
if(self.AccountIsTrial != undefined)
{
strQueryString += "&isTrial=" + self.AccountIsTrial;
}
self.openExternalURL('purchase', strQueryString, 1);
}
/* Go to Refer-a-friend signup page */
this.openRAF = function ()
{
var strEmail = getServiceVariable("crbUserEmail");
// define a query string even if strEmail is blank, because we want to pass something through
// params in order to get decorated values (computerid, skinid, etc.)
var strQueryString = "email=" + strEmail;
self.openExternalURL('referafriend', strQueryString, 0);
}
/* Open Live Chat session -- strSource tells us where the chat session was initiated */
this.openChat = function (strSource)
{
var strQueryString = "source=" + strSource;
self.openExternalURL('livechat', strQueryString, 0);
}
this.CommonPushHandler = function (node)
{
try
{
if(node.id == "SubscriptionInfo")
{
var subInfo = ObjectJSON(node.innerText);
self.nExpiryDays = subInfo.ExpiryDays;
self.AccountIsTrial = subInfo.AccountIsTrial;
updateBuyStatus();
}
}
catch(e)
{
if(Config.isDebug())
{
alert(e.message);
}
}
}
}
var Navigation = new Navigation__();
// global functions used within html pages
/* Fire an element's click event using the Enter key or Spacebar */
function fireClick(elt)
{
var key;
if (window.event)
{
key = window.event.keyCode;
} //IE only
// Fire a click when either the enter key or the spacebar key is pressed
if ((key == ENTER) || (key == SPACEBAR))
{
if (elt != null)
{ //If we find the button click it
elt.click();
event.keyCode = 0;
}
}
}
/* Fire a tab event when Down or Right arrow is pressed, and a SHIFT-tab event when Up or Left arrow is pressed */
function fireTab()
{
var key;
var elt = window.event.srcElement;
if (window.event)
{
key = window.event.keyCode;
} //IE only
// Fire a tab when Down or Right arrow is pressed
if ((key == DOWN_ARROW) || (key == RIGHT_ARROW))
{
if (elt.tabIndex < arrEltsByTabIndex.length + 1)
event.keyCode = TAB;
else
event.keyCode = 0;
}
else if ((key == UP_ARROW) || (key == LEFT_ARROW))
{
var prevIndex = elt.tabIndex - 1;
if (prevIndex > 0)
arrEltsByTabIndex[prevIndex].focus();
event.keyCode = 0;
event.cancelBubble = true;
}
}
// Global called by C++ code
function onEmailSent(vResult)
{
document.getElementById('crbEmailResult').value = vResult;
}
/* End included file /js/navigation.js */
/* Carbonite Service included file /js/schedule.js */
// (c) Carbonite, Inc., 2005-2009 All rights reserved
/* Carbonite Service included file /scripts/schedule.class.js */
// (c) Carbonite, Inc., 2005-2009 All rights reserved
/* Carbonite Service included file /scripts/box.class.js */
// (c) Carbonite, Inc., 2005-2009 All rights reserved
box = function()
{
this.obj;
this.GetObject = function()
{
return this.obj;
}
this.SetObject = function(ob)
{
this.obj = ob;
}
}
/* End included file /scripts/box.class.js */
/* Carbonite Service SKIPPING already included file /scripts/commonfunctions.js */
var BACKUP_TYPE = "BackupType";
var START_HOUR = "StartHour";
var START_MINUTE = "StartMinute";
var START_AP = "StartAP";
var BACKUP_UNTIL = "BackupUntil";
var FINISH_HOUR = "FinishHour";
var FINISH_MINUTE = "FinishMinute";
var FINISH_AP = "FinishAP";
var ONCE_HOUR = "OnceHour";
var ONCE_MINUTE = "OnceMinute";
var ONCE_AP = "OnceAP";
var SSTART_HOUR = "SStartHour";
var SSTART_MINUTE = "SStartMinute";
var SSTART_AP = "SStartAP";
var SFINISH_HOUR = "SFinishHour";
var SFINISH_MINUTE = "SFinishMinute";
var SFINISH_AP = "SFinishAP";
var DAYS = "Days";
var NVSEP = ":";
var SEP = ";";
var DAYCHOICE = "DayChoice";
var SPECDAY_SUN = "SpecDaySun";
var SPECDAY_MON = "SpecDayMon";
var SPECDAY_TUE = "SpecDayTue";
var SPECDAY_WED = "SpecDayWed";
var SPECDAY_THU = "SpecDayThu";
var SPECDAY_FRI = "SpecDayFri";
var SPECDAY_SAT = "SpecDaySat";
var TimeControl = function (timeName, hr, min, processChange)
{
var theHTML = "";
hourName = timeName + "Hour";
minuteName = timeName + "Minute";
apName = timeName + "AP";
// 24-hour cloc hour selection
var HH = '<select name="' + hourName + '" onchange="' + processChange + '">';
for(i = 0; i < 24; i++)
HH += '<option value="' + i + '" ' + ((hr == i) ? 'selected="selected"' : '') + '>' + ((i < 10) ? '0' : '') + i + '</option>'
HH += '</select>';
// normalise the hour value for 12 hour clock
ap = (hr > 11) ? "pm" : "am";
hr = hr % 12;
hr = (hr == 0) ? 12 : hr;
var hh = '<select name="' + hourName + '" onchange="' + processChange + '">';
for(i = 1; i < 13; i++)
hh += '<option value="' + i % 12 + '" ' + ((hr == i) ? 'selected="selected"' : '') + '>' + ((i < 10) ? '0' : '') + i + '</option>'
hh += '</select>';
var mm = '<select name="' + minuteName + '" onchange="' + processChange + '">';
for(i = 0; i < 60; i = i + 5)
mm += '<option value="' + i + '" ' + ((min == i) ? 'selected="selected"' : '') + '>' + ((i < 10) ? '0' : '') + i + '</option>';
mm += '</select>';
var tt = '<input name="' + apName + '" type="radio" value="am" ' + ((ap == 'am') ? 'checked="checked"' : '') + ' onclick="' + processChange + '"/>' + strTimeAM;
tt += '<input name="' + apName + '" type="radio" value="pm" ' + ((ap == 'pm') ? 'checked="checked"' : '') + ' onclick="' + processChange + '"/>' + strTimePM;
var cPos = 0;
var cPrev = "", cThis = "";
while(cPos < timeFormat.length)
{
cThis = timeFormat.charAt(cPos);
switch(cThis)
{
case "H":
if(cPrev != "H")
theHTML += HH;
break;
case "h":
if(cPrev != "h")
theHTML += hh;
break;
case "m":
if(cPrev != "m")
theHTML += mm;
break;
case "t":
if(cPrev != "t")
theHTML += tt;
break;
default:
theHTML += cThis;
break;
}
cPrev = cThis;
cPos++;
}
return theHTML;
}
Schedule = function ()
{
this.bUseFinishTime = false;
this.StartHour = 0;
this.StartMinute = 0;
this.FinishHour = 0;
this.FinishMinute = 0;
this.Days = EveryDay;
this.SetStartTime = function (hour, minute, ap)
{
this.StartHour = hour;
this.StartMinute = minute;
if(ap)
{
if(ap == "am")
{
if(this.StartHour > 11)
this.StartHour = this.StartHour - 12;
}
else
{
if(this.StartHour < 12)
this.StartHour = this.StartHour + 12;
}
}
}
this.SetFinishTime = function (hour, minute, ap)
{
this.bUseFinishTime = true;
this.FinishHour = hour;
this.FinishMinute = minute;
if(ap)
{
if(ap == "am")
{
if(this.FinishHour > 11)
this.FinishHour = this.FinishHour - 12;
}
else
{
if(this.FinishHour < 12)
this.FinishHour = this.FinishHour + 12;
}
}
}
this.Parse = function (strStringDef)
{
if(strStringDef.length < 1)
return;
var nFindPair = 0;
var NVs, NVPair;
NVs = strStringDef.split(";");
var i = 0;
while(NVs[i])
{
if(NVs[i].indexOf(":") > -1)
{
NVPair = NVs[i].split(":");
strValue = NVPair[1];
switch(NVPair[0])
{
case START_HOUR:
var newHour = parseInt(strValue);
this.StartHour = newHour;
break;
case START_MINUTE:
this.StartMinute = parseInt(strValue);
break;
case BACKUP_UNTIL:
this.bUseFinishTime = (strValue == "TimeUntil");
break;
case FINISH_HOUR:
var newHour = parseInt(strValue);
this.FinishHour = newHour;
this.bUseFinishTime = true;
break;
case FINISH_MINUTE:
this.FinishMinute = parseInt(strValue);
this.bUseFinishTime = true;
break;
case DAYS:
this.Days = strValue;
break;
}
}
i++;
}
}
this.GetAsString = function ()
{
var strRet = START_HOUR + NVSEP + this.StartHour + SEP
+ START_MINUTE + NVSEP + this.StartMinute + SEP
+ BACKUP_UNTIL + NVSEP + (this.bUseFinishTime ? "TimeUntil" : "DoneUntil") + SEP
+ DAYS + NVSEP + this.Days + SEP;
if (this.bUseFinishTime) {
strRet += FINISH_HOUR + NVSEP + this.FinishHour + SEP
+ FINISH_MINUTE + NVSEP + this.FinishMinute + SEP
}
return strRet;
}
this.GetTime = function (hr, mm)
{
var theTime = "";
var hr24 = hr;
var hr12 = hr % 12;
if(hr12 == 0)
hr12 = 12;
var tt = ((hr > 11) ? strTimePM : strTimeAM);
var cPos = 0;
var cPrev = "", cThis = "";
while(cPos < timeFormat.length)
{
cThis = timeFormat.charAt(cPos);
cNext = (cPos < timeFormat.length - 1) ? timeFormat.charAt(cPos + 1) : "";
switch(cThis)
{
case "H":
if(cPrev != "H")
theTime += ((hr24 < 10 && cNext == "H") ? "0" : "") + hr24;
break;
case "h":
if(cPrev != "h")
theTime += ((hr12 < 10 && cNext == "h") ? "0" : "") + hr12;
break;
case "m":
if(cPrev != "m")
theTime += ((mm < 10 && cNext == "m") ? "0" : "") + mm;
break;
case "t":
if(cPrev != "t")
theTime += tt;
break;
default:
theTime += cThis;
break;
}
cPrev = cThis;
cPos++;
}
return theTime;
}
this.GetStartTime = function ()
{
return this.GetTime(this.StartHour, this.StartMinute);
}
this.GetFinishTime = function ()
{
return this.GetTime(this.FinishHour, this.FinishMinute);
}
this.Description = function ()
{
if(this.Days == EveryDay)
str = this.bUseFinishTime ? sdEveryDayTwoTimes : sdEveryDayOneTime;
else if(this.Days == Weekdays)
str = this.bUseFinishTime ? sdWeekdaysTwoTimes : sdWeekdaysOneTime;
else
str = this.bUseFinishTime ? sdSpecificDaysTwoTimes : sdSpecificDaysOneTime;
str = str.replace("{startTime}", this.GetStartTime());
str = str.replace("{finishTime}", this.GetFinishTime());
str = str.replace("{listDays}", this.ListDays());
return str;
}
this.ListDays = function ()
{
if(this.Days == 0)
return strDescNoSchedule;
strRet = "";
if((this.Days & Sun) == Sun)
strRet += strSundayShort + ", ";
if((this.Days & Mon) == Mon)
strRet += strMondayShort + ", ";
if((this.Days & Tue) == Tue)
strRet += strTuesdayShort + ", ";
if((this.Days & Wed) == Wed)
strRet += strWednesdayShort + ", ";
if((this.Days & Thu) == Thu)
strRet += strThursdayShort + ", ";
if((this.Days & Fri) == Fri)
strRet += strFridayShort + ", ";
if((this.Days & Sat) == Sat)
strRet += strSaturdayShort + ", ";
// drop the ", " at the end of the list
return strRet.substring(0, strRet.length - 2);
}
this.ProcessChange = function (o)
{
switch(o.name)
{
case START_HOUR:
case SSTART_HOUR:
case ONCE_HOUR:
var newHour = parseInt(o.value) + ((!Use24HourClock && this.StartHour > 11 && o.value < 12) ? 12 : 0);
this.StartHour = newHour;
break;
case START_MINUTE:
case SSTART_MINUTE:
case ONCE_MINUTE:
this.StartMinute = parseInt(o.value);
break;
case START_AP:
case SSTART_AP:
case ONCE_AP:
if(o.value == "am")
{
if(this.StartHour > 11)
this.StartHour = this.StartHour - 12;
}
else
{
if(this.StartHour < 12)
this.StartHour = this.StartHour + 12;
}
break;
case FINISH_HOUR:
case SFINISH_HOUR:
var newHour = parseInt(o.value) + ((!Use24HourClock && this.FinishHour > 11 && o.value < 12) ? 12 : 0);
this.FinishHour = newHour;
this.bUseFinishTime = true;
break;
case FINISH_MINUTE:
case SFINISH_MINUTE:
this.FinishMinute = parseInt(o.value);
this.bUseFinishTime = true;
break;
case FINISH_AP:
case SFINISH_AP:
if(o.value == "am")
{
if(this.FinishHour > 11)
this.FinishHour = this.FinishHour - 12;
}
else
{
if(this.FinishHour < 12)
this.FinishHour = this.FinishHour + 12;
}
this.bUseFinishTime = true;
break;
case DAYCHOICE:
this.Days = (o.value == "Every") ? EveryDay : ((o.value == "Weekdays") ? Weekdays : 0);
break;
case SPECDAY_SUN:
this.Days = o.checked ? this.Days | Sun : this.Days & ~Sun;
break;
case SPECDAY_MON:
this.Days = o.checked ? this.Days | Mon : this.Days & ~Mon;
break;
case SPECDAY_TUE:
this.Days = o.checked ? this.Days | Tue : this.Days & ~Tue;
break;
case SPECDAY_WED:
this.Days = o.checked ? this.Days | Wed : this.Days & ~Wed;
break;
case SPECDAY_THU:
this.Days = o.checked ? this.Days | Thu : this.Days & ~Thu;
break;
case SPECDAY_FRI:
this.Days = o.checked ? this.Days | Fri : this.Days & ~Fri;
break;
case SPECDAY_SAT:
this.Days = o.checked ? this.Days | Sat : this.Days & ~Sat;
break;
}
ScheduleSettings.UpdateDisplay(o.name, o.value);
}
this.OutputHTML = function (htmlTemplate)
{
var StartTime = new box();
var FinishTime = new box();
var newOne = htmlTemplate; //.cloneNode(true);
this.UpdateScheduleControls(newOne, StartTime, FinishTime);
if(StartTime.GetObject())
StartTime.GetObject().innerHTML = TimeControl("Start", this.StartHour, this.StartMinute, "ScheduleSettings.ProcessSave(this);");
if(FinishTime.GetObject())
FinishTime.GetObject().innerHTML = TimeControl("Finish", this.FinishHour, this.FinishMinute, "ScheduleSettings.ProcessSave(this);");
return newOne;
}
this.UpdateScheduleControls = function (theNode, StartTime, FinishTime)
{
var childNode;
for(var i = 0; i < theNode.childNodes.length; i++)
{
childNode = theNode.childNodes[i];
this.UpdateSpecificControl(childNode, StartTime, FinishTime);
this.UpdateScheduleControls(childNode, StartTime, FinishTime);
}
}
this.UpdateSpecificControl = function (childNode, StartTime, FinishTime)
{
if(childNode.attributes)
{
// Feed in the values from the schedule
if(childNode.nodeName == "INPUT")
{
switch(childNode.attributes["name"].value)
{
case "DayChoice":
switch(childNode.attributes["id"].value)
{
case "Every":
CheckObject(childNode, this.Days == EveryDay);
break;
case "Weekdays":
CheckObject(childNode, this.Days == Weekdays);
break;
case "Specific":
CheckObject(childNode, this.Days != EveryDay && this.Days != Weekdays);
break;
}
break;
case "SpecDaySun":
case "SpecDayMon":
case "SpecDayTue":
case "SpecDayWed":
case "SpecDayThu":
case "SpecDayFri":
case "SpecDaySat":
checkDay = eval(childNode.attributes["name"].value.substring(7));
CheckObject(childNode, ((this.Days & checkDay) == checkDay));
break;
}
}
if(childNode.attributes["class"])
{
var className = childNode.attributes["class"].value;
switch(className)
{
case "crbScheduleStartTime":
StartTime.SetObject(childNode);
break;
case "crbScheduleFinishTime":
FinishTime.SetObject(childNode);
break;
}
}
}
}
this.IsEqualTo = function (sched)
{
var bEqual =
(this.bUseFinishTime == sched.bUseFinishTime)
&& (this.StartHour == sched.StartHour)
&& (this.StartMinute == sched.StartMinute)
&& (this.FinishHour == sched.FinishHour)
&& (this.FinishMinute == sched.FinishMinute)
&& (this.Days == sched.Days);
return bEqual;
}
this.IsValidTimeWindow = function ()
{
return !this.bUseFinishTime || !((this.StartHour == this.FinishHour) && (this.StartMinute == this.FinishMinute));
}
}
/* End included file /scripts/schedule.class.js */
/* Carbonite Service SKIPPING already included file /scripts/commonfunctions.js */
/* Carbonite Service SKIPPING already included file /scripts/serviceinterconnect.js */
/* Carbonite Service included file /scripts/messagebox.js */
// (c) Carbonite, Inc., 2005-2009 All rights reserved
/* Carbonite Service SKIPPING already included file /scripts/string.class.js */
/* Carbonite Service SKIPPING already included file /scripts/commonfunctions.js */
/* Carbonite Service included file /js/wait.js */
// (c) Carbonite, Inc., 2005-2009 All rights reserved
// Useful common scripts for messaging while waiting
var Wait__ = function ()
{
var self = this;
var objOverlay = null;
var nestedOverlays = new Array();
var popupDiv = null;
var orgID = null;
function AddPopupDiv(waitDivId, processor)
{
popupDiv = document.createElement("div");
popupDiv.className = "HorizontalCenter";
var contentDiv = document.createElement("div");
contentDiv.className = "LightBox";
popupDiv.appendChild(contentDiv);
var pWait = document.getElementById(waitDivId);
orgID = waitDivId;
if(processor)
{
// becuase we are processing, we create a clone that we change, rather than changing the original node
pWait = pWait.cloneNode(true);
orgID = null;
pWait.innerHTML = processor(pWait.innerHTML);
}
contentDiv.appendChild(pWait);
document.body.appendChild(popupDiv);
pWait.style.display = "";
pWait.style.visibility = "visible";
var centerPos = $(popupDiv).offset();
$(contentDiv).offset(
{
left: centerPos.left - (contentDiv.offsetWidth / 2),
top: centerPos.top - (contentDiv.offsetHeight / 2)
}
);
}
function RemovePopupDiv()
{
if(popupDiv)
{
if(orgID)
{
var orgDiv = document.getElementById(orgID);
orgDiv.parentNode.removeChild(orgDiv);
orgDiv.style.display = "none";
orgDiv.style.visibility = "hidden";
document.body.appendChild(orgDiv);
}
document.body.removeChild(popupDiv);
}
popupDiv = null;
orgID = null;
}
function DoWaitOperation()
{
waitingMethod();
self.StopWait();
}
this.Overlay = function (bShow)
{
if(bShow)
{
if(objOverlay)
{
nestedOverlays.push(objOverlay);
}
objOverlay = document.createElement("div");
objOverlay.className = "LightBoxBackground";
objOverlay.setAttribute("id", "overlay");
document.body.appendChild(objOverlay);
}
else
{
if(objOverlay)
document.body.removeChild(objOverlay);
objOverlay = null;
if(nestedOverlays.length > 0)
objOverlay = nestedOverlays.pop();
}
}
this.IsPopped = function ()
{
return popupDiv != null;
}
this.AddWaitingDiv = function (waitDivId, processor)
{
AddPopupDiv(waitDivId, processor);
document.body.style.cursor = "wait";
}
this.RemoveWaitingDiv = function ()
{
document.body.style.cursor = "default";
RemovePopupDiv();
}
/*
Wait - shows message during wait operation (overlaying background with opaque grey)
Arguments:
messageId - id of the html node to show within the waiting div (required)
methodToCall - pointer to method to call (optional; if not provided, caller is responsible for calling StopWait())
decorationMethod - method that will preprocess the message to update its contents if necessary
*/
var waitingMethod = null;
this.DoWait = function (messageId, methodToCall, decorationMethod)
{
self.Overlay(true);
self.AddWaitingDiv(messageId, decorationMethod);
if(methodToCall)
{
// let us know what the method to call is
waitingMethod = methodToCall;
//var fnCall = "DoWaitOperation('" + methodToCall + "')";
setTimeout(DoWaitOperation, 0);
}
}
this.StopWait = function ()
{
waitingMethod = null;
self.RemoveWaitingDiv();
self.Overlay(false);
}
this.Popup = function (messageId, decorationMethod)
{
self.Overlay(true);
AddPopupDiv(messageId, decorationMethod);
}
this.StopPopup = function ()
{
RemovePopupDiv();
self.Overlay(false);
}
}
var Wait = new Wait__();
/* End included file /js/wait.js */
var msgBoxArgs = {};
BUTTON_OK = 0x01;
BUTTON_CANCEL = 0x02;
BUTTON_YES = 0x04;
BUTTON_NO = 0x08;
BUTTONS_OKCANCEL = BUTTON_OK | BUTTON_CANCEL;
BUTTONS_YESNO = BUTTON_YES | BUTTON_NO;
BUTTONS_YESNOCANCEL = BUTTON_YES | BUTTON_NO | BUTTON_CANCEL;
ID_YES = 'IdYes';
ID_NO = 'IdNo';
ID_OK = 'IdOK';
ID_CANCEL = 'IdCancel';
ICON_NONE = 1;
ICON_INFO = 2;
ICON_WARNING = 3;
MESSAGEBOX_ERROR_NOELEMENT = -1;
function HtmlMessageBoxFromUrl(url)
{
// grey out the area of the main window
Wait.Overlay(true);
var retval = external.AlertFromUrl(url);
Wait.Overlay(false);
return retval;
}
function HtmlMessageBox2(id, buttonSpec)
{
if (typeof (external.Alert) == "undefined")
return (BUTTON_OK == HtmlMessageBox(id, buttonSpec) ? ID_OK : ID_CANCEL);
var theNode = document.getElementById(id);
if (!theNode)
return MESSAGEBOX_ERROR_NOELEMENT;
switch (buttonSpec) {
case BUTTON_OK: buttonSpec = ID_OK; break;
case BUTTON_CANCEL: buttonSpec = ID_CANCEL; break;
case BUTTON_YES: buttonSpec = ID_YES; break;
case BUTTON_NO: buttonSpec = ID_NO; break;
case BUTTONS_OKCANCEL: buttonSpec = ID_CANCEL + '*_default*SecondaryButton|' + ID_OK; break;
case BUTTONS_YESNO: buttonSpec = ID_NO + '*_default*SecondaryButton|' + ID_YES; break;
case BUTTONS_YESNOCANCEL: buttonSpec = buttonSpec = ID_CANCEL + '*_default*SecondaryButton|' + ID_NO + '*_default*SecondaryButton|' + ID_YES; break;
}
//the node style indicates the size of the messagebox with dialogHeight and dialogWidth
//the captions for the buttons need not be stated for common buttons (see HTMLMessageBox2.html)
//otherwise, the button spec is sent as id1*caption1|id2*caption2|...|idN*captionN
// grey out the area of the main window
Wait.Overlay(true);
var retval = external.Alert("", theNode.outerHTML, buttonSpec);
Wait.Overlay(false);
return retval;
}
/*
The opts parameters is a javascript Object used to pass in
a variable set of optional settings.
Usage:
var options = new Object();
options.idOkButtonText = "crbConfirmUnfreezeOkButton";
options.idCancelButtonText = "crbConfirmUnfreezeCancelButton";
options.iconType = ICON_NONE;
if (HtmlMessageBox('crbConfirmUnfreeze', BUTTONS_OKCANCEL, options) == BUTTON_OK)
{
...do stuff...
}
Option properties:
- idOkButtonText: the id of an element that contains the replacement text
for the OK button.
- idCancelButtonText: ... Cancel button.
- idYesButtonText: ... Yes button.
- idNoButtonText: ... No button.
- iconType: sets or turns off the message box icon (default is an info icon).
Use one of the ICON_x constants (see top of this file).
*/
function HtmlMessageBox(id, buttonTypes, opts)
{
var theNode = document.getElementById(id);
if (!theNode)
return MESSAGEBOX_ERROR_NOELEMENT;
// Our call to MessageBox / MessageBoxStyle needs an options param,
// too. So we'll just use the one that caller passed to us, if any,
// creating a new one only if necessary.
if (opts == null)
opts = new Object();
opts.Message = theNode.innerHTML;
opts.Buttons = buttonTypes;
// process optional opts settings
if (opts.idOkButtonText)
opts.OkButtonText = ReadButtonText(opts.idOkButtonText);
if (opts.idCancelButtonText)
opts.CancelButtonText = ReadButtonText(opts.idCancelButtonText);
if (opts.idYesButtonText)
opts.YesButtonText = ReadButtonText(opts.idYesButtonText);
if (opts.idNoButtonText)
opts.NoButtonText = ReadButtonText(opts.idNoButtonText);
var sStyle = theNode.style;
var retVal;
if (sStyle)
{
theNode.removeAttribute("title");
retVal = MessageBoxStyle(opts, sStyle);
}
else
retVal = MessageBox(opts);
return retVal;
}
function ParseStyle(sStyle, d, w)
{
var buffer = 50;
var dialogHeight = -1;
var dialogWidth = -1;
var dialogTop = -1;
var dialogLeft = -1;
var styleString = (sStyle.cssText!=null)?sStyle.cssText:sStyle;
var nvPairs = styleString.split(";");
var newStyle = "";
for(var i=0; i<nvPairs.length; i++)
{
if(nvPairs[i].length>0)
{
var stylePair = nvPairs[i].split(":");
switch(stylePair[0].trim().toLowerCase())
{
// if we've been provided dialog attributes
case "dialogheight":
case "dialogtop":
case "dialogleft":
case "dialogwidth":
eval(stylePair[0] + " = parseInt('" + stylePair[1] + "')");
break;
// Check for things that hide these items; we want to force them to be visible for the message box
case "visibility":
if (stylePair[1].trim().toLowerCase() != "hidden")
newStyle += stylePair[0] + ":" + stylePair[1] + ";";
break;
case "display":
if (stylePair[1].trim().toLowerCase() != "none")
newStyle += stylePair[0] + ":" + stylePair[1] + ";";
break;
// by default, pass the style on through
default:
newStyle += stylePair[0] + ":" + stylePair[1] + ";";
break;
}
}
}
// If a height has been specified, adjust it (add 40) for IE6.
if (dialogHeight > 0 && IsIE6())
dialogHeight += 40;
// Use default sizes if not supplied
if (dialogHeight < 0)
dialogHeight = d.body.clientHeight - buffer * 2;
if (dialogWidth < 0)
dialogWidth = d.body.clientWidth - buffer * 2;
// Minimum height that IE allows is 100px, minimum width 250px - if the passed in values are smaller, the dialog will not be centered
if (dialogHeight < 100)
dialogHeight = 100;
if (dialogWidth < 250)
dialogWidth = 250;
// center the dialog with respect to the screen, unless top and/or left have been provided to force it elsewhere
if (dialogLeft < 0)
dialogLeft = w.screenLeft + (d.body.clientWidth - dialogWidth) / 2;
if (dialogTop < 0)
dialogTop = w.screenTop + (d.body.clientHeight - dialogHeight) / 2;
newStyle += "dialogHeight: " + dialogHeight + "px;dialogWidth: " + dialogWidth + "px;dialogTop: " + dialogTop + "px;dialogLeft:" + dialogLeft + " px;";
return newStyle;
}
function MessageBox(vArgs)
{
return MessageBoxStyle(vArgs, "");
}
function MessageBoxStyle(vArgs, style)
{
var d = top ? top.document : document;
var w = top ? top.window : window;
Wait.Overlay(true);
var retVal = window.showModalDialog("MessageBox.htm", vArgs, "center: no;status: no;unadorned: yes;" + ParseStyle(style, d, w));
Wait.Overlay(false);
return retVal;
}
function WriteMessage()
{
if (msgBoxArgs.Message)
document.write(msgBoxArgs.Message);
}
function AppendButtonTags(currButtonType, sButtonName, buttonPanel)
{
var button = document.getElementById(sButtonName);
var i = 0;
var buttonContent;
var isOverrideText = IsOverrideButtonText(currButtonType);
while (buttonContent = button.childNodes[i])
{
var newNode = buttonContent.cloneNode(true);
if (isOverrideText)
ReplaceCurrentButtonText(currButtonType, newNode);
buttonPanel.appendChild(newNode);
i++;
}
}
function WriteButtons()
{
var buttonPanel = document.getElementById("crbMessageBoxButtons");
if (msgBoxArgs.Buttons & BUTTON_CANCEL)
AppendButtonTags(BUTTON_CANCEL, "crbMsgBoxCancel", buttonPanel);
// Add the OK button if msgBoxArgs.Buttons is null. This happens
// when loaded from the Skin extended menu in CarboniteUI.
if (!msgBoxArgs.Buttons || (msgBoxArgs.Buttons & BUTTON_OK))
AppendButtonTags(BUTTON_OK, "crbMsgBoxOK", buttonPanel);
if (msgBoxArgs.Buttons & BUTTON_NO)
AppendButtonTags(BUTTON_NO, "crbMsgBoxNo", buttonPanel);
if (msgBoxArgs.Buttons & BUTTON_YES)
AppendButtonTags(BUTTON_YES, "crbMsgBoxYes", buttonPanel);
}
function ReturnResult(result)
{
returnValue = result;
window.close();
}
function ReadButtonText(id)
{
var theNode = document.getElementById(id);
if (!theNode)
return null;
return theNode.innerHTML;
}
function IsOverrideButtonText(currButtonType)
{
if ( (currButtonType == BUTTON_OK && msgBoxArgs.OkButtonText)
|| (currButtonType == BUTTON_CANCEL && msgBoxArgs.CancelButtonText)
|| (currButtonType == BUTTON_YES && msgBoxArgs.YesButtonText)
|| (currButtonType == BUTTON_NO && msgBoxArgs.NoButtonText))
{
return true;
}
return false;
}
function ReplaceCurrentButtonText(currButtonType, newNode)
{
var res = newNode.getElementsByTagName('a');
if (res == null || res.length == 0)
return;
if (currButtonType == BUTTON_OK)
res[0].innerHTML = msgBoxArgs.OkButtonText;
if (currButtonType == BUTTON_CANCEL)
res[0].innerHTML = msgBoxArgs.CancelButtonText;
if (currButtonType == BUTTON_YES)
res[0].innerHTML = msgBoxArgs.YesButtonText;
if (currButtonType == BUTTON_NO)
res[0].innerHTML = msgBoxArgs.NoButtonText;
}
function FinalizeDocument()
{
// change or remove message box's "info" icon
if (msgBoxArgs.iconType)
{
var n = document.getElementById("crbMsgBoxText");
if (n != null)
{
if (msgBoxArgs.iconType == ICON_WARNING)
n.style.backgroundImage = "url(../images/alert.png)";
else if (msgBoxArgs.iconType == ICON_NONE)
{
n.style.backgroundImage = "none";
n.style.paddingLeft = "0";
}
}
}
}
// Utility message box functions
/* Takes the ID of the span containing the dialog box text; pops a confirmation dialog */
function crbConfirm2(id)
{
return ID_OK == (buttonSelected = HtmlMessageBox2(id, BUTTONS_OKCANCEL));
}
/* Takes the ID of the span containing the dialog box text; pops an alert dialog */
function crbAlert(id)
{
HtmlMessageBox2(id, BUTTON_OK);
}
function crbConfirmYN2(id)
{
var buttonSelected;
return ID_YES == (buttonSelected = HtmlMessageBox2(id, BUTTONS_YESNO));
}
/* End included file /scripts/messagebox.js */
function formatTime(hour, minute, iso) {
var printMinute = minute;
if (minute < 10) printMinute = '0' + minute;
if (iso) {
var printHour = hour
if (printHour < 10) printHour = '0' + hour;
return printHour + ':' + printMinute;
} else {
var printHour = hour % 12;
if (printHour == 0) printHour = 12;
var half = (hour < 12) ? 'am' : 'pm';
return printHour + ':' + printMinute + half;
}
}
function parseTime(text) {
var match = match = /(\d+)\s*[:\-\.,]\s*(\d+)\s*(am|pm)?/i.exec(text);
if (match && match.length >= 3) {
var hour = Number(match[1]);
var minute = Number(match[2])
if (hour == 12 && match[3]) hour -= 12;
if (match[3] && match[3].toLowerCase() == 'pm') hour += 12;
return {
hour: hour,
minute: minute
};
} else {
return null;
}
}
var MIScheduleSettings__ = function () {
var CONTINUOUS = 0;
var ONCE_PER_DAY = 1;
var EXCLUDE_HOURS = 2;
this.PutMISchedule = function () {
// Schedule types
var scheduleInfo = {
"ScheduleType": CONTINUOUS,
"StartHour": 0,
"StartMinute": 0,
"EndHour": 0,
"EndMinute": 0
};
if ($("#MIdaily").is(":checked")) {
scheduleInfo.ScheduleType = ONCE_PER_DAY;
var startTime = parseTime($('#MIbackup_start').val());
if (startTime) {
scheduleInfo.StartHour = startTime.hour;
scheduleInfo.StartMinute = startTime.minute;
}
} else if ($("#MIexcludeHours").is(":checked")) {
scheduleInfo.ScheduleType = EXCLUDE_HOURS;
var startTime = parseTime($('#MIexclude_start').val());
if (startTime) {
scheduleInfo.StartHour = startTime.hour;
scheduleInfo.StartMinute = startTime.minute;
}
var endTime = parseTime($('#MIexclude_end').val());
if (endTime) {
scheduleInfo.EndHour = endTime.hour;
scheduleInfo.EndMinute = endTime.minute;
}
}
this.UpdateTimeFields(scheduleInfo.ScheduleType, scheduleInfo.StartHour, scheduleInfo.StartMinute, scheduleInfo.EndHour, scheduleInfo.EndMinute);
var scheduleJSON = $.toJSON(scheduleInfo);
$.ajax({
url: "/put-MIschedule.htm",
data: "nocache=1&schedule=" + scheduleJSON
});
}
this.initMISchedule = function () {
var data = $.parseJSON($("#crbMIScheduleInfo").html());
// Init defaults for daily backup and exclude range backup
// Daily backup will default to midnight
var defaultDailyBackupTime = formatTime(0, 0, Use24HourClock);
$('#MIbackup_start').val(defaultDailyBackupTime);
$('#MIbackup_start_text').text(defaultDailyBackupTime);
// Exclude range backup will default to the current time + 2 hours
var defaultExcludeStartTime = new Date();
var defaultExcludeStartHour = defaultExcludeStartTime.getHours();
var defaultExcludeStartMin = defaultExcludeStartTime.getMinutes() < 15 ? 0 : 30;
var defaultExcludeEndTime = new Date();
var defaultExcludeEndHour = (defaultExcludeEndTime.getHours() + 2) % 24;
var defaultExcludeEndMinute = defaultExcludeEndTime.getMinutes() < 15 ? 0 : 30;
var defaultExcludeStartTimeText = formatTime(defaultExcludeStartHour, defaultExcludeStartMin, Use24HourClock);
var defaultExcludeEndTimeText = formatTime(defaultExcludeEndHour, defaultExcludeEndMinute, Use24HourClock);
$('#MIexclude_start').val(defaultExcludeStartTimeText);
$('#MIexclude_start_text').text(defaultExcludeStartTimeText);
$('#MIexclude_end').val(defaultExcludeEndTimeText);
$('#MIexclude_end_text').text(defaultExcludeEndTimeText);
// Now load the schedule according to the data in crbMIScheduleInfo
if (data.ScheduleType == CONTINUOUS) {
$('#MIcontinuously').click();
} else if (data.ScheduleType == ONCE_PER_DAY) {
$('#MIdaily').click();
var startTime = formatTime(data.StartHour, data.StartMinute, Use24HourClock);
$('#MIbackup_start').val(startTime);
$('#MIbackup_start_text').text(startTime);
} else if (data.ScheduleType == EXCLUDE_HOURS) {
$('#MIexcludeHours').click();
var startTime = formatTime(data.StartHour, data.StartMinute, Use24HourClock);
var endTime = formatTime(data.EndHour, data.EndMinute, Use24HourClock);
$('#MIexclude_start').val(startTime);
$('#MIexclude_start_text').text(startTime);
$('#MIexclude_end').val(endTime);
$('#MIexclude_end_text').text(endTime);
}
}
this.UpdateTimeFields = function (scheduleType, startHour, startMinute, endHour, endMinute) {
var startTime = formatTime(startHour, startMinute, Use24HourClock);
var endTime = formatTime(endHour, endMinute, Use24HourClock);
if (scheduleType == ONCE_PER_DAY) {
$('#MIbackup_start_text').text(startTime);
} else if (scheduleType == EXCLUDE_HOURS) {
$('#MIexclude_start_text').text(startTime);
$('#MIexclude_end_text').text(endTime);
}
}
}
var ScheduleSettings__ = function ()
{
function E$(id)
{
return document.getElementById(id);
}
var self = this;
this.Schedules = new Object;
var scheduleNum;
var schedule;
var ifrPoster = null;
var needsCommit = false;
NO_SCHEDULE = 0;
SINGLE_SCHEDULE = 1;
MULTIPLE_SCHEDULE = 2;
var scheduleType = NO_SCHEDULE;
Sun = 0x01;
Mon = 0x02;
Tue = 0x04;
Wed = 0x08;
Thu = 0x10;
Fri = 0x20;
Sat = 0x40;
EveryDay = Sun | Mon | Tue | Wed | Thu | Fri | Sat;
Weekdays = Mon | Tue | Wed | Thu | Fri;
localNav = false;
/* Silence javascript errors */
window.onerror = parent.trapError;
function DefaultSchedule()
{
return self.Schedules[0] ? self.Schedules[0] : schedule;
}
function ShowHideTimeControl(sName, bShow)
{
var hourName = sName + "Hour";
var minuteName = sName + "Minute";
var dropdown = E$(hourName);
dropdown.style.display = bShow ? "" : "none";
dropdown = E$(minuteName);
dropdown.style.display = bShow ? "" : "none";
}
function HideTimeControl(sName, timeout)
{
// delay before executing the hide so that this operation blends with the other effects
setTimeout('ShowHideTimeControl("' + sName + '", false)', timeout);
}
function ShowTimeControl(sName, timeout)
{
// delay before executing the hide so that this operation blends with the other effects
setTimeout('ShowHideTimeControl("' + sName + '", true)', timeout);
}
this.AdvancedScheduling = function ()
{
var border = 10;
var over = E$('overlay');
// stretch overlay to fill page and fade in
var arrayPageSize = getPageSize();
over.style.position = "absolute";
over.style.width = arrayPageSize[0];
over.style.height = arrayPageSize[1];
over.style.top = 0;
over.style.left = 0;
over.style.display = "";
var as = E$("AdvancedSchedule");
RefreshAdvancedScheduleList();
as.style.position = "absolute";
as.style.width = arrayPageSize[0] - border * 2;
as.style.height = 0; // style appears to be determining height
as.style.top = border;
as.style.left = border;
as.style.display = "";
// if we have no advanced rules, then open the entry screen for the first one anyway
if(!self.Schedules[0])
self.AddNewSchedule();
}
this.SimpleScheduling = function ()
{
schedule = DefaultSchedule() ? DefaultSchedule() : new Schedule();
E$('AdvancedSchedule').style.display = "none";
E$('overlay').style.display = "none";
}
this.AddNewSchedule = function ()
{
var nTotal = 0;
while(self.Schedules[nTotal])
nTotal++;
self.EditSchedule(nTotal);
}
this.EditSchedule = function (num)
{
var as = E$("AdvancedSchedule");
var es = E$("EditSchedule");
es.style.position = as.style.position;
es.style.width = as.style.width;
es.style.height = as.style.height;
es.style.top = as.style.top;
es.style.left = as.style.left;
GetEditSchedule(num);
as.style.display = "none";
es.style.display = "";
}
this.StopEdit = function ()
{
schedule = self.Schedules[0] ? self.Schedules[0] : new Schedule();
scheduleNum = -1;
RefreshAdvancedScheduleList();
if(self.Schedules[0])
{
E$('EditSchedule').style.display = "none";
E$('AdvancedSchedule').style.display = "";
}
else
{
// go all the way back to the main schedule screen
E$('EditSchedule').style.display = "none";
E$('AdvancedSchedule').style.display = "none";
E$('overlay').style.display = "none";
}
}
function GetEditSchedule(num)
{
// create temporary copy of schedule in placeholder
scheduleNum = num;
schedule = new Schedule();
if(self.Schedules[scheduleNum])
schedule.Parse(self.Schedules[scheduleNum].GetAsString());
var editSchedule = schedule.OutputHTML(E$("ScheduleDetails"));
var sg = E$("ScheduleGetter");
// clean any children present - this one will need to be the only one
while(sg.childNodes[0])
{
sg.removeChild(sg.childNodes[0])
};
sg.appendChild(editSchedule);
}
function AddOrChangeSchedule(sched, num)
{
var i = 0;
var bIsUnique = true;
while(self.Schedules[i] && bIsUnique)
{
bIsUnique = !self.Schedules[i].IsEqualTo(sched);
i++;
}
if(bIsUnique)
self.Schedules[num] = sched;
return bIsUnique;
}
function SaveEditSchedule()
{
schedule.bUseFinishTime = true;
var bAdded = AddOrChangeSchedule(schedule, scheduleNum);
if(bAdded)
{
scheduleType = MULTIPLE_SCHEDULE;
E$("Advanced").checked = true;
self.ShowApplyButton();
self.StopEdit();
}
return bAdded;
}
this.DeleteSchedule = function (iNum)
{
var i = 0;
while(self.Schedules[i])
{
if(i > iNum)
self.Schedules[i - 1] = self.Schedules[i];
i++;
}
self.Schedules[i - 1] = null;
if(!self.Schedules[0])
{
scheduleType = NO_SCHEDULE;
E$("continuously").checked = true;
}
self.ShowApplyButton();
RefreshAdvancedScheduleList();
}
function PutScheduleInfo(str, onsavedfunc)
{
var req;
try
{
req = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e)
{
req = new ActiveXObject("Microsoft.XMLHTTP");
}
// nocache=1 is so existing installations don't have an issue
// with previously cacheable content (The http server used to
// say that /put-schedule.htm was cacheable. That was fixed,
// but we want to make sure that any content left over from
// previous builds doesn't get used.)
var url = "/put-schedule.htm?nocache=1&" + str;
req.onreadystatechange = function ()
{
// When the load is complete, call the save function.
if((typeof (onsavedfunc) == 'function') && (req.readyState == 4))
{
onsavedfunc();
}
}
req.open("GET", url, false);
req.send("");
}
function ApplyScheduleChanges(onsavedfunc)
{
// Prevent the user from saving if they have chosen Advanced with no scedules
if(scheduleType & 0x02 && !self.Schedules[0])
{
HtmlMessageBox2("crbEmptyAdvanced", BUTTON_OK);
return;
}
// Update top-level choice
if(!schedule)
{
schedule = DefaultSchedule() ? DefaultSchedule() : new Schedule();
}
scheduleType &= ~0x04;
if(((scheduleType & 0x02) == 0x00))
schedule.Days = EveryDay;
if(!self.Schedules[0] && scheduleType != NO_SCHEDULE)
self.Schedules[0] = schedule;
//GetPoster().src="/put-state.htm?" + BACKUP_TYPE + "=" + scheduleType;
updateTimeFields(schedule);
// Now save off all the schedules (even if we're not using them right now)
var allScheds = "UpdateAll=1&" + BACKUP_TYPE + "=" + scheduleType;
// Only append schedule hours if the type is not continuous (i.e. NO_SCHEDULE).
if (scheduleType != NO_SCHEDULE)
{
var i = 0;
while(self.Schedules[i])
{
allScheds += "&Schedule" + i + "=" + self.Schedules[i].GetAsString();
i++;
}
}
PutScheduleInfo(allScheds, onsavedfunc);
needsCommit = false;
}
this.ShowApplyButton = function ()
{
needsCommit = true;
// var as = E$("ApplyScheduleChanges");
// var ac = E$("CancelScheduleChanges");
// if(as.style.display == "none")
// as.style.display = "";
// if(ac.style.display == "none")
// ac.style.display = "";
}
this.SetChoice = function (o)
{
// Simply store changed values for submission
scheduleType = o.value;
// update the time to reflect the selection
switch(o.id)
{
case "continuously":
case "crbScheduleDefaultRadioButton":
DefaultSchedule().bUseFinishTime = false;
break;
case "daily":
var timeSelected = parseTime($('#backup_start').val());
if(timeSelected)
{
DefaultSchedule().SetStartTime(
timeSelected.hour,
timeSelected.minute
);
}
DefaultSchedule().bUseFinishTime = false;
break;
case "excludeHours":
var excludeStart = parseTime($('#exclude_start').val());
if(excludeStart)
{
DefaultSchedule().SetFinishTime(
excludeStart.hour,
excludeStart.minute
);
}
var excludeEnd = parseTime($('#exclude_end').val());
if(excludeEnd)
{
DefaultSchedule().SetStartTime(
excludeEnd.hour,
excludeEnd.minute
);
}
DefaultSchedule().bUseFinishTime = true;
break;
default:
break;
}
self.ShowApplyButton();
}
function RefreshAdvancedScheduleList()
{
var listTopNode = E$("listTopNode");
var strInner;
var i = 0;
if(!self.Schedules[0])
strInner = strNoSchedRules;
else
{
strInner = strSchedRules;
strInner += "<table class='scheduletable'>";
while(self.Schedules[i])
{
var schedEditLink = "<tr><td><a onmousedown='localNav=true;' href='javascript:ScheduleSettings.EditSchedule(" + i + ")'><span class='Bullet'>" + strBullet + "</span>" + self.Schedules[i].Description() + "</a></td><td> <a class='addToolTip' onmousedown='localNav=true;' href='javascript:ScheduleSettings.DeleteSchedule(" + i + ")'><font size='-2'>" + strDeleteSchedule + "</font></a></td></tr>";
strInner += schedEditLink;
i++;
}
strInner += "</table>";
}
listTopNode.innerHTML = strInner;
}
this.UpdateDisplay = function (sName, sValue)
{
switch(sName)
{
case DAYCHOICE:
E$(SPECDAY_SUN).checked = schedule.Days & Sun;
E$(SPECDAY_MON).checked = schedule.Days & Mon;
E$(SPECDAY_TUE).checked = schedule.Days & Tue;
E$(SPECDAY_WED).checked = schedule.Days & Wed;
E$(SPECDAY_THU).checked = schedule.Days & Thu;
E$(SPECDAY_FRI).checked = schedule.Days & Fri;
E$(SPECDAY_SAT).checked = schedule.Days & Sat;
break;
case SPECDAY_SUN:
case SPECDAY_MON:
case SPECDAY_TUE:
case SPECDAY_WED:
case SPECDAY_THU:
case SPECDAY_FRI:
case SPECDAY_SAT:
if(schedule.Days == EveryDay)
E$("Every").checked = true;
else if(schedule.Days == Weekdays)
E$("Weekdays").checked = true;
else
E$("Specific").checked = true;
break;
case SSTART_HOUR:
case SSTART_MINUTE:
case SSTART_AP:
case SFINISH_HOUR:
case SFINISH_MINUTE:
case SFINISH_AP:
E$("excludeHours").checked = true;
self.SetChoice(E$("excludeHours"));
scheduleType = SINGLE_SCHEDULE;
break;
case ONCE_HOUR:
case ONCE_MINUTE:
case ONCE_AP:
E$("daily").checked = true;
self.SetChoice(E$("daily"));
scheduleType = SINGLE_SCHEDULE | 0x04;
break;
case BACKUP_TYPE:
switch(scheduleType)
{
case NO_SCHEDULE:
E$("continuously").checked = true;
break;
case SINGLE_SCHEDULE:
E$(DefaultSchedule().bUseFinishTime ? "excludeHours" : "daily").checked = true;
break;
case MULTIPLE_SCHEDULE:
E$("Advanced").checked = true;
break;
}
break;
}
}
this.ProcessSave = function (o)
{
schedule.ProcessChange(o);
}
this.InitSimpleSchedule = function ()
{
schedule = DefaultSchedule() ? DefaultSchedule() : new Schedule();
if(E$("crbAllowAdvancedSchedule") && eval(E$("crbAllowAdvancedSchedule").innerText))
$('#crbAdvancedSchedule').show();
if (scheduleType == SINGLE_SCHEDULE) {
if (schedule.bUseFinishTime) {
$("#excludeHours").closest("li").click();
$("#excludeHours").attr("checked", true);
} else {
$("#daily").closest("li").click();
$("#daily").attr("checked", true);
}
} else if (scheduleType == MULTIPLE_SCHEDULE) {
$("#Advanced").closest("li").click();
$("#Advanced").attr("checked", true);
} else {
$("#continuously").closest("li").click();
$("#continuously").attr("checked", true);
}
// now set the values in the controls
updateTimeFields(schedule);
}
function updateTimeFields(sched)
{
var defaultDailyBackupTime = formatTime(0, 0, Use24HourClock);
$('#backup_start').val(defaultDailyBackupTime);
$('#backup_start_text').text(defaultDailyBackupTime);
var defaultExcludeStartTime = new Date();
var defaultExcludeStartHour = defaultExcludeStartTime.getHours();
var defaultExcludeStartMin = defaultExcludeStartTime.getMinutes() < 15 ? 0 : 30;
var defaultExcludeEndTime = new Date();
var defaultExcludeEndHour = (defaultExcludeEndTime.getHours() + 2) % 24;
var defaultExcludeEndMinute = defaultExcludeEndTime.getMinutes() < 15 ? 0 : 30;
var defaultExcludeStartTimeText = formatTime(defaultExcludeStartHour, defaultExcludeStartMin, Use24HourClock);
var defaultExcludeEndTimeText = formatTime(defaultExcludeEndHour, defaultExcludeEndMinute, Use24HourClock);
$('#exclude_start').val(defaultExcludeStartTimeText);
$('#exclude_start_text').text(defaultExcludeStartTimeText);
$('#exclude_end').val(defaultExcludeEndTimeText);
$('#exclude_end_text').text(defaultExcludeEndTimeText);
if(scheduleType == SINGLE_SCHEDULE)
{
if (schedule.bUseFinishTime) {
$('#exclude_start').val(formatTime(sched.FinishHour, sched.FinishMinute, Use24HourClock));
$('#exclude_start_text').text(formatTime(sched.FinishHour, sched.FinishMinute, Use24HourClock));
$('#exclude_end').val(formatTime(sched.StartHour, sched.StartMinute, Use24HourClock));
$('#exclude_end_text').text(formatTime(sched.StartHour, sched.StartMinute, Use24HourClock));
} else {
$('#backup_start').val(formatTime(sched.StartHour, sched.StartMinute, Use24HourClock));
$('#backup_start_text').text(formatTime(sched.StartHour, sched.StartMinute, Use24HourClock));
}
}
}
function checkUnsaved()
{
if(!localNav && needsCommit && BUTTON_YES == HtmlMessageBox2("crbUnsavedSchedule", BUTTONS_YESNO))
ApplyScheduleChanges();
localNav = false;
}
function ValidityTest()
{
var bValid = schedule.IsValidTimeWindow();
var bNoDays = schedule.Days == 0;
if(!bValid || bNoDays)
{
HtmlMessageBox2(bNoDays ? "crbNoDaysChosen" : "crbInvalidTimeSpan", BUTTON_OK);
needsCommit = false;
}
return bValid && !bNoDays;
}
this.SaveEdit = function ()
{
if(ValidityTest() && !SaveEditSchedule())
HtmlMessageBox2("crbDuplicateSchedule", BUTTON_OK);
}
this.ApplyChanges = function (onsavedfunc)
{
if(scheduleType != SINGLE_SCHEDULE || ValidityTest())
ApplyScheduleChanges(onsavedfunc);
}
this.SetCurrentSchedule = function (schedValue)
{
schedule = schedValue;
}
this.SetCurrentScheduleType = function (typeValue)
{
scheduleType = typeValue;
}
this.GetCurrentSchedule = function ()
{
return schedule;
}
}
var ScheduleSettings = new ScheduleSettings__();
var MIScheduleSettings = new MIScheduleSettings__();
/* End included file /js/schedule.js */
// defines openOrderWithVerification
/* Carbonite Service included file /js/alert.js */
// (c) Carbonite, Inc., 2005-2009 All rights reserved
/* Carbonite Service included file /scripts/progressmeter.class.js */
// (c) Carbonite, Inc., 2005-2009 All rights reserved
var DEFAULT_INCREMENT_PAUSE = 25;
ProgressMeter = function(barObj, valueField, initialPause)
{
this.bar = barObj;
this.target = (null != barObj) ? barObj.firstChild : null;
this.maxWidth = this.bar.offsetWidth - 2; // track the maximum width, so that we do not bump it up by more than this
this.valueField = valueField;
this.newWidth = 0;
this.pctDone = 0;
this.incrementPause = null;
this.SetIncrementInterval(initialPause);
var self = this;
this.IncrementProgress = function()
{
if (self.target && self.target.offsetWidth < self.newWidth)
{
self.target.style.width = (self.target.offsetWidth < self.maxWidth) ? self.target.offsetWidth + 1 : self.maxWidth;
if (self.target.offsetWidth < self.newWidth)
setTimeout(self.IncrementProgress, self.incrementPause);
}
self.UpdateValueField();
}
}
ProgressMeter.prototype.UpdateValueField = function()
{
if (this.valueField) {
var visiblePercentage = (Math.round((this.target.offsetWidth * 100) / this.maxWidth));
if (visiblePercentage >= 100 && this.pctDone < 100) {
visiblePercentage = 99.99; // it's so close to being done, but not quite there
}
if (this.target.offsetWidth < this.newWidth) {
this.valueField.innerText = visiblePercentage + "%";
}
else {
// Something is wrong with the indicator, but let's at least
// make the number look correct.
this.valueField.innerText = this.pctDone + "%";
}
}
}
ProgressMeter.prototype.SetProgressMeter = function(pctDone)
{
// quick return if we're already reflecting this value
if (this.pctDone == pctDone)
return;
if (this.target && this.bar)
{
var prevPctDone = this.pctDone;
this.pctDone = (pctDone > 100) ? 100 : ((pctDone < 0) ? 0 : pctDone);
var isDownshift = prevPctDone > this.pctDone;
// Ensure that the target and the bar are visible
this.bar.style.display = "";
this.target.style.display = "";
// if we had't yet reached the previous limit, bump up and decrease the pause
if (this.target.offsetWidth < this.newWidth)
{
this.target.style.width = this.newWidth;
this.incrementPause -= parseInt(this.incrementPause / 10);
}
else if (this.newWidth > 0)
this.incrementPause += parseInt(this.incrementPause / 10);
this.newWidth = parseInt(this.maxWidth * (this.pctDone / 100));
if (this.pctDone == 100 || isDownshift)
{
this.target.style.width = this.newWidth;
this.UpdateValueField();
}
else
this.IncrementProgress();
}
}
ProgressMeter.prototype.SetIncrementInterval = function(newIncrement)
{
this.incrementPause = (null != newIncrement) ? newIncrement : DEFAULT_INCREMENT_PAUSE;
}
////////
ProgressMercuryMeter = function(barObj, valueField, initialValue, initialPause)
{
this.initialized = false;
this.bar = barObj;
// There are two children. The first one draws the border and the
// second one draws the mercury.
var mercuryBorder = (null != barObj) ? barObj.firstChild : null;
var progressMercury = (null != barObj) ? barObj.lastChild : null;
var leftImg = null;
var centerImg = null;
var rightImg = null;
var leftWidth = 0;
var centerWidth = 0;
var rightWidth = 0;
if (progressMercury != null && (mercuryBorder != progressMercury)) {
var borderImgs = mercuryBorder.getElementsByTagName("IMG");
var mercuryImgs = progressMercury.getElementsByTagName("IMG");
if ((3 == borderImgs.length) && (3 == mercuryImgs.length)) {
// Assume hight is same for all the three image elements.
leftWidth = borderImgs[0].width;
centerWidth = borderImgs[1].width;
rightWidth = borderImgs[2].width;
leftImg = mercuryImgs[0];
centerImg = mercuryImgs[1];
rightImg = mercuryImgs[2];
// We are just starting so set the width of all the three
// images to 0 width.
leftImg.style.width = 0 + "px";
centerImg.style.width = 0 + "px";
rightImg.style.width = 0 + "px";
leftImg.style.height = borderImgs[0].height;
centerImg.style.height = borderImgs[1].height;
rightImg.style.height = borderImgs[2].height;
}
else {
progressMercury = null;
}
}
this.leftWidth = leftWidth;
this.centerWidth = centerWidth;
this.rightWidth = rightWidth;
this.leftImg = leftImg;
this.centerImg = centerImg;
this.rightImg = rightImg;
this.progressMercury = progressMercury;
// Track the maximum width, so that we do not bump it up by more than this.
this.maxWidth = (null != this.bar) ? this.bar.offsetWidth : 0;
this.valueField = valueField;
this.newWidth = 0;
this.pctDone = 0;
this.incrementPause = null;
this.SetIncrementInterval(initialPause);
var self = this;
this.IncrementProgress = function()
{
if (!self.hasImages()) {
return;
}
var offsetWidth = self.getOffsetWidth();
if (offsetWidth <= self.newWidth) {
var currWidth = (offsetWidth < self.maxWidth) ? offsetWidth + 1 : self.maxWidth;
self.distributeWidth(currWidth, self);
if (offsetWidth < self.newWidth) {
setTimeout(self.IncrementProgress, self.incrementPause);
}
}
self.UpdateValueField();
}
if (initialValue === undefined || isNaN(initialValue)) {
initialValue = 0;
}
this.SetProgressMeter(initialValue, true);
this.initialized = true;
}
ProgressMercuryMeter.prototype.hasImages = function()
{
return (null != this.progressMercury);
}
ProgressMercuryMeter.prototype.getOffsetWidth = function()
{
var width = 0;
if (this.hasImages()) {
width = this.leftImg.width + this.centerImg.width + this.rightImg.width;
}
return width;
}
ProgressMercuryMeter.prototype.UpdateValueField = function()
{
if (this.valueField) {
var visiblePercentage = (Math.round((this.getOffsetWidth() * 100) / this.maxWidth));
if (visiblePercentage >= 100 && this.pctDone < 100) {
// It's so close to being done, but not quite there.
visiblePercentage = 99.99;
}
if (this.getOffsetWidth() < this.newWidth) {
this.valueField.innerText = visiblePercentage + "%";
}
else {
// Something is wrong with the indicator, but let's at least
// make the number look correct.
this.valueField.innerText = this.pctDone + "%";
}
}
}
ProgressMercuryMeter.prototype.distributeWidth = function(width, self)
{
var leftImg = self.leftImg
var centerImg = self.centerImg
var rightImg = self.rightImg
// Distribute this width to the three images.
if (width <= self.leftWidth) {
leftImg.style.width = Math.max(width, 0) + "px";
centerImg.style.width = "0px";
rightImg.style.width = "0px";
}
else if (width <= self.leftWidth + self.rightWidth) {
leftImg.style.width = self.leftWidth;
centerImg.style.width = "0px";
rightImg.style.width = (width - self.leftWidth) + "px";
}
else {
var edgeWidth = self.leftWidth + self.rightWidth;
leftImg.style.width = self.leftWidth;
centerImg.style.width = Math.min((width - edgeWidth), self.centerWidth) + "px";
rightImg.style.width = self.rightWidth;
}
}
ProgressMercuryMeter.prototype.SetProgressMeter = function(pctDone, force)
{
// quick return if we're already reflecting this value
if (this.initialized && this.pctDone == pctDone) {
return;
}
if (!force) {
// If the last value is <= 0 then force anyway.
force = this.pctDone <= 0;
}
if (this.hasImages() && this.bar) {
var prevPctDone = this.pctDone;
this.pctDone = (pctDone > 100) ? 100 : ((pctDone < 0) ? 0 : pctDone);
var isDownshift = prevPctDone > this.pctDone;
// Ensure that the target and the bar are visible.
this.bar.style.display = "";
this.progressMercury.style.display = "";
// If we had't yet reached the previous limit, bump up and decrease
// the pause.
if (this.getOffsetWidth() < this.newWidth) {
this.distributeWidth(this.newWidth, this);
this.incrementPause -= parseInt(this.incrementPause / 10);
}
else if (this.newWidth > 0) {
this.incrementPause += parseInt(this.incrementPause / 10);
}
this.newWidth = parseInt(this.maxWidth * (this.pctDone / 100));
if (force || this.pctDone == 100 || isDownshift) {
this.distributeWidth(this.newWidth, this);
this.UpdateValueField();
}
else {
this.IncrementProgress();
}
}
}
ProgressMercuryMeter.prototype.SetIncrementInterval = function(newIncrement)
{
this.incrementPause = (null != newIncrement) ? newIncrement : DEFAULT_INCREMENT_PAUSE;
}
/* End included file /scripts/progressmeter.class.js */
/* Carbonite Service SKIPPING already included file /scripts/serviceinterconnect.js */
/* Carbonite Service SKIPPING already included file /scripts/commonfunctions.js */
/* Carbonite Service SKIPPING already included file /scripts/messagebox.js */
/* Carbonite Service included file /scripts/numberformat.js */
// (c) Carbonite, Inc., 2005-2009 All rights reserved
/* Carbonite Service SKIPPING already included file /js/config.js */
/* If comma-formatting is turned on, format the display of the input element */
function crbFormatNumber(eltName)
{
if (Config.useNumberFormatting())
{
if (null != (elt = document.getElementById(eltName)))
elt.innerHTML = new NumberFormat(elt.innerHTML).toFormatted();
}
}
function jqFormatNumber(jQueryObj)
{
if(Config.useNumberFormatting())
{
var existingValue = jQueryObj.html();
jQueryObj.html(new NumberFormat(existingValue).toFormatted());
}
}
function NumberFormat(num, inputDecimal)
{
this.VERSION = 'Number Format v1.5.4';
this.COMMA = Config.thousandsSeparator();
this.PERIOD = Config.decimalSeparator();
this.DASH = '-';
this.LEFT_PAREN = '(';
this.RIGHT_PAREN = ')';
this.LEFT_OUTSIDE = 0;
this.LEFT_INSIDE = 1;
this.RIGHT_INSIDE = 2;
this.RIGHT_OUTSIDE = 3;
this.LEFT_DASH = 0;
this.RIGHT_DASH = 1;
this.PARENTHESIS = 2;
this.NO_ROUNDING = -1
this.num;
this.numOriginal;
this.hasSeparators = false;
this.separatorValue;
this.inputDecimalValue;
this.decimalValue;
this.negativeFormat;
this.negativeRed;
this.hasCurrency;
this.currencyPosition;
this.currencyValue;
this.places;
this.roundToPlaces;
this.truncate;
this.setNumber = setNumberNF;
this.toUnformatted = toUnformattedNF;
this.setInputDecimal = setInputDecimalNF;
this.setSeparators = setSeparatorsNF;
this.setCommas = setCommasNF;
this.setNegativeFormat = setNegativeFormatNF;
this.setNegativeRed = setNegativeRedNF;
this.setCurrency = setCurrencyNF;
this.setCurrencyPrefix = setCurrencyPrefixNF;
this.setCurrencyValue = setCurrencyValueNF;
this.setCurrencyPosition = setCurrencyPositionNF;
this.setPlaces = setPlacesNF;
this.toFormatted = toFormattedNF;
this.toPercentage = toPercentageNF;
this.getOriginal = getOriginalNF;
this.moveDecimalRight = moveDecimalRightNF;
this.moveDecimalLeft = moveDecimalLeftNF;
this.getRounded = getRoundedNF;
this.preserveZeros = preserveZerosNF;
this.justNumber = justNumberNF;
this.expandExponential = expandExponentialNF;
this.getZeros = getZerosNF;
this.moveDecimalAsString = moveDecimalAsStringNF;
this.moveDecimal = moveDecimalNF;
this.addSeparators = addSeparatorsNF;
if (inputDecimal == null)
{
this.setNumber(num, this.PERIOD);
}
else
{
this.setNumber(num, inputDecimal);
}
this.setCommas(true);
this.setNegativeFormat(this.LEFT_DASH);
this.setNegativeRed(false);
this.setCurrency(false);
this.setCurrencyPrefix('$');
this.setPlaces(0);
}
function setInputDecimalNF(val)
{
this.inputDecimalValue = val;
}
function setNumberNF(num, inputDecimal)
{
if (inputDecimal != null)
{
this.setInputDecimal(inputDecimal);
}
this.numOriginal = num;
this.num = this.justNumber(num);
}
function toUnformattedNF()
{
return (this.num);
}
function getOriginalNF()
{
return (this.numOriginal);
}
function setNegativeFormatNF(format)
{
this.negativeFormat = format;
}
function setNegativeRedNF(isRed)
{
this.negativeRed = isRed;
}
function setSeparatorsNF(isC, separator, decimal)
{
this.hasSeparators = isC;
if (separator == null)
separator = this.COMMA;
if (decimal == null)
decimal = this.PERIOD;
if (separator == decimal)
{
this.decimalValue = (decimal == this.PERIOD) ? this.COMMA : this.PERIOD;
}
else
{
this.decimalValue = decimal;
}
this.separatorValue = separator;
}
function setCommasNF(isC)
{
this.setSeparators(isC, this.COMMA, this.PERIOD);
}
function setCurrencyNF(isC)
{
this.hasCurrency = isC;
}
function setCurrencyValueNF(val)
{
this.currencyValue = val;
}
function setCurrencyPrefixNF(cp)
{
this.setCurrencyValue(cp);
this.setCurrencyPosition(this.LEFT_OUTSIDE);
}
function setCurrencyPositionNF(cp)
{
this.currencyPosition = cp;
}
function setPlacesNF(p, tr)
{
this.roundToPlaces = !(p == this.NO_ROUNDING);
this.truncate = (tr != null && tr);
this.places = (p < 0) ? 0 : p;
}
function addSeparatorsNF(nStr, inD, outD, sep)
{
nStr += '';
var dpos = nStr.indexOf(inD);
var nStrEnd = '';
if (dpos != -1)
{
nStrEnd = outD + nStr.substring(dpos + 1, nStr.length);
nStr = nStr.substring(0, dpos);
}
var rgx = /(\d+)(\d{3})/;
while (rgx.test(nStr))
{
nStr = nStr.replace(rgx, '$1' + sep + '$2');
}
return nStr + nStrEnd;
}
function toFormattedNF()
{
var pos;
var nNum = this.num;
var nStr;
var splitString = new Array(2);
if (this.roundToPlaces)
{
nNum = this.getRounded(nNum);
nStr = this.preserveZeros(Math.abs(nNum));
}
else
{
nStr = this.expandExponential(Math.abs(nNum));
}
if (this.hasSeparators)
{
nStr = this.addSeparators(nStr, this.PERIOD, this.decimalValue, this.separatorValue);
}
else
{
nStr = nStr.replace(new RegExp('\\' + this.PERIOD), this.decimalValue);
}
var c0 = '';
var n0 = '';
var c1 = '';
var n1 = '';
var n2 = '';
var c2 = '';
var n3 = '';
var c3 = '';
var negSignL = (this.negativeFormat == this.PARENTHESIS) ? this.LEFT_PAREN : this.DASH;
var negSignR = (this.negativeFormat == this.PARENTHESIS) ? this.RIGHT_PAREN : this.DASH;
if (this.currencyPosition == this.LEFT_OUTSIDE)
{
if (nNum < 0)
{
if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS)
n1 = negSignL;
if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS)
n2 = negSignR;
}
if (this.hasCurrency)
c0 = this.currencyValue;
}
else if (this.currencyPosition == this.LEFT_INSIDE)
{
if (nNum < 0)
{
if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS)
n0 = negSignL;
if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS)
n3 = negSignR;
}
if (this.hasCurrency)
c1 = this.currencyValue;
}
else if (this.currencyPosition == this.RIGHT_INSIDE)
{
if (nNum < 0)
{
if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS)
n0 = negSignL;
if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS)
n3 = negSignR;
}
if (this.hasCurrency)
c2 = this.currencyValue;
}
else if (this.currencyPosition == this.RIGHT_OUTSIDE)
{
if (nNum < 0)
{
if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS)
n1 = negSignL;
if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS)
n2 = negSignR;
}
if (this.hasCurrency)
c3 = this.currencyValue;
}
nStr = c0 + n0 + c1 + n1 + nStr + n2 + c2 + n3 + c3;
if (this.negativeRed && nNum < 0)
{
nStr = '<font color="red">' + nStr + '</font>';
}
return (nStr);
}
function toPercentageNF()
{
nNum = this.num * 100;
nNum = this.getRounded(nNum);
return nNum + '%';
}
function getZerosNF(places)
{
var extraZ = '';
var i;
for (i = 0; i < places; i++)
{
extraZ += '0';
}
return extraZ;
}
function expandExponentialNF(origVal)
{
if (isNaN(origVal))
return origVal;
var newVal = parseFloat(origVal) + '';
var eLoc = newVal.toLowerCase().indexOf('e');
if (eLoc != -1)
{
var plusLoc = newVal.toLowerCase().indexOf('+');
var negLoc = newVal.toLowerCase().indexOf('-', eLoc);
var justNumber = newVal.substring(0, eLoc);
if (negLoc != -1)
{
var places = newVal.substring(negLoc + 1, newVal.length);
justNumber = this.moveDecimalAsString(justNumber, true, parseInt(places));
}
else
{
if (plusLoc == -1)
plusLoc = eLoc;
var places = newVal.substring(plusLoc + 1, newVal.length);
justNumber = this.moveDecimalAsString(justNumber, false, parseInt(places));
}
newVal = justNumber;
}
return newVal;
}
function moveDecimalRightNF(val, places)
{
var newVal = '';
if (places == null)
newVal = this.moveDecimal(val, false);
else
newVal = this.moveDecimal(val, false, places);
return newVal;
}
function moveDecimalLeftNF(val, places)
{
var newVal = '';
if (places == null)
newVal = this.moveDecimal(val, true);
else
newVal = this.moveDecimal(val, true, places);
return newVal;
}
function moveDecimalAsStringNF(val, left, places)
{
var spaces = (arguments.length < 3) ? this.places : places;
if (spaces <= 0)
return val;
var newVal = val + '';
var extraZ = this.getZeros(spaces);
var re1 = new RegExp('([0-9.]+)');
if (left)
{
newVal = newVal.replace(re1, extraZ + '$1');
var re2 = new RegExp('(-?)([0-9]*)([0-9]{' + spaces + '})(\\.?)');
newVal = newVal.replace(re2, '$1$2.$3');
}
else
{
var reArray = re1.exec(newVal);
if (reArray != null)
{
newVal = newVal.substring(0, reArray.index) + reArray[1] + extraZ + newVal.substring(reArray.index + reArray[0].length);
}
var re2 = new RegExp('(-?)([0-9]*)(\\.?)([0-9]{' + spaces + '})');
newVal = newVal.replace(re2, '$1$2$4.');
}
newVal = newVal.replace(/\.$/, '');
return newVal;
}
function moveDecimalNF(val, left, places)
{
var newVal = '';
if (places == null)
newVal = this.moveDecimalAsString(val, left);
else
newVal = this.moveDecimalAsString(val, left, places);
return parseFloat(newVal);
}
function getRoundedNF(val)
{
val = this.moveDecimalRight(val);
if (this.truncate)
val = val >= 0 ? Math.floor(val) : Math.ceil(val);
else
val = Math.round(val);
val = this.moveDecimalLeft(val);
return val;
}
function preserveZerosNF(val)
{
var i;
val = this.expandExponential(val);
if (this.places <= 0)
return val;
var decimalPos = val.indexOf('.');
if (decimalPos == -1)
{
val += '.';
for (i = 0; i < this.places; i++)
{
val += '0';
}
}
else
{
var actualDecimals = (val.length - 1) - decimalPos;
var difference = this.places - actualDecimals;
for (i = 0; i < difference; i++)
{
val += '0';
}
}
return val;
}
function justNumberNF(val)
{
newVal = val + '';
var isPercentage = false;
if (newVal.indexOf('%') != -1)
{
newVal = newVal.replace(/\%/g, '');
isPercentage = true;
}
var re = new RegExp('[^\\' + this.inputDecimalValue + '\\d\\-\\+\\(\\)eE]', 'g');
newVal = newVal.replace(re, '');
var tempRe = new RegExp('[' + this.inputDecimalValue + ']', 'g');
var treArray = tempRe.exec(newVal);
if (treArray != null)
{
var tempRight = newVal.substring(treArray.index + treArray[0].length);
newVal = newVal.substring(0, treArray.index) + this.PERIOD + tempRight.replace(tempRe, '');
}
if (newVal.charAt(newVal.length - 1) == this.DASH)
{
newVal = newVal.substring(0, newVal.length - 1);
newVal = '-' + newVal;
}
else if (newVal.charAt(0) == this.LEFT_PAREN && newVal.charAt(newVal.length - 1) == this.RIGHT_PAREN)
{
newVal = newVal.substring(1, newVal.length - 1);
newVal = '-' + newVal;
}
newVal = parseFloat(newVal);
if (!isFinite(newVal))
{
newVal = 0;
}
if (isPercentage)
{
newVal = this.moveDecimalLeft(newVal, 2);
}
return newVal;
}
/* End included file /scripts/numberformat.js */
/* Carbonite Service included file /scripts/objectjson.js */
// (c) Carbonite, Inc., 2005-2011 All rights reserved
// Convert JSON string contents to a real object
function ObjectJSON(sJSON)
{
// try catch handling to work around a bug in IE9 - trim does not remove a final
// control character within the string, but it does in other IE flavours
try
{
eval('var jObj = ' + sJSON + ';');
}
catch(e)
{
eval('var jObj = ' + sJSON.substring(0, sJSON.length - 1) + ';');
}
return jObj;
}
function FormatDate(timeAmount)
{
if (timeAmount == null) return null;
var date = new Date(timeAmount);
return date.toLocaleDateString() + " " + date.toLocaleTimeString();
}
/* ObjectWrapperBase
If JSON does not always include all fields for an object, it is up to the consumer to assume null if not present
This leads to a lot of client code that tests whether all items in the path are present:
e.g.
if(obj.A && obj.A.x && obj.A.x.P)
m = obj.A.x.P;
ObjectWrapperBase allows one to predeclare member names, and have them prefilled with null
so as to avoid constant checking of existence.
m = objWrap.P; // will be null if any of the items above are null
*/
ObjectWrapperBase = function()
{
this.baseObj = null;
}
ObjectWrapperBase.prototype.setObject = function (obj, doMapAllProperties)
{
// default to map all properties - pass "false" to doMap in order to specify map if desired
if (null == doMapAllProperties) doMapAllProperties = true;
this.baseObj = obj;
if (doMapAllProperties)
this.mapAllProperties();
}
// Find the child within the underlying object, or return null if child path is invalid
ObjectWrapperBase.prototype.FindChild = function (objPath)
{
if (null == this.baseObj) return null;
var objCheck = objPath.split('.');
var objName = "this.baseObj";
var ok = null;
for (var i = 0; i < objCheck.length; i++)
{
objName += "." + objCheck[i];
try
{
ok = eval(objName);
}
catch (e)
{
ok = null;
}
if (null == ok) return null;
}
return ok;
}
// call FindChild for to map properies in the underlying object and the exposed object
ObjectWrapperBase.prototype.mapProperties = function (mapArray)
{
for (var i = 0; i < mapArray.length; ++i)
{
var wrappedName = (mapArray[i].length < 2) ? mapArray[i][0] : mapArray[i][1];
eval("this." + mapArray[i][0] + " = this.FindChild('" + wrappedName + "');");
}
}
ObjectWrapperBase.prototype.mapAllProperties = function ()
{
// maps all the properites that it can find in the underlying object
for (prop in this.baseObj)
{
eval("this." + prop + " = this.baseObj." + prop);
}
}
ObjectWrapperBase.prototype.getDateTimeFormat = function (timeObj)
{
if (null == timeObj)
return '';
var useOffset = 0;// (new Date()).getTimezoneOffset() - timeObj.utcOffsetInMin; // it seems like we should be using this offset, but it is actually unused (source: Nathan @ Rebit)
return FormatDate(1000 * (parseFloat(timeObj.time) - useOffset * 60));
}
/* End included file /scripts/objectjson.js */
// need for AccountIsTrial, nExpiryDays, openOrder
/* Carbonite Service SKIPPING already included file /js/navigation.js */
// need for drawing the line to simulate the window size when viewed
// from within the debugger.
/* Carbonite Service included file /js/displayinfo.js */
function getDisplayInfoValue(displayInfo, fieldName)
{
var re = new RegExp(fieldName + ": *([0-9]+)");
var matches = displayInfo.match(re);
if (matches == null || matches.length < 2) {
return null;
}
return matches[1];
}
if (typeof(jQuery) != "undefined" && typeof(external.LogMsg) == "undefined") {
jQuery(document).ready(function ($) {
var displayInfo = document.getElementById('crbDisplayInfo').content;
var width = getDisplayInfoValue(displayInfo, "width");
var height = getDisplayInfoValue(displayInfo, "height");
if (width && height) {
var div = document.createElement('div');
div.style.top = 0;
div.style.left = 0;
div.style.height = height + "px";
div.style.width = width + "px";
div.style.borderWidth = "1px";
div.style.borderStyle = "solid";
div.style.borderColor = "black";
div.style.position = "absolute";
div.style.zIndex = -1;
document.body.appendChild(div);
}
});
}
/* End included file /js/displayinfo.js */
// global functions
// used elsewhere (Installation.js, PrivateKey.js, RestoreWizard.js)
/* Takes an element ID; clicks the element */
function crbClick(id)
{
if (null != (elt = document.getElementById(id)))
elt.click();
//If the element is not in this document, try the top document (e.g., for clickable elements in InfoCenter-Status.htm)
else if (null != (elt = top.document.getElementById(id)))
elt.click();
}
// where used?
function selectDefaultBackupSet(blnClose)
{
if (crbConfirm("strSelectedDefaultBackup"))
{
crbClick("crbSelectDefaultBackupSet");
if (blnClose)
{
crbClick("crbClose");
}
}
}
// where used?
function selectManualBackupSet(blnClose)
{
if (crbConfirm("strSelectedManualBackup"))
{
crbClick("crbSelectManualBackupSet");
if (blnClose)
{
crbClick("crbClose");
}
}
}
// scoping of Alerts functionality
var __Alert = function ()
{
var self = this;
var nIntervalId;
var nCountdown = 30;
var strDays = "days";
var strHours = "h";
var strMinutes = "m";
var fnCheckPurchase = null;
var nPurchaseTimeout = null;
var nPurchaseTimeoutMs = 30000; // Timeout and check for a purchase after 30 seconds
var nBackedUpCount = -1;
var progressMercury = null;
var nRestorePendingCount = 0;
var interconnect;
this.startInterconnect = function ()
{
interconnect = new ServiceInterconnect(
{
name: "InfoCenter-Alerts.js" + (new Date()).getTime(),
items: "DownloadServer,HomeServer1,UserEmail,RecoverMode,PausedMinutes,RestorePendingCount," +
"RestoredCount,RestoreErrorCount,BackedUpCount,BackedUpSize,SubscriptionInfo," +
"Quota,TotalBackupSize,QuotaUsagePct,OverQuotaSize,BackupDiscoverer",
onPush: self.pushHandler
});
interconnect.start();
}
function updatePurchaseStatus()
{
if(nPurchaseTimeout)
{
clearTimeout(nPurchaseTimeout);
nPurchaseTimeout = null;
logTrace("SubscriptionInfo updated, calling CheckPurchase function:" + fnCheckPurchase);
if(fnCheckPurchase)
fnCheckPurchase();
}
}
this.pushHandler = function (node)
{
try
{
//Update common InfoCenter operations first
if(Navigation.CommonPushHandler)
{
Navigation.CommonPushHandler(node);
}
switch(node.id)
{
case "QuotaUsagePct":
var widthPercent = node.innerHTML;
var pctComplete = parseInt(widthPercent, 10);
if(null == progressMercury)
{
var quotaMeterElement = document.getElementById("crbQuotaMeter");
if(quotaMeterElement != null)
{
progressMercury = new ProgressMercuryMeter(quotaMeterElement.parentElement, document.getElementById("crbQuotaUsagePct"), pctComplete);
}
}
else
{
progressMercury.SetProgressMeter(pctComplete);
}
break;
case "SubscriptionInfo":
var subInfo = ObjectJSON(node.innerText);
Navigation.nExpiryDays = subInfo.ExpiryDays;
Navigation.AccountIsTrial = subInfo.AccountIsTrial;
updatePurchaseStatus();
break;
case "PausedMinutes":
updatePausedTime();
break;
case "RecoverMode":
if(null != (target = document.getElementById("crbExitRecoverModeMessage")))
{
target.style.display = (node.innerHTML == 1) ? "block" : "none";
}
if(null != (target = document.getElementById("crbRestoreDoneButton")))
{
target.style.display = (node.innerHTML == 1) ? "none" : "block";
}
break;
case "RestoreErrorCount":
/* Show a warning on alert-restore-finished.htm if there are restore errors */
if(null != (target = document.getElementById("crbRestoreErrorWarning")))
target.style.display = (node.innerHTML > 0) ? "block" : "none";
/* Show the restore error count if there are restore errors */
if(null != (target = document.getElementById("liRestoreErrors")))
target.style.display = (node.innerHTML == 0) ? "none" : "block";
break;
case "BackupDiscoverer":
//the value is a bitfield of (msb-lsb) scanning|enabled
var nField = parseInt(node.innerHTML);
var bEnabled = 1 == (nField & 1);
var bScanning = 2 == (nField & 2);
//Use a function that deals with the strange behavior of IE6 and IE7 checkboxes to set checked value
CheckObject(crbBackupDiscoverer, bEnabled);
break;
case "RestorePendingCount":
nRestorePendingCount = parseFloat(node.innerHTML);
setViewRestoreStatusLinks();
// Note: deliberate fallthrough here to set crbRestorePendingCount
case "RestoredCount":
case "BackedUpCount":
//Set variable values, e.g. nBackedupCount
/*var varName = "n" + node.id;
eval(varName + "= parseFloat(node.innerHTML);");
trace(varName + " = " + eval(varName));
*/
//Set hidden spans with unformatted values
if(null != (elt = document.getElementById("crb" + node.id + "Unformatted")))
elt.innerHTML = node.innerHTML;
crbFormatNumber("crb" + node.id); // Comma-format file counts
break;
}
}
catch(e)
{
}
}
function setViewRestoreStatusLinks()
{
// View status li on alert-recover-mode.htm
var viewStatusListItem = $("#alert-recover-mode-restore-status-li")
if (viewStatusListItem.length > 0) // If we can find this link
{
viewStatusListItem.toggle(nRestorePendingCount > 0);
}
}
function countdown()
{
document.getElementById('crbCountdown').innerHTML = nCountdown;
if(nCountdown-- == 0)
{
window.clearInterval(nIntervalId);
crbClick('crbShutdown');
}
}
this.getShutdownReason = function ()
{
//what's the reason for wanting to delay the shutdown?
var sdReasonDiv = document.getElementById(queryString('delayreason'));
if(sdReasonDiv)
sdReasonDiv.style.display = "block";
//start a timer to countdown from 30 seconds and autoclick the shutdown button on timeout
nIntervalId = window.setInterval(countdown, 1000);
}
this.alertUpgradeOnLoad = function ()
{
var bIsAdmin = eval(document.getElementById("crbIsAdminUser").innerText);
var showMessage = bIsAdmin ? "AdminInstallUpdate" : "NeedAdminUpdate";
var showButton = bIsAdmin ? "crbUpgradeButton" : "crbOKButton";
document.getElementById(showMessage).style.display = "";
document.getElementById(showButton).style.display = "";
}
this.onLoadMissingFiles = function ()
{
//given data=file-count|missing-since|purge-in;...
//but, we'll sum up the file counts and present just one line of information
//using the time till the first file is purged
var body = document.body.innerHTML;
var qsdata = queryString('data');
if(qsdata == undefined)
return;
var buckets = qsdata.split(';');
var n = 0;
var fileCount = 0;
var missingSince = null;
var purgeIn = null;
for(var bucket in buckets)
{
if(buckets[bucket] == '')
continue;
var bucketInfo = buckets[bucket].split('|');
fileCount += parseInt(bucketInfo[0], 10);
if(null == missingSince)
{
missingSince = bucketInfo[1];
purgeIn = bucketInfo[2];
}
}
var summary = divSummary.innerHTML.replace(/{filecount}/g, fileCount)
summary = summary.replace(/{since}/g, missingSince);
summary = summary.replace(/{purge}/g, purgeIn);
divSummary.innerHTML = summary;
}
/******** Check for a purchase *******/
this.openOrderWithVerification = function (source, fnSuccess, fnFailure)
{
// Open the order page
Navigation.openOrder(source);
// For some languages, the purchase check is not required.
var pDoPurchaseCheck = top.document.getElementById("crbDoPurchaseCheck");
var intDoPurchaseCheck = (pDoPurchaseCheck && pDoPurchaseCheck.innerHTML) ? parseInt(pDoPurchaseCheck.innerHTML) : 1;
if(intDoPurchaseCheck == 1)
{
// Ask the user to click "OK" when they've purchased so we can go log in
if(crbConfirm2("crbConfirmPurchase"))
{
Wait.DoWait('lbPleaseWait');
checkPurchaseWithTimeout(fnSuccess, fnFailure, nPurchaseTimeoutMs);
}
}
else
{
// No purchase check -- just call the success function
if(fnSuccess)
fnSuccess();
}
}
function checkPurchaseWithTimeout(fnSuccess, fnFailure, t)
{
logTrace("Calling checkPurchaseWithTimeout with success function: " + fnSuccess + " and failure function: " + fnFailure);
// If you're a trial account or an expired paid account, we need to log in and check to see if you've paid
if(Navigation.AccountIsTrial || (Navigation.nExpiryDays <= 0))
{
//make the infocenter tell the service to do a purchase check
$('#crbCheckPurchase').click();
//wake back up in t milliseconds to see if the purchase happened like the user said it did
fnCheckPurchase = function () { Alert.checkPurchase(fnSuccess, fnFailure); };
nPurchaseTimeout = setTimeout(fnCheckPurchase, t);
}
// Otherwise we just say thanks
else
{
purchaseSuccessful(fnSuccess);
}
}
// Takes two functions: what to do if the purchase is successful, and what to do if it fails;
// functions can be null if there is no action to take
this.checkPurchase = function (fnSuccess, fnFailure)
{
logTrace("Inside checkPurchase: AccountIsTrial = " + Navigation.AccountIsTrial + " and nExpiryDays = " + Navigation.nExpiryDays);
if(Navigation.AccountIsTrial || (Navigation.nExpiryDays <= 0))
{
logTrace("Inside checkPurchase: No purchase detected.");
// If the user clicks OK to try again, check purchase status again
if(crbConfirm2("crbNotBoughtYet"))
{
checkPurchaseWithTimeout(fnSuccess, fnFailure, nPurchaseTimeoutMs);
}
else
{
purchaseFailure(fnFailure);
}
}
else
{
logTrace("Inside checkPurchase: Purchase detected.");
purchaseSuccessful(fnSuccess);
}
}
function purchaseSuccessful(fnSuccess)
{
Wait.StopWait();
clearTimeout(nPurchaseTimeout);
nPurchaseTimeout = null;
crbAlert("crbPurchaseSuccessful");
if(fnSuccess)
fnSuccess();
}
function purchaseFailure(fnFailure)
{
Wait.StopWait();
clearTimeout(nPurchaseTimeout);
nPurchaseTimeout = null;
if(fnFailure)
fnFailure();
}
// Converts crbPausedMinutes.innerText into a user-understandable duration
// (e.g. "5 hours, 32 seconds") and stores the result in the crbPausedTime
// element.
//
this.updatePausedTime = function ()
{
var source;
if(null == (source = document.getElementById("crbPausedMinutes")))
return;
var target;
if(null == (target = document.getElementById("crbPausedTime")))
return;
var pausedMins = source.innerHTML;
var nDays = Math.floor(pausedMins / 60 / 24);
var nHours = Math.floor(pausedMins / 60);
var nMins = pausedMins % 60;
// Localize the time labels (days, hours, minutes)
if(null != (elt = document.getElementById("crbStrDays")))
{
strDays = elt.innerHTML;
}
if(null != (elt = document.getElementById("crbStrHours")))
{
strHours = elt.innerHTML;
}
if(null != (elt = document.getElementById("crbStrMinutes")))
{
strMinutes = elt.innerHTML;
}
if(null != (elt = document.getElementById("crbStrDay")))
{
strDay = elt.innerHTML;
}
if(null != (elt = document.getElementById("crbStrHour")))
{
strHour = elt.innerHTML;
}
if(null != (elt = document.getElementById("crbStrMinute")))
{
strMinute = elt.innerHTML;
}
var sFormattedPause = '';
if(nDays > 0)
{
sFormattedPause = nDays + ' ' + (nDays == 1 ? strDay : strDays);
}
//don't show hours/minutes if days are set - too much detail
else
{
if(nHours > 0)
{
sFormattedPause += nHours + " " + (nHours == 1 ? strHour : strHours);
}
if(nMins > 0)
{
if(sFormattedPause != '')
sFormattedPause += ', ';
sFormattedPause += nMins + ' ' + (nMins == 1 ? strMinute : strMinutes);
}
}
target.innerHTML = sFormattedPause;
}
}
// the global Alert object to isolate operations within the about namespace
var Alert = new __Alert();
// Start the interconnect when ready
jQuery(document).ready(
function ()
{
Alert.startInterconnect();
}
);
/* End included file /js/alert.js */
/* Carbonite Service SKIPPING already included file /scripts/draganddrop.js */
/* Carbonite Service included file /scripts/privatekey.js */
// (c) Carbonite, Inc., 2005-2009 All rights reserved
// Need for crbAlert
/* Carbonite Service SKIPPING already included file /scripts/messagebox.js */
// need for crbClick
/* Carbonite Service SKIPPING already included file /js/alert.js */
function onImportBodyLoad()
{
//expect to be given a hint
crbPKHint.innerText = queryString('hint');
}
function setPrivateKeyBehavior()
{
if (!document.getElementById("crbManageKey").checked)
{
if (crbConfirm2("crbConfirmManageKey"))
{
/* Launch dialog box to solicit passphrase and hint */
//window.location.href="registration-private-key-export.htm";
Installation.onPhase("SaveKey");
return;
}
else
crbAlert("crbCancelManageKey");
}
crbClick("crbCancelManageKey");
}
var keyManagementDelegate__ = {
onPKExported: function() {
},
onPKManagementChange: function() {
},
onPKError: function() {
}
};
function onPKExport(res)
{
if (res == 0)
{
keyManagementDelegate__.onPKExported();
}
else if (res != "canx")
{
crbAlert("crbKeyExportFailed");
keyManagementDelegate__.onPKError();
}
}
function onPKImport(res)
{
if (res == 0)
crbClick("crbPKDone");
else
crbAlert("crbKeyImportFailed");
}
function onPKManagementChange(res)
{
if (res == 0)
{
crbAlert("crbKeyManagedByServer");
keyManagementDelegate__.onPKManagementChange();
}
else
{
crbAlert("crbKeyReturnFailed");
keyManagementDelegate__.onPKError();
}
return;
}
function onPKUnderstood()
{
element("crbPKExportButton").disabled = false == element("chkPKUnderstood").checked || false == checkPassword();
}
//retain the message id on failure
var sPasswordFailureMsgId = "";
function isPasswordValid(password)
{
sPasswordFailureMsgId = "";
if (0 == password.length)
return true;
if (password.length < 6)
{
sPasswordFailureMsgId = "crbPasswordTooShort";
return false;
}
var invalidChars = document.getElementById("crbInvalidPasswordChars").innerText;
var regexInvalid = new RegExp(invalidChars);
if (password.match(regexInvalid))
{
sPasswordFailureMsgId = "crbInvalidCharacter";
return false;
}
return true;
}
var count = 0;
function getPasswordValue()
{
var passwordElement = element("crbPKPassword");
if (passwordElement.type != "password")
{
if (count++ == 0)
debugger;
return "";
}
return passwordElement.value;
}
function getConfirmValue()
{
var confirmElement = element("crbPKConfirmPassword");
if (confirmElement.type != "password")
{
return "";
}
return confirmElement.value;
}
function isPasswordConfirmed()
{
if (getPasswordValue() != getConfirmValue())
{
sPasswordFailureMsgId = "crbNoPasswordMatch";
return false;
}
return true;
}
function checkPassword()
{
//user understands what they're doing?
if (false == element("chkPKUnderstood").checked)
{
crbAlert("crbNotUnderstood");
return false;
}
if (isPasswordValid(getPasswordValue()) && isPasswordConfirmed())
return true;
return false;
}
function onPKPasswordChange(async)
{
var sPassword = getPasswordValue();
var bPasswordIsBlank = ("" == sPassword);
var bPasswordIsValid = isPasswordValid(sPassword);
var bConfirmed = false;
if (bPasswordIsValid)
bConfirmed = isPasswordConfirmed();
//enable the save button?
onPKUnderstood();
//good password -- but don't show the checkmark if the password is blank
visibleElement(element("PKPasswordGood"), (bPasswordIsValid && !bPasswordIsBlank));
//confirmed password?
visibleElement(element("PKPasswordConfirmed"), bPasswordIsValid && "" != sPassword && bConfirmed);
//hint?
visibleElement(element("PKHintGood"), element("crbPKHint").value != "");
divPKError.innerHTML = "" == sPasswordFailureMsgId ? " " : element(sPasswordFailureMsgId).innerHTML;
}
// Starts a timer that will enable/disable the Save button and fill any error/status information the
// user might need to know about.
function startPKPasswordTimer()
{
var nPKPasswordMonitor = setInterval("onPKPasswordChange(true)", 500);
}
/* End included file /scripts/privatekey.js */
/* Carbonite Service included file /scripts/tooltips.js */
// (c) Carbonite, Inc., 2005-2009 All rights reserved
var lastTipId;
var showTip;
function ShowTipString(s, x, y)
{
var tipId = s + "tip";
// destroy the current one if it is different to this one.
if (lastTipId != tipId)
{
DestroyTipId(lastTipId);
lastTipId = tipId;
}
if (showTip)
clearTimeout(showTip);
if (x == null || y == null)
{
showTip = setTimeout("ShowTipString('" + s + "', " + ((x == null) ? event.clientX : x) + ", " + ((y == null) ? event.clientY : y) + ");", 300);
return;
}
var tipDiv = document.getElementById(tipId);
if (!tipDiv && s.length > 0)
{
tipDiv = document.createElement("div");
tipDiv.id = tipId;
tipDiv.className = "pathTip";
tipDiv.style.left = x - 20;
tipDiv.style.top = y + 15;
tipDiv.innerHTML = unescape(s);
document.body.appendChild(tipDiv);
// Now adjust the position if hidden off to the right
var tipRight = FindObjectPosition(tipDiv)[0] + tipDiv.offsetWidth;
if (document.body.clientWidth < tipRight)
tipDiv.style.left = x - 20 - (tipRight - document.body.clientWidth);
}
}
function HideTipString(s)
{
var tipId = s + "tip";
DestroyTipId(tipId);
}
function DestroyTipId(tipId)
{
var tipDiv = document.getElementById(tipId);
if (tipDiv)
document.body.removeChild(tipDiv);
if (lastTipId == tipId)
lastTipId = null;
if (showTip)
clearTimeout(showTip);
}
function ShowTip(obj)
{
ShowTipString(obj.innerHTML);
}
function HideTip(obj)
{
HideTipString(obj.innerHTML);
}
function HideLastTip()
{
DestroyTipId(lastTipId);
}
function ShowTipID(id)
{
if (document.getElementById(id))
ShowTip(document.getElementById(id));
}
function HideTipID(id)
{
if (document.getElementById(id))
HideTip(document.getElementById(id));
}
function AddTips()
{
// Go through the whole document and find all attributes tipId="xxx"
var attr, oldScript;
var childArray = document.all; //getElementsByTagName("*"); // ideally, we could use an xpath expression to query the DOM- unfortunately, this is only supported in Mozilla Firefox for now...
for (var i = 0; i < childArray.length; i++)
{
attr = childArray[i].attributes ? childArray[i].getAttribute("tipId") : null;
if (null != attr)
{
oldScript = childArray[i].onmouseover;
if (oldScript)
childArray[i].onmouseover = function()
{
eval(oldScript + " ");
ShowTipID(this.getAttribute("tipId"));
}
else
childArray[i].onmouseover = function()
{
ShowTipID(this.getAttribute("tipId"));
}
oldScript = childArray[i].onmouseout;
if (oldScript)
childArray[i].onmouseout = function()
{
eval(oldScript + " ");
HideTipID(this.getAttribute("tipId"));
}
else
childArray[i].onmouseout = function()
{
HideTipID(this.getAttribute("tipId"));
}
}
}
}
/* End included file /scripts/tooltips.js */
/* Carbonite Service included file /scripts/computerdescription.js */
// (c) Carbonite, Inc., 2005-2009 All rights reserved
/* Carbonite Service SKIPPING already included file /js/wait.js */
var ComputerDescription__ = function ()
{
var self = this;
var selectedMachineType = '';
// Set default machine type to 'desktop'. Also set focus to the edit field.
this.InitMachineDescriptions = function ()
{
inferSelectedMachineType();
if(selectedMachineType.length == 0)
{
PopulateMachineDescriptionsImpl("", "desktop");
}
$('#crbMachineDescription').focus();
}
function PopulateMachineDescriptionsImpl(desc, type)
{
if(desc != null && desc.length > 0)
$('#crbMachineDescription').val(desc);
if(type != null && type.length > 0)
$('#crbMachineType' + type).click();
}
this.PopulateMachineDescriptions = function (descInfo)
{
var splitAt = descInfo.lastIndexOf(";");
if(splitAt == 0)
return; // don't populate from empty
var desc = descInfo.substr(0, splitAt);
var type = descInfo.substr(splitAt + 1);
PopulateMachineDescriptionsImpl(desc, type);
}
function inferSelectedMachineType()
{
if(selectedMachineType.length == 0)
{
var typeArray = new Array("desktop", "laptop", "server");
for(var i = 0; i < typeArray.length; i++)
{
if($('#crbMachineType' + typeArray[i]).hasClass("SelectedMachine"))
{
selectedMachineType = typeArray[i];
break;
}
}
}
}
this.SetDescription = function (silent)
{
inferSelectedMachineType();
var desc = $('#crbMachineDescription').val();
var validChoice = desc.length > 0;
if(validChoice)
{
$('#crbMachineTypeString').val(selectedMachineType);
$('#crbFormattedMachineDescription').val(desc + ";" + selectedMachineType);
$('#crbDescriptionMade').click();
}
else if (!silent)
{
HtmlMessageBox2('crbPleaseSupplyDescription', BUTTON_OK);
}
return validChoice;
}
this.ChangeMachineDescription = function ()
{
Wait.Popup("crbChangeDescription");
$('#crbOKMachineDescription').focus();
}
this.SetMachineDescription = function (silent)
{
if(self.SetDescription(silent))
{
var desc = $('#crbMachineDescription').val();
$('#crbViewTypeDescription').text(desc);
$('#crbViewTypeDescription').attr("title", desc);
$('#computerTypeIcon').removeClass('laptop desktop server');
$('#computerTypeIcon').addClass($('#crbMachineTypeString').val());
Wait.StopPopup();
}
}
var tabbedMachineType = null;
this.HoverMachineType = function (mt)
{
if(tabbedMachineType == null)
HighlightMachineType(mt, true);
}
this.OutMachineType = function (mt)
{
if(tabbedMachineType == null)
HighlightMachineType(mt, false);
}
function HighlightMachineType(mt, highlightOn)
{
if(mt.className.indexOf("SelectedMachine") < 0) {
if (highlightOn) {
$(mt).addClass("HoverMachine");
}
else {
$(mt).removeClass("HoverMachine");
}
}
}
this.SelectMachineType = function (mt)
{
self.ReleaseMachineTypeFocus();
// They've clicked on it, blur it to remove the ugly dotted box
mt.blur();
ChooseMachineType(mt);
}
function ChooseMachineType(mt)
{
selectedMachineType = mt.id.substring(14);
$('#crbMachineTypedesktop, #crbMachineTypelaptop, #crbMachineTypeserver').removeClass("SelectedMachine");
$(mt).addClass('SelectedMachine');
}
/* Keyboard values */
var TAB = 9;
var ENTER = 13;
var SHIFT = 16;
var SPACEBAR = 32;
var LEFT_ARROW = 37;
var UP_ARROW = 38;
var RIGHT_ARROW = 39;
var DOWN_ARROW = 40;
this.SetMachineTypeFocus = function (mt)
{
tabbedMachineType = mt;
HighlightMachineType(mt, true);
}
this.ReleaseMachineTypeFocus = function ()
{
if(tabbedMachineType)
HighlightMachineType(tabbedMachineType, false);
tabbedMachineType = null;
}
this.MachineChosenTest = function (mt)
{
var key = window.event.keyCode;
if(key == ENTER)
ChooseMachineType(mt);
}
}
var ComputerDescription = new ComputerDescription__();
// Called from InfoCenter
function PopulateMachineDescriptions(descInfo)
{
ComputerDescription.PopulateMachineDescriptions(descInfo);
}
/* End included file /scripts/computerdescription.js */
/* Carbonite Service SKIPPING already included file /js/wait.js */
/* Carbonite Service included file /scripts/infocenter-tooltips.js */
// (c) Carbonite, Inc., 2005-2009 All rights reserved
var imagePath = "/images/tooltiparrow.gif";
function addtip()
{
var thealinks = document.getElementsByTagName("a");
if (!thealinks)
{
return;
}
for (var x = 0; x != thealinks.length; x++)
{
if (thealinks[x].className == "addToolTip")
{
thealinks[x].setAttribute("tooltiptext", thealinks[x].title);
thealinks[x].removeAttribute("title");
var openBrace;
var closeBrace;
// scripts within tags are wrapped inside function anonymous(){HERE} - we strip them and add the complete call - adding the space forces the conversion to a string of the embedded function
if (thealinks[x].onmouseover)
{
var sMouseOver = thealinks[x].onmouseover + " ";
openBrace = sMouseOver.indexOf('{');
closeBrace = sMouseOver.lastIndexOf('}');
sMouseOver = sMouseOver.substr(openBrace, closeBrace);
thealinks[x].onmouseover = function gomouseover()
{
eval(sMouseOver);
ddrivetip(this.getAttribute("tooltiptext"));
};
}
else
thealinks[x].onmouseover = function gomouseover()
{
ddrivetip(this.getAttribute("tooltiptext"));
};
if (thealinks[x].onmouseout)
{
var sMouseOut = thealinks[x].onmouseout + " ";
openBrace = sMouseOut.indexOf('{');
closeBrace = sMouseOut.lastIndexOf('}');
sMouseOut = sMouseOut.substr(openBrace, closeBrace);
thealinks[x].onmouseout = function gomouseout()
{
eval(sMouseOut);
hideddrivetip();
};
}
else
thealinks[x].onmouseout = function gomouseout()
{
hideddrivetip();
};
}
}
}
var offsetfromcursorX = -7; //Customize x offset of tooltip
var offsetfromcursorY = 20; //Customize y offset of tooltip
var offsetdivfrompointerX = 13; //Customize x offset of tooltip DIV relative to pointer image
var offsetdivfrompointerY = 13; //Customize y offset of tooltip DIV relative to pointer image. Tip: Set it to (height_of_pointer_image-1).
document.write('<div id="theToolTip" class="ToolTip"></div>'); //write out tooltip DIV
document.write('<img id="ToolTipPointer" class="ToolTipPointer" src="' + imagePath + '">'); //write out pointer image
var ie = document.all;
var ns6 = document.getElementById && !document.all;
var enabletip = false;
var enableTips = true;
if (ie || ns6)
{
var tipobj = document.all ? document.all["theToolTip"] : document.getElementById ? document.getElementById("theToolTip") : "";
}
var pointerobj = document.all ? document.all["ToolTipPointer"] : document.getElementById ? document.getElementById("ToolTipPointer") : "";
function ietruebody()
{
return (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body;
}
function ddrivetip(thetext, thewidth, thecolor)
{
if (enableTips && (ns6 || ie))
{
if (typeof thewidth !== "undefined")
{
tipobj.style.width = thewidth + "px";
}
if (typeof thecolor !== "undefined" && thecolor !== "")
{
tipobj.style.backgroundColor = thecolor;
}
tipobj.innerHTML = thetext;
enabletip = true;
return false;
}
}
function positiontip(e)
{
if (enabletip)
{
var nondefaultpos = false;
var curX = (ns6) ? e.pageX : event.clientX + ietruebody().scrollLeft;
var curY = (ns6) ? e.pageY : event.clientY + ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var winwidth = ie && !window.opera ? ietruebody().clientWidth : window.innerWidth - 20;
var winheight = ie && !window.opera ? ietruebody().clientHeight : window.innerHeight - 20;
var rightedge = ie && !window.opera ? winwidth - event.clientX - offsetfromcursorX : winwidth - e.clientX - offsetfromcursorX;
var bottomedge = ie && !window.opera ? winheight - event.clientY - offsetfromcursorY : winheight - e.clientY - offsetfromcursorY;
var leftedge = (offsetfromcursorX < 0) ? offsetfromcursorX * (-1) : -1000;
//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge < tipobj.offsetWidth)
{
//move the horizontal position of the menu to the left by it's width - 25 px
tipobj.style.left = curX - tipobj.offsetWidth + 25 + "px";
//Place the pointer graphic
pointerobj.style.top = curY + offsetfromcursorY + "px";
pointerobj.style.left = curX + offsetfromcursorX - 10 + "px";
}
else if (curX < leftedge)
{
tipobj.style.left = "5px";
}
else
{
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left = curX + offsetfromcursorX - offsetdivfrompointerX + "px";
pointerobj.style.left = curX + offsetfromcursorX + "px";
}
//same concept with the vertical position
if (bottomedge < tipobj.offsetHeight)
{
tipobj.style.top = curY - tipobj.offsetHeight - offsetfromcursorY + "px";
nondefaultpos = true;
}
else
{
tipobj.style.top = curY + offsetfromcursorY + offsetdivfrompointerY + "px";
pointerobj.style.top = curY + offsetfromcursorY + "px";
}
nondefaultpos |= AdjustWidth(tipobj, winwidth, winheight);
nondefaultpos |= AdjustHeight(tipobj, winwidth, winheight);
tipobj.style.visibility = "visible";
if (!nondefaultpos)
{
pointerobj.style.visibility = "visible";
}
else
{
pointerobj.style.visibility = "hidden";
}
}
}
function hideddrivetip()
{
if (ns6 || ie)
{
enabletip = false;
tipobj.style.visibility = "hidden";
pointerobj.style.visibility = "hidden";
tipobj.style.left = "-1000px";
tipobj.style.backgroundColor = '';
tipobj.style.width = '';
}
}
function AdjustWidth(tipobj, winwidth, winheight)
{
// If you alter this method, make the equivalent changes to AdjustHeight
var nondefaultpos = false;
// if it goes over the top adjust the width, but not more than available
while (getTop(tipobj) < 0 &&
getWidth(tipobj) < (winwidth - 10))
{
var bottom = getBottom(tipobj);
var increaseTo = getWidth(tipobj) * 1.1;
tipobj.style.width = (increaseTo < (winwidth - 10)) ? increaseTo : (winwidth - 10); // object will autoadjust height
tipobj.style.top = bottom - getHeight(tipobj); // set the bottom relative to the new height
tipobj.style.bottom = bottom; // set the bottom relative to the new height
}
// if it goes over the bottom adjust the width, but not more than available
while (getBottom(tipobj) > (winheight - 5) &&
getWidth(tipobj) < (winwidth - 10))
{
var top = getTop(tipobj);
var increaseTo = getWidth(tipobj) * 1.1;
tipobj.style.width = (increaseTo < (winwidth - 10)) ? increaseTo : (winwidth - 10); // object will autoadjust height
tipobj.style.top = top;
tipobj.style.bottom = top + getHeight(tipobj);
}
// prevent this from moving horizontally out of bounds
var overRight = getRight(tipobj) - (winwidth - 5);
if (overRight > 0)
{
tipobj.style.left = getLeft(tipobj) - overRight;
tipobj.style.right = winwidth - 5;
nondefaultpos = true;
}
var overLeft = 5 - getLeft(tipobj);
if (overLeft > 0)
{
tipobj.style.left = 5;
nondefaultpos = true;
}
return nondefaultpos;
}
function AdjustHeight(tipobj, winwidth, winheight)
{
// If you alter this method, make the equivalent changes to AdjustWidth
var nondefaultpos = false;
// if it goes over the left adjust the height
while (getLeft(tipobj) < 0 &&
getHeight(tipobj) < (winheight - 10))
{
var right = getRight(tipobj);
var increaseTo = getHeight(tipobj) * 1.1;
tipobj.style.height = (increaseTo < (winheight - 10)) ? increaseTo : (winheight - 10); // object will autoadjust width
tipobj.style.right = right;
tipobj.style.left = right - getWidth(tipobj);
}
// if it goes over the right adjust the height
while (parseInt(tipobj.style.right) > (winwidth - 5) && tipobj.offsetHeight < (winheight - 10))
{
var left = parseInt(tipobj.style.left);
var increaseTo = tipobj.offsetHeight * 1.1;
tipobj.style.height = (increaseTo < (winheight - 10)) ? increaseTo : (winheight - 10); // object will autoadjust width
tipobj.style.left = left;
tipobj.style.left = left + getWidth(tipobj);
}
// prevent this from moving vertically out of bounds
var overBottom = getBottom(tipobj) - (winheight - 5);
if (overBottom > 0)
{
tipobj.style.bottom = winheight - 5;
nondefaultpos = true;
}
var overTop = 5 - getTop(tipobj);
if (overTop > 0)
{
tipobj.style.top = 5;
nondefaultpos = true;
}
return nondefaultpos;
}
function _getActual(obj, sToGet)
{
var actual = eval("parseInt(obj.style." + sToGet + ")");
if (isNaN(actual))
actual = eval("obj.offset" + sToGet.substr(0, 1).toUpperCase() + sToGet.substr(1));
return actual;
}
function getTop(obj)
{
return _getActual(obj, "top");
}
function getLeft(obj)
{
return _getActual(obj, "left");
}
function getWidth(obj)
{
return _getActual(obj, "width");
}
function getHeight(obj)
{
return _getActual(obj, "height");
}
function getBottom(obj)
{
return getTop(obj) + getHeight(obj);
}
function getRight(obj)
{
return getLeft(obj) + getWidth(obj);
}
document.onmousemove = positiontip;
addtip();
/* End included file /scripts/infocenter-tooltips.js */
/* Carbonite Service included file /js/schedule.js */
// (c) Carbonite, Inc., 2005-2009 All rights reserved
/* Carbonite Service included file /scripts/schedule.class.js */
// (c) Carbonite, Inc., 2005-2009 All rights reserved
/* Carbonite Service included file /scripts/box.class.js */
// (c) Carbonite, Inc., 2005-2009 All rights reserved
box = function()
{
this.obj;
this.GetObject = function()
{
return this.obj;
}
this.SetObject = function(ob)
{
this.obj = ob;
}
}
/* End included file /scripts/box.class.js */
/* Carbonite Service SKIPPING already included file /scripts/commonfunctions.js */
var BACKUP_TYPE = "BackupType";
var START_HOUR = "StartHour";
var START_MINUTE = "StartMinute";
var START_AP = "StartAP";
var BACKUP_UNTIL = "BackupUntil";
var FINISH_HOUR = "FinishHour";
var FINISH_MINUTE = "FinishMinute";
var FINISH_AP = "FinishAP";
var ONCE_HOUR = "OnceHour";
var ONCE_MINUTE = "OnceMinute";
var ONCE_AP = "OnceAP";
var SSTART_HOUR = "SStartHour";
var SSTART_MINUTE = "SStartMinute";
var SSTART_AP = "SStartAP";
var SFINISH_HOUR = "SFinishHour";
var SFINISH_MINUTE = "SFinishMinute";
var SFINISH_AP = "SFinishAP";
var DAYS = "Days";
var NVSEP = ":";
var SEP = ";";
var DAYCHOICE = "DayChoice";
var SPECDAY_SUN = "SpecDaySun";
var SPECDAY_MON = "SpecDayMon";
var SPECDAY_TUE = "SpecDayTue";
var SPECDAY_WED = "SpecDayWed";
var SPECDAY_THU = "SpecDayThu";
var SPECDAY_FRI = "SpecDayFri";
var SPECDAY_SAT = "SpecDaySat";
var TimeControl = function (timeName, hr, min, processChange)
{
var theHTML = "";
hourName = timeName + "Hour";
minuteName = timeName + "Minute";
apName = timeName + "AP";
// 24-hour cloc hour selection
var HH = '<select name="' + hourName + '" onchange="' + processChange + '">';
for(i = 0; i < 24; i++)
HH += '<option value="' + i + '" ' + ((hr == i) ? 'selected="selected"' : '') + '>' + ((i < 10) ? '0' : '') + i + '</option>'
HH += '</select>';
// normalise the hour value for 12 hour clock
ap = (hr > 11) ? "pm" : "am";
hr = hr % 12;
hr = (hr == 0) ? 12 : hr;
var hh = '<select name="' + hourName + '" onchange="' + processChange + '">';
for(i = 1; i < 13; i++)
hh += '<option value="' + i % 12 + '" ' + ((hr == i) ? 'selected="selected"' : '') + '>' + ((i < 10) ? '0' : '') + i + '</option>'
hh += '</select>';
var mm = '<select name="' + minuteName + '" onchange="' + processChange + '">';
for(i = 0; i < 60; i = i + 5)
mm += '<option value="' + i + '" ' + ((min == i) ? 'selected="selected"' : '') + '>' + ((i < 10) ? '0' : '') + i + '</option>';
mm += '</select>';
var tt = '<input name="' + apName + '" type="radio" value="am" ' + ((ap == 'am') ? 'checked="checked"' : '') + ' onclick="' + processChange + '"/>' + strTimeAM;
tt += '<input name="' + apName + '" type="radio" value="pm" ' + ((ap == 'pm') ? 'checked="checked"' : '') + ' onclick="' + processChange + '"/>' + strTimePM;
var cPos = 0;
var cPrev = "", cThis = "";
while(cPos < timeFormat.length)
{
cThis = timeFormat.charAt(cPos);
switch(cThis)
{
case "H":
if(cPrev != "H")
theHTML += HH;
break;
case "h":
if(cPrev != "h")
theHTML += hh;
break;
case "m":
if(cPrev != "m")
theHTML += mm;
break;
case "t":
if(cPrev != "t")
theHTML += tt;
break;
default:
theHTML += cThis;
break;
}
cPrev = cThis;
cPos++;
}
return theHTML;
}
Schedule = function ()
{
this.bUseFinishTime = false;
this.StartHour = 0;
this.StartMinute = 0;
this.FinishHour = 0;
this.FinishMinute = 0;
this.Days = EveryDay;
this.SetStartTime = function (hour, minute, ap)
{
this.StartHour = hour;
this.StartMinute = minute;
if(ap)
{
if(ap == "am")
{
if(this.StartHour > 11)
this.StartHour = this.StartHour - 12;
}
else
{
if(this.StartHour < 12)
this.StartHour = this.StartHour + 12;
}
}
}
this.SetFinishTime = function (hour, minute, ap)
{
this.bUseFinishTime = true;
this.FinishHour = hour;
this.FinishMinute = minute;
if(ap)
{
if(ap == "am")
{
if(this.FinishHour > 11)
this.FinishHour = this.FinishHour - 12;
}
else
{
if(this.FinishHour < 12)
this.FinishHour = this.FinishHour + 12;
}
}
}
this.Parse = function (strStringDef)
{
if(strStringDef.length < 1)
return;
var nFindPair = 0;
var NVs, NVPair;
NVs = strStringDef.split(";");
var i = 0;
while(NVs[i])
{
if(NVs[i].indexOf(":") > -1)
{
NVPair = NVs[i].split(":");
strValue = NVPair[1];
switch(NVPair[0])
{
case START_HOUR:
var newHour = parseInt(strValue);
this.StartHour = newHour;
break;
case START_MINUTE:
this.StartMinute = parseInt(strValue);
break;
case BACKUP_UNTIL:
this.bUseFinishTime = (strValue == "TimeUntil");
break;
case FINISH_HOUR:
var newHour = parseInt(strValue);
this.FinishHour = newHour;
this.bUseFinishTime = true;
break;
case FINISH_MINUTE:
this.FinishMinute = parseInt(strValue);
this.bUseFinishTime = true;
break;
case DAYS:
this.Days = strValue;
break;
}
}
i++;
}
}
this.GetAsString = function ()
{
var strRet = START_HOUR + NVSEP + this.StartHour + SEP
+ START_MINUTE + NVSEP + this.StartMinute + SEP
+ BACKUP_UNTIL + NVSEP + (this.bUseFinishTime ? "TimeUntil" : "DoneUntil") + SEP
+ DAYS + NVSEP + this.Days + SEP;
if (this.bUseFinishTime) {
strRet += FINISH_HOUR + NVSEP + this.FinishHour + SEP
+ FINISH_MINUTE + NVSEP + this.FinishMinute + SEP
}
return strRet;
}
this.GetTime = function (hr, mm)
{
var theTime = "";
var hr24 = hr;
var hr12 = hr % 12;
if(hr12 == 0)
hr12 = 12;
var tt = ((hr > 11) ? strTimePM : strTimeAM);
var cPos = 0;
var cPrev = "", cThis = "";
while(cPos < timeFormat.length)
{
cThis = timeFormat.charAt(cPos);
cNext = (cPos < timeFormat.length - 1) ? timeFormat.charAt(cPos + 1) : "";
switch(cThis)
{
case "H":
if(cPrev != "H")
theTime += ((hr24 < 10 && cNext == "H") ? "0" : "") + hr24;
break;
case "h":
if(cPrev != "h")
theTime += ((hr12 < 10 && cNext == "h") ? "0" : "") + hr12;
break;
case "m":
if(cPrev != "m")
theTime += ((mm < 10 && cNext == "m") ? "0" : "") + mm;
break;
case "t":
if(cPrev != "t")
theTime += tt;
break;
default:
theTime += cThis;
break;
}
cPrev = cThis;
cPos++;
}
return theTime;
}
this.GetStartTime = function ()
{
return this.GetTime(this.StartHour, this.StartMinute);
}
this.GetFinishTime = function ()
{
return this.GetTime(this.FinishHour, this.FinishMinute);
}
this.Description = function ()
{
if(this.Days == EveryDay)
str = this.bUseFinishTime ? sdEveryDayTwoTimes : sdEveryDayOneTime;
else if(this.Days == Weekdays)
str = this.bUseFinishTime ? sdWeekdaysTwoTimes : sdWeekdaysOneTime;
else
str = this.bUseFinishTime ? sdSpecificDaysTwoTimes : sdSpecificDaysOneTime;
str = str.replace("{startTime}", this.GetStartTime());
str = str.replace("{finishTime}", this.GetFinishTime());
str = str.replace("{listDays}", this.ListDays());
return str;
}
this.ListDays = function ()
{
if(this.Days == 0)
return strDescNoSchedule;
strRet = "";
if((this.Days & Sun) == Sun)
strRet += strSundayShort + ", ";
if((this.Days & Mon) == Mon)
strRet += strMondayShort + ", ";
if((this.Days & Tue) == Tue)
strRet += strTuesdayShort + ", ";
if((this.Days & Wed) == Wed)
strRet += strWednesdayShort + ", ";
if((this.Days & Thu) == Thu)
strRet += strThursdayShort + ", ";
if((this.Days & Fri) == Fri)
strRet += strFridayShort + ", ";
if((this.Days & Sat) == Sat)
strRet += strSaturdayShort + ", ";
// drop the ", " at the end of the list
return strRet.substring(0, strRet.length - 2);
}
this.ProcessChange = function (o)
{
switch(o.name)
{
case START_HOUR:
case SSTART_HOUR:
case ONCE_HOUR:
var newHour = parseInt(o.value) + ((!Use24HourClock && this.StartHour > 11 && o.value < 12) ? 12 : 0);
this.StartHour = newHour;
break;
case START_MINUTE:
case SSTART_MINUTE:
case ONCE_MINUTE:
this.StartMinute = parseInt(o.value);
break;
case START_AP:
case SSTART_AP:
case ONCE_AP:
if(o.value == "am")
{
if(this.StartHour > 11)
this.StartHour = this.StartHour - 12;
}
else
{
if(this.StartHour < 12)
this.StartHour = this.StartHour + 12;
}
break;
case FINISH_HOUR:
case SFINISH_HOUR:
var newHour = parseInt(o.value) + ((!Use24HourClock && this.FinishHour > 11 && o.value < 12) ? 12 : 0);
this.FinishHour = newHour;
this.bUseFinishTime = true;
break;
case FINISH_MINUTE:
case SFINISH_MINUTE:
this.FinishMinute = parseInt(o.value);
this.bUseFinishTime = true;
break;
case FINISH_AP:
case SFINISH_AP:
if(o.value == "am")
{
if(this.FinishHour > 11)
this.FinishHour = this.FinishHour - 12;
}
else
{
if(this.FinishHour < 12)
this.FinishHour = this.FinishHour + 12;
}
this.bUseFinishTime = true;
break;
case DAYCHOICE:
this.Days = (o.value == "Every") ? EveryDay : ((o.value == "Weekdays") ? Weekdays : 0);
break;
case SPECDAY_SUN:
this.Days = o.checked ? this.Days | Sun : this.Days & ~Sun;
break;
case SPECDAY_MON:
this.Days = o.checked ? this.Days | Mon : this.Days & ~Mon;
break;
case SPECDAY_TUE:
this.Days = o.checked ? this.Days | Tue : this.Days & ~Tue;
break;
case SPECDAY_WED:
this.Days = o.checked ? this.Days | Wed : this.Days & ~Wed;
break;
case SPECDAY_THU:
this.Days = o.checked ? this.Days | Thu : this.Days & ~Thu;
break;
case SPECDAY_FRI:
this.Days = o.checked ? this.Days | Fri : this.Days & ~Fri;
break;
case SPECDAY_SAT:
this.Days = o.checked ? this.Days | Sat : this.Days & ~Sat;
break;
}
ScheduleSettings.UpdateDisplay(o.name, o.value);
}
this.OutputHTML = function (htmlTemplate)
{
var StartTime = new box();
var FinishTime = new box();
var newOne = htmlTemplate; //.cloneNode(true);
this.UpdateScheduleControls(newOne, StartTime, FinishTime);
if(StartTime.GetObject())
StartTime.GetObject().innerHTML = TimeControl("Start", this.StartHour, this.StartMinute, "ScheduleSettings.ProcessSave(this);");
if(FinishTime.GetObject())
FinishTime.GetObject().innerHTML = TimeControl("Finish", this.FinishHour, this.FinishMinute, "ScheduleSettings.ProcessSave(this);");
return newOne;
}
this.UpdateScheduleControls = function (theNode, StartTime, FinishTime)
{
var childNode;
for(var i = 0; i < theNode.childNodes.length; i++)
{
childNode = theNode.childNodes[i];
this.UpdateSpecificControl(childNode, StartTime, FinishTime);
this.UpdateScheduleControls(childNode, StartTime, FinishTime);
}
}
this.UpdateSpecificControl = function (childNode, StartTime, FinishTime)
{
if(childNode.attributes)
{
// Feed in the values from the schedule
if(childNode.nodeName == "INPUT")
{
switch(childNode.attributes["name"].value)
{
case "DayChoice":
switch(childNode.attributes["id"].value)
{
case "Every":
CheckObject(childNode, this.Days == EveryDay);
break;
case "Weekdays":
CheckObject(childNode, this.Days == Weekdays);
break;
case "Specific":
CheckObject(childNode, this.Days != EveryDay && this.Days != Weekdays);
break;
}
break;
case "SpecDaySun":
case "SpecDayMon":
case "SpecDayTue":
case "SpecDayWed":
case "SpecDayThu":
case "SpecDayFri":
case "SpecDaySat":
checkDay = eval(childNode.attributes["name"].value.substring(7));
CheckObject(childNode, ((this.Days & checkDay) == checkDay));
break;
}
}
if(childNode.attributes["class"])
{
var className = childNode.attributes["class"].value;
switch(className)
{
case "crbScheduleStartTime":
StartTime.SetObject(childNode);
break;
case "crbScheduleFinishTime":
FinishTime.SetObject(childNode);
break;
}
}
}
}
this.IsEqualTo = function (sched)
{
var bEqual =
(this.bUseFinishTime == sched.bUseFinishTime)
&& (this.StartHour == sched.StartHour)
&& (this.StartMinute == sched.StartMinute)
&& (this.FinishHour == sched.FinishHour)
&& (this.FinishMinute == sched.FinishMinute)
&& (this.Days == sched.Days);
return bEqual;
}
this.IsValidTimeWindow = function ()
{
return !this.bUseFinishTime || !((this.StartHour == this.FinishHour) && (this.StartMinute == this.FinishMinute));
}
}
/* End included file /scripts/schedule.class.js */
/* Carbonite Service SKIPPING already included file /scripts/commonfunctions.js */
/* Carbonite Service SKIPPING already included file /scripts/serviceinterconnect.js */
/* Carbonite Service included file /scripts/messagebox.js */
// (c) Carbonite, Inc., 2005-2009 All rights reserved
/* Carbonite Service SKIPPING already included file /scripts/string.class.js */
/* Carbonite Service SKIPPING already included file /scripts/commonfunctions.js */
/* Carbonite Service included file /js/wait.js */
// (c) Carbonite, Inc., 2005-2009 All rights reserved
// Useful common scripts for messaging while waiting
var Wait__ = function ()
{
var self = this;
var objOverlay = null;
var nestedOverlays = new Array();
var popupDiv = null;
var orgID = null;
function AddPopupDiv(waitDivId, processor)
{
popupDiv = document.createElement("div");
popupDiv.className = "HorizontalCenter";
var contentDiv = document.createElement("div");
contentDiv.className = "LightBox";
popupDiv.appendChild(contentDiv);
var pWait = document.getElementById(waitDivId);
orgID = waitDivId;
if(processor)
{
// becuase we are processing, we create a clone that we change, rather than changing the original node
pWait = pWait.cloneNode(true);
orgID = null;
pWait.innerHTML = processor(pWait.innerHTML);
}
contentDiv.appendChild(pWait);
document.body.appendChild(popupDiv);
pWait.style.display = "";
pWait.style.visibility = "visible";
var centerPos = $(popupDiv).offset();
$(contentDiv).offset(
{
left: centerPos.left - (contentDiv.offsetWidth / 2),
top: centerPos.top - (contentDiv.offsetHeight / 2)
}
);
}
function RemovePopupDiv()
{
if(popupDiv)
{
if(orgID)
{
var orgDiv = document.getElementById(orgID);
orgDiv.parentNode.removeChild(orgDiv);
orgDiv.style.display = "none";
orgDiv.style.visibility = "hidden";
document.body.appendChild(orgDiv);
}
document.body.removeChild(popupDiv);
}
popupDiv = null;
orgID = null;
}
function DoWaitOperation()
{
waitingMethod();
self.StopWait();
}
this.Overlay = function (bShow)
{
if(bShow)
{
if(objOverlay)
{
nestedOverlays.push(objOverlay);
}
objOverlay = document.createElement("div");
objOverlay.className = "LightBoxBackground";
objOverlay.setAttribute("id", "overlay");
document.body.appendChild(objOverlay);
}
else
{
if(objOverlay)
document.body.removeChild(objOverlay);
objOverlay = null;
if(nestedOverlays.length > 0)
objOverlay = nestedOverlays.pop();
}
}
this.IsPopped = function ()
{
return popupDiv != null;
}
this.AddWaitingDiv = function (waitDivId, processor)
{
AddPopupDiv(waitDivId, processor);
document.body.style.cursor = "wait";
}
this.RemoveWaitingDiv = function ()
{
document.body.style.cursor = "default";
RemovePopupDiv();
}
/*
Wait - shows message during wait operation (overlaying background with opaque grey)
Arguments:
messageId - id of the html node to show within the waiting div (required)
methodToCall - pointer to method to call (optional; if not provided, caller is responsible for calling StopWait())
decorationMethod - method that will preprocess the message to update its contents if necessary
*/
var waitingMethod = null;
this.DoWait = function (messageId, methodToCall, decorationMethod)
{
self.Overlay(true);
self.AddWaitingDiv(messageId, decorationMethod);
if(methodToCall)
{
// let us know what the method to call is
waitingMethod = methodToCall;
//var fnCall = "DoWaitOperation('" + methodToCall + "')";
setTimeout(DoWaitOperation, 0);
}
}
this.StopWait = function ()
{
waitingMethod = null;
self.RemoveWaitingDiv();
self.Overlay(false);
}
this.Popup = function (messageId, decorationMethod)
{
self.Overlay(true);
AddPopupDiv(messageId, decorationMethod);
}
this.StopPopup = function ()
{
RemovePopupDiv();
self.Overlay(false);
}
}
var Wait = new Wait__();
/* End included file /js/wait.js */
var msgBoxArgs = {};
BUTTON_OK = 0x01;
BUTTON_CANCEL = 0x02;
BUTTON_YES = 0x04;
BUTTON_NO = 0x08;
BUTTONS_OKCANCEL = BUTTON_OK | BUTTON_CANCEL;
BUTTONS_YESNO = BUTTON_YES | BUTTON_NO;
BUTTONS_YESNOCANCEL = BUTTON_YES | BUTTON_NO | BUTTON_CANCEL;
ID_YES = 'IdYes';
ID_NO = 'IdNo';
ID_OK = 'IdOK';
ID_CANCEL = 'IdCancel';
ICON_NONE = 1;
ICON_INFO = 2;
ICON_WARNING = 3;
MESSAGEBOX_ERROR_NOELEMENT = -1;
function HtmlMessageBoxFromUrl(url)
{
// grey out the area of the main window
Wait.Overlay(true);
var retval = external.AlertFromUrl(url);
Wait.Overlay(false);
return retval;
}
function HtmlMessageBox2(id, buttonSpec)
{
if (typeof (external.Alert) == "undefined")
return (BUTTON_OK == HtmlMessageBox(id, buttonSpec) ? ID_OK : ID_CANCEL);
var theNode = document.getElementById(id);
if (!theNode)
return MESSAGEBOX_ERROR_NOELEMENT;
switch (buttonSpec) {
case BUTTON_OK: buttonSpec = ID_OK; break;
case BUTTON_CANCEL: buttonSpec = ID_CANCEL; break;
case BUTTON_YES: buttonSpec = ID_YES; break;
case BUTTON_NO: buttonSpec = ID_NO; break;
case BUTTONS_OKCANCEL: buttonSpec = ID_CANCEL + '*_default*SecondaryButton|' + ID_OK; break;
case BUTTONS_YESNO: buttonSpec = ID_NO + '*_default*SecondaryButton|' + ID_YES; break;
case BUTTONS_YESNOCANCEL: buttonSpec = buttonSpec = ID_CANCEL + '*_default*SecondaryButton|' + ID_NO + '*_default*SecondaryButton|' + ID_YES; break;
}
//the node style indicates the size of the messagebox with dialogHeight and dialogWidth
//the captions for the buttons need not be stated for common buttons (see HTMLMessageBox2.html)
//otherwise, the button spec is sent as id1*caption1|id2*caption2|...|idN*captionN
// grey out the area of the main window
Wait.Overlay(true);
var retval = external.Alert("", theNode.outerHTML, buttonSpec);
Wait.Overlay(false);
return retval;
}
/*
The opts parameters is a javascript Object used to pass in
a variable set of optional settings.
Usage:
var options = new Object();
options.idOkButtonText = "crbConfirmUnfreezeOkButton";
options.idCancelButtonText = "crbConfirmUnfreezeCancelButton";
options.iconType = ICON_NONE;
if (HtmlMessageBox('crbConfirmUnfreeze', BUTTONS_OKCANCEL, options) == BUTTON_OK)
{
...do stuff...
}
Option properties:
- idOkButtonText: the id of an element that contains the replacement text
for the OK button.
- idCancelButtonText: ... Cancel button.
- idYesButtonText: ... Yes button.
- idNoButtonText: ... No button.
- iconType: sets or turns off the message box icon (default is an info icon).
Use one of the ICON_x constants (see top of this file).
*/
function HtmlMessageBox(id, buttonTypes, opts)
{
var theNode = document.getElementById(id);
if (!theNode)
return MESSAGEBOX_ERROR_NOELEMENT;
// Our call to MessageBox / MessageBoxStyle needs an options param,
// too. So we'll just use the one that caller passed to us, if any,
// creating a new one only if necessary.
if (opts == null)
opts = new Object();
opts.Message = theNode.innerHTML;
opts.Buttons = buttonTypes;
// process optional opts settings
if (opts.idOkButtonText)
opts.OkButtonText = ReadButtonText(opts.idOkButtonText);
if (opts.idCancelButtonText)
opts.CancelButtonText = ReadButtonText(opts.idCancelButtonText);
if (opts.idYesButtonText)
opts.YesButtonText = ReadButtonText(opts.idYesButtonText);
if (opts.idNoButtonText)
opts.NoButtonText = ReadButtonText(opts.idNoButtonText);
var sStyle = theNode.style;
var retVal;
if (sStyle)
{
theNode.removeAttribute("title");
retVal = MessageBoxStyle(opts, sStyle);
}
else
retVal = MessageBox(opts);
return retVal;
}
function ParseStyle(sStyle, d, w)
{
var buffer = 50;
var dialogHeight = -1;
var dialogWidth = -1;
var dialogTop = -1;
var dialogLeft = -1;
var styleString = (sStyle.cssText!=null)?sStyle.cssText:sStyle;
var nvPairs = styleString.split(";");
var newStyle = "";
for(var i=0; i<nvPairs.length; i++)
{
if(nvPairs[i].length>0)
{
var stylePair = nvPairs[i].split(":");
switch(stylePair[0].trim().toLowerCase())
{
// if we've been provided dialog attributes
case "dialogheight":
case "dialogtop":
case "dialogleft":
case "dialogwidth":
eval(stylePair[0] + " = parseInt('" + stylePair[1] + "')");
break;
// Check for things that hide these items; we want to force them to be visible for the message box
case "visibility":
if (stylePair[1].trim().toLowerCase() != "hidden")
newStyle += stylePair[0] + ":" + stylePair[1] + ";";
break;
case "display":
if (stylePair[1].trim().toLowerCase() != "none")
newStyle += stylePair[0] + ":" + stylePair[1] + ";";
break;
// by default, pass the style on through
default:
newStyle += stylePair[0] + ":" + stylePair[1] + ";";
break;
}
}
}
// If a height has been specified, adjust it (add 40) for IE6.
if (dialogHeight > 0 && IsIE6())
dialogHeight += 40;
// Use default sizes if not supplied
if (dialogHeight < 0)
dialogHeight = d.body.clientHeight - buffer * 2;
if (dialogWidth < 0)
dialogWidth = d.body.clientWidth - buffer * 2;
// Minimum height that IE allows is 100px, minimum width 250px - if the passed in values are smaller, the dialog will not be centered
if (dialogHeight < 100)
dialogHeight = 100;
if (dialogWidth < 250)
dialogWidth = 250;
// center the dialog with respect to the screen, unless top and/or left have been provided to force it elsewhere
if (dialogLeft < 0)
dialogLeft = w.screenLeft + (d.body.clientWidth - dialogWidth) / 2;
if (dialogTop < 0)
dialogTop = w.screenTop + (d.body.clientHeight - dialogHeight) / 2;
newStyle += "dialogHeight: " + dialogHeight + "px;dialogWidth: " + dialogWidth + "px;dialogTop: " + dialogTop + "px;dialogLeft:" + dialogLeft + " px;";
return newStyle;
}
function MessageBox(vArgs)
{
return MessageBoxStyle(vArgs, "");
}
function MessageBoxStyle(vArgs, style)
{
var d = top ? top.document : document;
var w = top ? top.window : window;
Wait.Overlay(true);
var retVal = window.showModalDialog("MessageBox.htm", vArgs, "center: no;status: no;unadorned: yes;" + ParseStyle(style, d, w));
Wait.Overlay(false);
return retVal;
}
function WriteMessage()
{
if (msgBoxArgs.Message)
document.write(msgBoxArgs.Message);
}
function AppendButtonTags(currButtonType, sButtonName, buttonPanel)
{
var button = document.getElementById(sButtonName);
var i = 0;
var buttonContent;
var isOverrideText = IsOverrideButtonText(currButtonType);
while (buttonContent = button.childNodes[i])
{
var newNode = buttonContent.cloneNode(true);
if (isOverrideText)
ReplaceCurrentButtonText(currButtonType, newNode);
buttonPanel.appendChild(newNode);
i++;
}
}
function WriteButtons()
{
var buttonPanel = document.getElementById("crbMessageBoxButtons");
if (msgBoxArgs.Buttons & BUTTON_CANCEL)
AppendButtonTags(BUTTON_CANCEL, "crbMsgBoxCancel", buttonPanel);
// Add the OK button if msgBoxArgs.Buttons is null. This happens
// when loaded from the Skin extended menu in CarboniteUI.
if (!msgBoxArgs.Buttons || (msgBoxArgs.Buttons & BUTTON_OK))
AppendButtonTags(BUTTON_OK, "crbMsgBoxOK", buttonPanel);
if (msgBoxArgs.Buttons & BUTTON_NO)
AppendButtonTags(BUTTON_NO, "crbMsgBoxNo", buttonPanel);
if (msgBoxArgs.Buttons & BUTTON_YES)
AppendButtonTags(BUTTON_YES, "crbMsgBoxYes", buttonPanel);
}
function ReturnResult(result)
{
returnValue = result;
window.close();
}
function ReadButtonText(id)
{
var theNode = document.getElementById(id);
if (!theNode)
return null;
return theNode.innerHTML;
}
function IsOverrideButtonText(currButtonType)
{
if ( (currButtonType == BUTTON_OK && msgBoxArgs.OkButtonText)
|| (currButtonType == BUTTON_CANCEL && msgBoxArgs.CancelButtonText)
|| (currButtonType == BUTTON_YES && msgBoxArgs.YesButtonText)
|| (currButtonType == BUTTON_NO && msgBoxArgs.NoButtonText))
{
return true;
}
return false;
}
function ReplaceCurrentButtonText(currButtonType, newNode)
{
var res = newNode.getElementsByTagName('a');
if (res == null || res.length == 0)
return;
if (currButtonType == BUTTON_OK)
res[0].innerHTML = msgBoxArgs.OkButtonText;
if (currButtonType == BUTTON_CANCEL)
res[0].innerHTML = msgBoxArgs.CancelButtonText;
if (currButtonType == BUTTON_YES)
res[0].innerHTML = msgBoxArgs.YesButtonText;
if (currButtonType == BUTTON_NO)
res[0].innerHTML = msgBoxArgs.NoButtonText;
}
function FinalizeDocument()
{
// change or remove message box's "info" icon
if (msgBoxArgs.iconType)
{
var n = document.getElementById("crbMsgBoxText");
if (n != null)
{
if (msgBoxArgs.iconType == ICON_WARNING)
n.style.backgroundImage = "url(../images/alert.png)";
else if (msgBoxArgs.iconType == ICON_NONE)
{
n.style.backgroundImage = "none";
n.style.paddingLeft = "0";
}
}
}
}
// Utility message box functions
/* Takes the ID of the span containing the dialog box text; pops a confirmation dialog */
function crbConfirm2(id)
{
return ID_OK == (buttonSelected = HtmlMessageBox2(id, BUTTONS_OKCANCEL));
}
/* Takes the ID of the span containing the dialog box text; pops an alert dialog */
function crbAlert(id)
{
HtmlMessageBox2(id, BUTTON_OK);
}
function crbConfirmYN2(id)
{
var buttonSelected;
return ID_YES == (buttonSelected = HtmlMessageBox2(id, BUTTONS_YESNO));
}
/* End included file /scripts/messagebox.js */
function formatTime(hour, minute, iso) {
var printMinute = minute;
if (minute < 10) printMinute = '0' + minute;
if (iso) {
var printHour = hour
if (printHour < 10) printHour = '0' + hour;
return printHour + ':' + printMinute;
} else {
var printHour = hour % 12;
if (printHour == 0) printHour = 12;
var half = (hour < 12) ? 'am' : 'pm';
return printHour + ':' + printMinute + half;
}
}
function parseTime(text) {
var match = match = /(\d+)\s*[:\-\.,]\s*(\d+)\s*(am|pm)?/i.exec(text);
if (match && match.length >= 3) {
var hour = Number(match[1]);
var minute = Number(match[2])
if (hour == 12 && match[3]) hour -= 12;
if (match[3] && match[3].toLowerCase() == 'pm') hour += 12;
return {
hour: hour,
minute: minute
};
} else {
return null;
}
}
var MIScheduleSettings__ = function () {
var CONTINUOUS = 0;
var ONCE_PER_DAY = 1;
var EXCLUDE_HOURS = 2;
this.PutMISchedule = function () {
// Schedule types
var scheduleInfo = {
"ScheduleType": CONTINUOUS,
"StartHour": 0,
"StartMinute": 0,
"EndHour": 0,
"EndMinute": 0
};
if ($("#MIdaily").is(":checked")) {
scheduleInfo.ScheduleType = ONCE_PER_DAY;
var startTime = parseTime($('#MIbackup_start').val());
if (startTime) {
scheduleInfo.StartHour = startTime.hour;
scheduleInfo.StartMinute = startTime.minute;
}
} else if ($("#MIexcludeHours").is(":checked")) {
scheduleInfo.ScheduleType = EXCLUDE_HOURS;
var startTime = parseTime($('#MIexclude_start').val());
if (startTime) {
scheduleInfo.StartHour = startTime.hour;
scheduleInfo.StartMinute = startTime.minute;
}
var endTime = parseTime($('#MIexclude_end').val());
if (endTime) {
scheduleInfo.EndHour = endTime.hour;
scheduleInfo.EndMinute = endTime.minute;
}
}
this.UpdateTimeFields(scheduleInfo.ScheduleType, scheduleInfo.StartHour, scheduleInfo.StartMinute, scheduleInfo.EndHour, scheduleInfo.EndMinute);
var scheduleJSON = $.toJSON(scheduleInfo);
$.ajax({
url: "/put-MIschedule.htm",
data: "nocache=1&schedule=" + scheduleJSON
});
}
this.initMISchedule = function () {
var data = $.parseJSON($("#crbMIScheduleInfo").html());
// Init defaults for daily backup and exclude range backup
// Daily backup will default to midnight
var defaultDailyBackupTime = formatTime(0, 0, Use24HourClock);
$('#MIbackup_start').val(defaultDailyBackupTime);
$('#MIbackup_start_text').text(defaultDailyBackupTime);
// Exclude range backup will default to the current time + 2 hours
var defaultExcludeStartTime = new Date();
var defaultExcludeStartHour = defaultExcludeStartTime.getHours();
var defaultExcludeStartMin = defaultExcludeStartTime.getMinutes() < 15 ? 0 : 30;
var defaultExcludeEndTime = new Date();
var defaultExcludeEndHour = (defaultExcludeEndTime.getHours() + 2) % 24;
var defaultExcludeEndMinute = defaultExcludeEndTime.getMinutes() < 15 ? 0 : 30;
var defaultExcludeStartTimeText = formatTime(defaultExcludeStartHour, defaultExcludeStartMin, Use24HourClock);
var defaultExcludeEndTimeText = formatTime(defaultExcludeEndHour, defaultExcludeEndMinute, Use24HourClock);
$('#MIexclude_start').val(defaultExcludeStartTimeText);
$('#MIexclude_start_text').text(defaultExcludeStartTimeText);
$('#MIexclude_end').val(defaultExcludeEndTimeText);
$('#MIexclude_end_text').text(defaultExcludeEndTimeText);
// Now load the schedule according to the data in crbMIScheduleInfo
if (data.ScheduleType == CONTINUOUS) {
$('#MIcontinuously').click();
} else if (data.ScheduleType == ONCE_PER_DAY) {
$('#MIdaily').click();
var startTime = formatTime(data.StartHour, data.StartMinute, Use24HourClock);
$('#MIbackup_start').val(startTime);
$('#MIbackup_start_text').text(startTime);
} else if (data.ScheduleType == EXCLUDE_HOURS) {
$('#MIexcludeHours').click();
var startTime = formatTime(data.StartHour, data.StartMinute, Use24HourClock);
var endTime = formatTime(data.EndHour, data.EndMinute, Use24HourClock);
$('#MIexclude_start').val(startTime);
$('#MIexclude_start_text').text(startTime);
$('#MIexclude_end').val(endTime);
$('#MIexclude_end_text').text(endTime);
}
}
this.UpdateTimeFields = function (scheduleType, startHour, startMinute, endHour, endMinute) {
var startTime = formatTime(startHour, startMinute, Use24HourClock);
var endTime = formatTime(endHour, endMinute, Use24HourClock);
if (scheduleType == ONCE_PER_DAY) {
$('#MIbackup_start_text').text(startTime);
} else if (scheduleType == EXCLUDE_HOURS) {
$('#MIexclude_start_text').text(startTime);
$('#MIexclude_end_text').text(endTime);
}
}
}
var ScheduleSettings__ = function ()
{
function E$(id)
{
return document.getElementById(id);
}
var self = this;
this.Schedules = new Object;
var scheduleNum;
var schedule;
var ifrPoster = null;
var needsCommit = false;
NO_SCHEDULE = 0;
SINGLE_SCHEDULE = 1;
MULTIPLE_SCHEDULE = 2;
var scheduleType = NO_SCHEDULE;
Sun = 0x01;
Mon = 0x02;
Tue = 0x04;
Wed = 0x08;
Thu = 0x10;
Fri = 0x20;
Sat = 0x40;
EveryDay = Sun | Mon | Tue | Wed | Thu | Fri | Sat;
Weekdays = Mon | Tue | Wed | Thu | Fri;
localNav = false;
/* Silence javascript errors */
window.onerror = parent.trapError;
function DefaultSchedule()
{
return self.Schedules[0] ? self.Schedules[0] : schedule;
}
function ShowHideTimeControl(sName, bShow)
{
var hourName = sName + "Hour";
var minuteName = sName + "Minute";
var dropdown = E$(hourName);
dropdown.style.display = bShow ? "" : "none";
dropdown = E$(minuteName);
dropdown.style.display = bShow ? "" : "none";
}
function HideTimeControl(sName, timeout)
{
// delay before executing the hide so that this operation blends with the other effects
setTimeout('ShowHideTimeControl("' + sName + '", false)', timeout);
}
function ShowTimeControl(sName, timeout)
{
// delay before executing the hide so that this operation blends with the other effects
setTimeout('ShowHideTimeControl("' + sName + '", true)', timeout);
}
this.AdvancedScheduling = function ()
{
var border = 10;
var over = E$('overlay');
// stretch overlay to fill page and fade in
var arrayPageSize = getPageSize();
over.style.position = "absolute";
over.style.width = arrayPageSize[0];
over.style.height = arrayPageSize[1];
over.style.top = 0;
over.style.left = 0;
over.style.display = "";
var as = E$("AdvancedSchedule");
RefreshAdvancedScheduleList();
as.style.position = "absolute";
as.style.width = arrayPageSize[0] - border * 2;
as.style.height = 0; // style appears to be determining height
as.style.top = border;
as.style.left = border;
as.style.display = "";
// if we have no advanced rules, then open the entry screen for the first one anyway
if(!self.Schedules[0])
self.AddNewSchedule();
}
this.SimpleScheduling = function ()
{
schedule = DefaultSchedule() ? DefaultSchedule() : new Schedule();
E$('AdvancedSchedule').style.display = "none";
E$('overlay').style.display = "none";
}
this.AddNewSchedule = function ()
{
var nTotal = 0;
while(self.Schedules[nTotal])
nTotal++;
self.EditSchedule(nTotal);
}
this.EditSchedule = function (num)
{
var as = E$("AdvancedSchedule");
var es = E$("EditSchedule");
es.style.position = as.style.position;
es.style.width = as.style.width;
es.style.height = as.style.height;
es.style.top = as.style.top;
es.style.left = as.style.left;
GetEditSchedule(num);
as.style.display = "none";
es.style.display = "";
}
this.StopEdit = function ()
{
schedule = self.Schedules[0] ? self.Schedules[0] : new Schedule();
scheduleNum = -1;
RefreshAdvancedScheduleList();
if(self.Schedules[0])
{
E$('EditSchedule').style.display = "none";
E$('AdvancedSchedule').style.display = "";
}
else
{
// go all the way back to the main schedule screen
E$('EditSchedule').style.display = "none";
E$('AdvancedSchedule').style.display = "none";
E$('overlay').style.display = "none";
}
}
function GetEditSchedule(num)
{
// create temporary copy of schedule in placeholder
scheduleNum = num;
schedule = new Schedule();
if(self.Schedules[scheduleNum])
schedule.Parse(self.Schedules[scheduleNum].GetAsString());
var editSchedule = schedule.OutputHTML(E$("ScheduleDetails"));
var sg = E$("ScheduleGetter");
// clean any children present - this one will need to be the only one
while(sg.childNodes[0])
{
sg.removeChild(sg.childNodes[0])
};
sg.appendChild(editSchedule);
}
function AddOrChangeSchedule(sched, num)
{
var i = 0;
var bIsUnique = true;
while(self.Schedules[i] && bIsUnique)
{
bIsUnique = !self.Schedules[i].IsEqualTo(sched);
i++;
}
if(bIsUnique)
self.Schedules[num] = sched;
return bIsUnique;
}
function SaveEditSchedule()
{
schedule.bUseFinishTime = true;
var bAdded = AddOrChangeSchedule(schedule, scheduleNum);
if(bAdded)
{
scheduleType = MULTIPLE_SCHEDULE;
E$("Advanced").checked = true;
self.ShowApplyButton();
self.StopEdit();
}
return bAdded;
}
this.DeleteSchedule = function (iNum)
{
var i = 0;
while(self.Schedules[i])
{
if(i > iNum)
self.Schedules[i - 1] = self.Schedules[i];
i++;
}
self.Schedules[i - 1] = null;
if(!self.Schedules[0])
{
scheduleType = NO_SCHEDULE;
E$("continuously").checked = true;
}
self.ShowApplyButton();
RefreshAdvancedScheduleList();
}
function PutScheduleInfo(str, onsavedfunc)
{
var req;
try
{
req = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e)
{
req = new ActiveXObject("Microsoft.XMLHTTP");
}
// nocache=1 is so existing installations don't have an issue
// with previously cacheable content (The http server used to
// say that /put-schedule.htm was cacheable. That was fixed,
// but we want to make sure that any content left over from
// previous builds doesn't get used.)
var url = "/put-schedule.htm?nocache=1&" + str;
req.onreadystatechange = function ()
{
// When the load is complete, call the save function.
if((typeof (onsavedfunc) == 'function') && (req.readyState == 4))
{
onsavedfunc();
}
}
req.open("GET", url, false);
req.send("");
}
function ApplyScheduleChanges(onsavedfunc)
{
// Prevent the user from saving if they have chosen Advanced with no scedules
if(scheduleType & 0x02 && !self.Schedules[0])
{
HtmlMessageBox2("crbEmptyAdvanced", BUTTON_OK);
return;
}
// Update top-level choice
if(!schedule)
{
schedule = DefaultSchedule() ? DefaultSchedule() : new Schedule();
}
scheduleType &= ~0x04;
if(((scheduleType & 0x02) == 0x00))
schedule.Days = EveryDay;
if(!self.Schedules[0] && scheduleType != NO_SCHEDULE)
self.Schedules[0] = schedule;
//GetPoster().src="/put-state.htm?" + BACKUP_TYPE + "=" + scheduleType;
updateTimeFields(schedule);
// Now save off all the schedules (even if we're not using them right now)
var allScheds = "UpdateAll=1&" + BACKUP_TYPE + "=" + scheduleType;
// Only append schedule hours if the type is not continuous (i.e. NO_SCHEDULE).
if (scheduleType != NO_SCHEDULE)
{
var i = 0;
while(self.Schedules[i])
{
allScheds += "&Schedule" + i + "=" + self.Schedules[i].GetAsString();
i++;
}
}
PutScheduleInfo(allScheds, onsavedfunc);
needsCommit = false;
}
this.ShowApplyButton = function ()
{
needsCommit = true;
// var as = E$("ApplyScheduleChanges");
// var ac = E$("CancelScheduleChanges");
// if(as.style.display == "none")
// as.style.display = "";
// if(ac.style.display == "none")
// ac.style.display = "";
}
this.SetChoice = function (o)
{
// Simply store changed values for submission
scheduleType = o.value;
// update the time to reflect the selection
switch(o.id)
{
case "continuously":
case "crbScheduleDefaultRadioButton":
DefaultSchedule().bUseFinishTime = false;
break;
case "daily":
var timeSelected = parseTime($('#backup_start').val());
if(timeSelected)
{
DefaultSchedule().SetStartTime(
timeSelected.hour,
timeSelected.minute
);
}
DefaultSchedule().bUseFinishTime = false;
break;
case "excludeHours":
var excludeStart = parseTime($('#exclude_start').val());
if(excludeStart)
{
DefaultSchedule().SetFinishTime(
excludeStart.hour,
excludeStart.minute
);
}
var excludeEnd = parseTime($('#exclude_end').val());
if(excludeEnd)
{
DefaultSchedule().SetStartTime(
excludeEnd.hour,
excludeEnd.minute
);
}
DefaultSchedule().bUseFinishTime = true;
break;
default:
break;
}
self.ShowApplyButton();
}
function RefreshAdvancedScheduleList()
{
var listTopNode = E$("listTopNode");
var strInner;
var i = 0;
if(!self.Schedules[0])
strInner = strNoSchedRules;
else
{
strInner = strSchedRules;
strInner += "<table class='scheduletable'>";
while(self.Schedules[i])
{
var schedEditLink = "<tr><td><a onmousedown='localNav=true;' href='javascript:ScheduleSettings.EditSchedule(" + i + ")'><span class='Bullet'>" + strBullet + "</span>" + self.Schedules[i].Description() + "</a></td><td> <a class='addToolTip' onmousedown='localNav=true;' href='javascript:ScheduleSettings.DeleteSchedule(" + i + ")'><font size='-2'>" + strDeleteSchedule + "</font></a></td></tr>";
strInner += schedEditLink;
i++;
}
strInner += "</table>";
}
listTopNode.innerHTML = strInner;
}
this.UpdateDisplay = function (sName, sValue)
{
switch(sName)
{
case DAYCHOICE:
E$(SPECDAY_SUN).checked = schedule.Days & Sun;
E$(SPECDAY_MON).checked = schedule.Days & Mon;
E$(SPECDAY_TUE).checked = schedule.Days & Tue;
E$(SPECDAY_WED).checked = schedule.Days & Wed;
E$(SPECDAY_THU).checked = schedule.Days & Thu;
E$(SPECDAY_FRI).checked = schedule.Days & Fri;
E$(SPECDAY_SAT).checked = schedule.Days & Sat;
break;
case SPECDAY_SUN:
case SPECDAY_MON:
case SPECDAY_TUE:
case SPECDAY_WED:
case SPECDAY_THU:
case SPECDAY_FRI:
case SPECDAY_SAT:
if(schedule.Days == EveryDay)
E$("Every").checked = true;
else if(schedule.Days == Weekdays)
E$("Weekdays").checked = true;
else
E$("Specific").checked = true;
break;
case SSTART_HOUR:
case SSTART_MINUTE:
case SSTART_AP:
case SFINISH_HOUR:
case SFINISH_MINUTE:
case SFINISH_AP:
E$("excludeHours").checked = true;
self.SetChoice(E$("excludeHours"));
scheduleType = SINGLE_SCHEDULE;
break;
case ONCE_HOUR:
case ONCE_MINUTE:
case ONCE_AP:
E$("daily").checked = true;
self.SetChoice(E$("daily"));
scheduleType = SINGLE_SCHEDULE | 0x04;
break;
case BACKUP_TYPE:
switch(scheduleType)
{
case NO_SCHEDULE:
E$("continuously").checked = true;
break;
case SINGLE_SCHEDULE:
E$(DefaultSchedule().bUseFinishTime ? "excludeHours" : "daily").checked = true;
break;
case MULTIPLE_SCHEDULE:
E$("Advanced").checked = true;
break;
}
break;
}
}
this.ProcessSave = function (o)
{
schedule.ProcessChange(o);
}
this.InitSimpleSchedule = function ()
{
schedule = DefaultSchedule() ? DefaultSchedule() : new Schedule();
if(E$("crbAllowAdvancedSchedule") && eval(E$("crbAllowAdvancedSchedule").innerText))
$('#crbAdvancedSchedule').show();
if (scheduleType == SINGLE_SCHEDULE) {
if (schedule.bUseFinishTime) {
$("#excludeHours").closest("li").click();
$("#excludeHours").attr("checked", true);
} else {
$("#daily").closest("li").click();
$("#daily").attr("checked", true);
}
} else if (scheduleType == MULTIPLE_SCHEDULE) {
$("#Advanced").closest("li").click();
$("#Advanced").attr("checked", true);
} else {
$("#continuously").closest("li").click();
$("#continuously").attr("checked", true);
}
// now set the values in the controls
updateTimeFields(schedule);
}
function updateTimeFields(sched)
{
var defaultDailyBackupTime = formatTime(0, 0, Use24HourClock);
$('#backup_start').val(defaultDailyBackupTime);
$('#backup_start_text').text(defaultDailyBackupTime);
var defaultExcludeStartTime = new Date();
var defaultExcludeStartHour = defaultExcludeStartTime.getHours();
var defaultExcludeStartMin = defaultExcludeStartTime.getMinutes() < 15 ? 0 : 30;
var defaultExcludeEndTime = new Date();
var defaultExcludeEndHour = (defaultExcludeEndTime.getHours() + 2) % 24;
var defaultExcludeEndMinute = defaultExcludeEndTime.getMinutes() < 15 ? 0 : 30;
var defaultExcludeStartTimeText = formatTime(defaultExcludeStartHour, defaultExcludeStartMin, Use24HourClock);
var defaultExcludeEndTimeText = formatTime(defaultExcludeEndHour, defaultExcludeEndMinute, Use24HourClock);
$('#exclude_start').val(defaultExcludeStartTimeText);
$('#exclude_start_text').text(defaultExcludeStartTimeText);
$('#exclude_end').val(defaultExcludeEndTimeText);
$('#exclude_end_text').text(defaultExcludeEndTimeText);
if(scheduleType == SINGLE_SCHEDULE)
{
if (schedule.bUseFinishTime) {
$('#exclude_start').val(formatTime(sched.FinishHour, sched.FinishMinute, Use24HourClock));
$('#exclude_start_text').text(formatTime(sched.FinishHour, sched.FinishMinute, Use24HourClock));
$('#exclude_end').val(formatTime(sched.StartHour, sched.StartMinute, Use24HourClock));
$('#exclude_end_text').text(formatTime(sched.StartHour, sched.StartMinute, Use24HourClock));
} else {
$('#backup_start').val(formatTime(sched.StartHour, sched.StartMinute, Use24HourClock));
$('#backup_start_text').text(formatTime(sched.StartHour, sched.StartMinute, Use24HourClock));
}
}
}
function checkUnsaved()
{
if(!localNav && needsCommit && BUTTON_YES == HtmlMessageBox2("crbUnsavedSchedule", BUTTONS_YESNO))
ApplyScheduleChanges();
localNav = false;
}
function ValidityTest()
{
var bValid = schedule.IsValidTimeWindow();
var bNoDays = schedule.Days == 0;
if(!bValid || bNoDays)
{
HtmlMessageBox2(bNoDays ? "crbNoDaysChosen" : "crbInvalidTimeSpan", BUTTON_OK);
needsCommit = false;
}
return bValid && !bNoDays;
}
this.SaveEdit = function ()
{
if(ValidityTest() && !SaveEditSchedule())
HtmlMessageBox2("crbDuplicateSchedule", BUTTON_OK);
}
this.ApplyChanges = function (onsavedfunc)
{
if(scheduleType != SINGLE_SCHEDULE || ValidityTest())
ApplyScheduleChanges(onsavedfunc);
}
this.SetCurrentSchedule = function (schedValue)
{
schedule = schedValue;
}
this.SetCurrentScheduleType = function (typeValue)
{
scheduleType = typeValue;
}
this.GetCurrentSchedule = function ()
{
return schedule;
}
}
var ScheduleSettings = new ScheduleSettings__();
var MIScheduleSettings = new MIScheduleSettings__();
/* End included file /js/schedule.js */
var Installation__ = function ()
{
var self = this;
var bTest = false;
var nBackupState = -1;
var nServiceState = -1;
var nQuotaUsagePct = -1;
var sPhase = "";
var nPhaseIndex = 0;
var tmrScanningTimeout = 0;
var sCurrentWindowSize = "";
var interconnect;
function startInterconnect()
{
interconnect = new ServiceInterconnect(
{
"items": "all",
"onPush": installation_pushHandler,
"name": "Installation.js"
});
interconnect.start();
}
var nTestTimer = 0;
var nTestPhase = 0;
function testPhases()
{
//run through all phases
var elPhase = document.getElementById('phases').childNodes.item(nTestPhase);
if(elPhase.id && elPhase.id.length > 8)
self.onPhase(elPhase.id.substring(8));
if(++nTestPhase == document.getElementById('phases').childNodes.length)
clearInterval(nTestTimer);
else
{
clearInterval(nTestTimer);
nTestTimer = setInterval(testPhases, 500);
}
}
this.InstallInit = function ()
{
logTrace('Installation.js::body_onload');
//start an interval timer for validating passwords
//this runs all the time that we're in the installation phase
//(it'd be better to switch it on only when the manual encryption panel is visible)
startPKPasswordTimer();
//show normally hidden controls?
if(queryString('test'))
{
logTrace('installation.js::body_onload test mode on');
bTest = queryString('test') == '1';
if(bTest)
{
for(i = 0; i < document.all.length; i++)
{
try
{
if(document.all.item(i).className == "develop")
document.all.item(i).style.display = "inline";
}
catch(e)
{
}
}
}
}
var ds = queryString('server', '');
if(ds != '')
{
crbDownloadServer.innerText = queryString('server', '');
}
if(queryString('phase'))
{
// run through all phases?
if(queryString('phase') == 'all')
nTestTimer = setInterval(testPhases, 10);
else
self.onPhase(queryString('phase'));
}
startInterconnect();
// Add mouseover tooltips
addtip();
}
this.onPhase = function (phase, supportBack)
{
try
{
if (phase != 0 &&
phase != 10 &&
phase != 20 &&
phase != 23 &&
phase != 25 &&
phase != 40 &&
phase != 45 &&
phase != 50 &&
phase != 60)
self.postCoreMetric(phase);
if(typeof supportBack == 'undefined')
supportBack = false;
var prevPhase = sPhase;
logTrace('phase change to ' + phase);
sPhase = phase;
var divPhase = document.getElementById('crbPhase' + phase);
if(divPhase == null)
{
logError('element crbPhase' + phase + ' does not exist');
return;
}
nPhaseIndex = divPhase.getAttribute('Index');
//the control, title, and body are optionally under the phase div using class="control|title|body"
var elControl = null;
var elTitle = document.getElementById('l_str' + sPhase + 'Title');
var elBody = divPhase;
var strWindowAttributes = "";
if(elTitle == null)
elTitle = document.getElementById('crbTitleDefault');
for(i = 0; i < divPhase.children.length; i++)
{
var el = divPhase.childNodes.item(i);
if(el.className == undefined)
continue;
switch(el.className.toLowerCase())
{
case "phasewindowsize":
var elWindowSize = null;
for(var j = 0; j < el.children.length; j++)
{
/* There should only be one child element, but check its name just in case */
if("WindowAttributes" == el.childNodes.item(i).name)
{
elWindowSize = el.childNodes.item(i);
break;
}
else { continue; }
}
if(null != elWindowSize)
{
strWindowAttributes = elWindowSize.innerText;
/* Only resize the window if we need to, since resizing snaps it back to center */
if(sCurrentWindowSize != strWindowAttributes)
{
/* Resize but keep the current window position */
ResizeWindow(strWindowAttributes, true);
/* Store the current window size for the next phase */
sCurrentWindowSize = strWindowAttributes;
}
}
break;
case "phasecontrol":
elControl = el;
break;
case "phasebody":
elBody = el;
break;
}
}
var elStatus = document.getElementById('crbStatus');
// Remember the current phase in order to support the "Back" operation.
var currentBody = elementByAttribute('class', 'PhaseBody', elStatus.childNodes);
if(currentBody && currentBody.crbOriginalParent)
{
// Add back to the original parent in order to support back operation.
currentBody.crbOriginalParent.appendChild(currentBody);
}
else if(supportBack)
{
logError('Unable to transition from ' + prevPhase + ' to ' + phase + ': Unable to configure for back operation');
return;
}
//set main html for this phase
// Use appendChild instead of copying the innerHTML to make the tooltips work
elStatus.innerHTML = "";
elBody.crbOriginalParent = divPhase;
elStatus.appendChild(elBody);
elBody.style.visibility = "visible";
if(supportBack)
{
elControl.setAttribute("back", prevPhase);
}
//show optional controls
showOptional(elControl, "back", crbBackButton);
showOptional(elControl, "next", crbNextButton);
showOptional(elControl, "accept", crbAcceptButton);
showOptional(elControl, "cancel", crbCancelButton);
showOptional(elControl, "done", crbDoneButton);
showOptional(elControl, "load", crbLoadButton);
showOptional(elControl, "progress", installProgress);
// If the current phase has a positive index, show the navigation breadcrumbs
(nPhaseIndex > -1) ? showCrumbs() : hideCrumbs();
// if this is the scanning phase, set a 3 minute timeout so we don't get stuck
if(phase.toLowerCase() == 'scanning')
{
tmrScanningTimeout = setTimeout("checkScan(true)", 3 * 60 * 1000);
logTrace('set scanning timeout id=' + tmrScanningTimeout);
}
else if(tmrScanningTimeout)
{
clearTimeout(tmrScanningTimeout);
logTrace('cleared scanning timeout id=' + tmrScanningTimeout);
tmrScanningTimeout = 0;
}
// run any phase initialization script that is registered.
if(elControl)
{
// Execute the onphase JavaScript. This will only get executed the first
// time the phase is entered (not if the user does a Back followed
// by a next).
var wasPhaseInitialized = elControl.getAttribute('crbWasPhaseInitialized');
if(wasPhaseInitialized !== true)
{
var initPhaseJS = elControl.getAttribute('onphase');
if(initPhaseJS)
{
eval(initPhaseJS);
}
elControl.setAttribute('crbWasPhaseInitialized', true);
}
// onshowphase contains JavaScript that will always get
// executed when a phase is entered (regardless of whether
// it's been executed before).
var showPhaseJS = elControl.getAttribute('onshow');
if(showPhaseJS)
{
eval(showPhaseJS);
}
// Show the proper nav progress indicator in the upper right.
//
var navNumber = elControl.getAttribute('nav');
$('.NavImage').hide();
if(navNumber)
{
$('#crbNavImage' + navNumber).show();
}
}
// Remove the focus from the next and previous buttons.
blurButtonElements(crbBackButton);
blurButtonElements(crbNextButton);
}
catch(e)
{
logError("exception in phase " + phase + " : " + e.description);
}
}
// Find all of the anchor tags within the specified element (el) and call their blur
// methods.
function blurButtonElements(el)
{
var els = el.getElementsByTagName('a');
if(els)
{
for(var i = 0; i < els.length; i++)
{
els[i].blur();
}
}
}
function showOptional(elIn, attrName, elOut)
{
try
{
//display it?
var attr = elIn.attributes.getNamedItem(attrName);
elOut.style.display = attr == null || attr.value == "" ? "none" : "";
switch(attrName.toLowerCase())
{
case "back":
case "next":
case "accept":
elOut.setAttribute("destination", attr == null ? "" : attr.value);
break;
case "cancel":
elOut.setAttribute("function", attr == null ? "" : attr.value);
break;
case "progress":
if(null != attr && "" != attr.value)
{
$('#installProgress').progressbar({ value: parseFloat(attr.value) });
}
break;
}
}
catch(e)
{
elOut.style.display = "none";
}
}
this.onNext = function (sDestination)
{
//if the destination contains parens, it's a function, so evaluate it. Otherwise it's a phase
if(sDestination.indexOf('(') == -1)
self.onPhase(sDestination);
else
eval(sDestination);
}
this.onCancel = function (sFunction)
{
//if the destination contains parens, it's a function, so evaluate it. Otherwise it's a phase
eval(sFunction);
}
this.onPKImportCancel = function ()
{
event.cancelBubble = true;
if(crbConfirm2('crbCancelPKImport'))
{
crbClick('crbCancelledPKImport');
}
}
function showCrumbs()
{
//we count the children on the phases div and use the child number of the current phase to set the breadcrumb trail
crumbs = document.getElementById('phases').attributes.getNamedItem('count').value;
//if there are too many crumbs, delete some
while(divCrumbTrail.childNodes.length > crumbs)
{
divCrumbTrail.removeChild(divCrumbTrail.children(0));
}
//if there aren't enough crumbs, make some more
while(divCrumbTrail.childNodes.length < crumbs)
{
divCrumbTrail.appendChild(divCrumbTrail.children(0).cloneNode());
}
//change all but the selected crumb to unselected
for(i = 0; i < divCrumbTrail.childNodes.length; i++)
{
divCrumbTrail.childNodes.item(i).className = i == nPhaseIndex ? "CrumbSelected" : "crumb";
}
//Show the breadcrumb trail div
divCrumbTrail.style.visibility = "visible";
}
function hideCrumbs()
{
divCrumbTrail.style.visibility = "hidden";
}
function installation_pushHandler(node)
{
try
{
Alert.pushHandler(node);
switch(node.id.toLowerCase())
{
case "backupstate":
nBackupState = node.innerHTML;
monitorScan(false);
break;
case "quotausagepct":
nQuotaUsagePct = node.innerHTML;
monitorScan(false);
break;
case "totalbackupsize":
crbTotalBackupSize2.innerHTML = node.innerHTML;
break;
case "userholdskey":
//the encryption auto and manual panels show different content based on whether the user is
//managing the private key
var bIsUserManaged = "1" == node.innerHTML;
// TODO: Handle case where server doesn't allow user to manage key.
/*
//if the panel slider is in the wrong position then change it
if(undefined != crbEncryptionKeyPanel.onOffSwitch && crbEncryptionKeyPanel.onOffSwitch.isOn() ^ bIsUserManaged)
crbEncryptionKeyPanel.onOffSwitch.setOn(bIsUserManaged);
*/
/* TODO: Is this required?
//blurb
showElement(divPKUserManagedBlurb, bIsUserManaged);
showElement(divPKUserUnmanagedBlurb, !bIsUserManaged);
*/
//buttons
showElement(crbPKManageAtServer, bIsUserManaged);
showElement(crbPKExport, !bIsUserManaged);
//hide password entry controls
showElement(frmPrivateKeyPassword, !bIsUserManaged);
//show the 'I understand about managing my own key' checkbox and text?
showElement(divPKUnderstood, !bIsUserManaged);
break;
}
}
catch(e)
{
logError("Exception in installation_pushHandler processing " + node.id + " : " + e.description);
}
}
var nCheckScanTimer = 0;
function monitorScan()
{
/*
used when showing the Scanning panel to switch to another panel when the scan has finished
displays the Scanned panel if the resulting backup is overquota, or the scope panel otherwise
there's some 'bounce' in the service state that can mean it appears to stop scanning then starts again
to counter this, we'll wait 5 seconds after a reported stop, and only react if the state is still idle
*/
if(sPhase.toLowerCase() != "scanning")
return;
logTrace('monitorScan with bs=' + nBackupState + ' and quota=' + nQuotaUsagePct);
//don't check until we have the state and the quota pct
if(nBackupState != Backup_State_Undefined && nQuotaUsagePct != -1)
{
//cancel existing timer, and start a new one
if(nCheckScanTimer != 0)
clearTimeout(nCheckScanTimer);
nCheckScanTimer = setTimeout("checkScan(false)", 5000);
}
}
function checkScan(bScanningTimedOut)
{
logTrace('checkScan(' + bScanningTimedOut + ') with bs=' + nBackupState + ', quotapct=' + nQuotaUsagePct);
if(sPhase.toLowerCase() == "scanning" && (bScanningTimedOut || nBackupState != Backup_State_Scanning))
self.onPhase(nQuotaUsagePct > 100 ? "Scanned" : "Scope");
nCheckScanTimer = 0;
}
function triggerScopeClickInUI(shouldIncludeDefaultBackup)
{
var scopeButton$ = null;
if(shouldIncludeDefaultBackup)
scopeButton$ = $('#crbScopeSome');
else
scopeButton$ = $('#crbScopeNone');
setTimeout(
function ()
{
scopeButton$.click();
},
0);
}
var nBuyNow = 0;
this.onScannedChosen = function (el)
{
nBuyNow = el.value;
crbNextButton.style.display = "block";
crbNextButton.setAttribute("destination", "Installation.onScannedNext()");
triggerScopeClickInUI(nBuyNow == 1);
//stop the current event
event.cancelBubble = true;
}
var sSavedComment;
var blnShowedUpsell = false;
this.onScannedNext = function ()
{
//we're either going to take the user to the buy page, or reduce the backup set to zero
//if they're buying, we want to raise a dialog which they 'ok' when they've bought. Then we'll check they bought.
//if they're managing their own backup, we'll confirm their choice, remove documents and settings from the backup set
if(nBuyNow == 1)
{
//if they said they'd buy, did they?
Alert.openOrderWithVerification("ic-QuotaLimitedInstall", "Installation.onPhase('Review')", "Wait.StopWait()");
}
else
{
//they said they want to manually backup, so tell the service to remove 'documents and settings' from the backup set
//Check to see whether to display an upsell message
if(showUpsellMessage() && !blnShowedUpsell)
{
Wait.Popup('lbUpsell');
blnShowedUpsell = true;
}
else
{
self.selectQuotaLimitedPlan();
}
}
}
this.selectUnlimitedPlan = function ()
{
try
{
var elt = document.getElementById('crbBuyNow');
elt.checked = true;
self.onScannedChosen(elt);
Wait.StopPopup();
self.onScannedNext();
}
catch(e)
{
alert(e.description);
}
}
this.selectQuotaLimitedPlan = function ()
{
Wait.StopPopup();
crbScopeNone.click();
self.onPhase("Review");
}
// Check to see whether we should show an upsell message when the user selects the quota-limited product
function showUpsellMessage()
{
try
{
return document.getElementById('crbShowUpsellMessage').innerText == "1";
}
catch(e)
{
}
return false;
}
this.onScopeNext = function ()
{
var bSupportBack = true;
//the user either chose to backup documents and settings or select files manually
//we instruct the service what to backup (or not backup) then got to Review
if($('#crbInstallPhaseScopeAutoRadioButton').attr('checked'))
{
// Explicitly trigger the scope click so that we always include the default backup
// when Automatic mode is selected. This is needed in case the user previously
// selected Advanced -> Start with nothing in your online backup, but then clicked
// the Back button to change the scope to Automatic instead.
triggerScopeClickInUI(true)
self.onPhase("Review", bSupportBack);
}
else
{
self.onPhase("What", bSupportBack);
}
}
this.onWhatNext = function ()
{
triggerScopeClickInUI($('#crbInstallPhaseWhatDefaultRadioButton').attr('checked'))
self.onPhase("Schedule", true /*bSupportBack*/);
}
this.finalizeBackupSchedule = function ()
{
ScheduleSettings.ApplyChanges();
}
this.onScheduleNext = function ()
{
ScheduleSettings.SimpleScheduling();
// Get all the schedule state.
//
if($('#crbScheduleDefaultRadioButton').attr('checked'))
{
ScheduleSettings.SetChoice(document.getElementById('crbScheduleDefaultRadioButton'));
}
else if($('#crbScheduleManualRadioButton').attr('checked'))
{
if($('#daily').attr('checked'))
{
ScheduleSettings.SetChoice(document.getElementById('daily'));
}
else if($('#excludeHours').attr('checked'))
{
ScheduleSettings.SetChoice(document.getElementById('excludeHours'));
}
else
{
var closeFunc = function ()
{
$(this).dialog("close");
}
$("#crbInvalidSchedule").dialog({
show: true,
modal: true,
width: 400,
buttons: { "Close window": closeFunc }
});
return;
}
}
var showEncryption = eval($('.l_ShowEncryption').text());
self.onPhase(showEncryption ? "Encryption" : "Review", true /*bSupportBack*/);
}
this.onEncryptionNext = function ()
{
self.onPhase("Review", true /*bSupportBack*/);
}
this.onReviewNext = function ()
{
self.onPhase("ManualBackup", false /*bSupportBack*/);
}
// Called by the "Advanced setup options" button in PhaseExportKey - MRJ... Can't find this
function togglePKOption()
{
try
{
var advOptions = document.getElementById("crbAdvancedBackupOptions");
var pkOption = document.getElementById("crbPKOption");
advOptions.style.display = (advOptions.style.display == "none") ? "block" : "none";
pkOption.style.display = (pkOption.style.display == "none") ? "block" : "none";
}
catch(e)
{
}
}
var MachineList = new Array();
this.populateMachineList = function (sMachineList)
{
// trim any trailing | character so that the split length is correct
if(sMachineList.substring(sMachineList.length - 1) == "|")
sMachineList = sMachineList.substring(0, sMachineList.length - 1);
// Find the value for how many machine cause the table to show vs. the simpler list
var useTableAfterField = document.getElementById('useTableAfter');
var useTableAfter = 6;
if(null != useTableAfterField)
useTableAfter = parseInt(useTableAfterField.innerText);
if(isNaN(useTableAfter))
useTableAfter = 6;
var Computers = sMachineList.split("|");
var compindex = 0;
var MachineRecord = Computers.length > useTableAfter ? MachineRecordRow : MachineRecordBlock;
if(Computers.length > useTableAfter)
{
document.getElementById('crbShortMachineList').style.display = "none";
document.getElementById('crbLongMachineList').style.display = "";
(new Table(document.getElementById('crbMachineTable'))).MakeResizable();
}
while(Computers[compindex])
{
var mr = new MachineRecord(Computers[compindex]);
MachineList.push(mr);
compindex++;
}
var machineCount = document.getElementById('crbMachineCount');
if(machineCount)
machineCount.innerText = MachineList.length;
}
function IsSupportedPlatform(MachineRecord)
{
var isSupported = false;
var platforms = document.getElementById('crbPlatforms').innerText.split(";");
for(var i = 0; i < platforms.length; i++)
{
isSupported = (platforms[i] == MachineRecord.Platform);
if(isSupported)
break;
}
return isSupported;
}
this.ChooseComputer = function (MachineRecord)
{
// First check that this is okay to select
if(!IsSupportedPlatform(MachineRecord))
return;
// Select this machine, unselect others
for(var i = 0; i < MachineList.length; i++)
MachineList[i].Select(MachineList[i].Number == MachineRecord.Number);
// inform the document of the chosen machine
var machineChosen = document.getElementById('crbMachineChosen');
machineChosen.setAttribute("chosenMachine", MachineRecord.definingString);
crbNextButton.style.display = "block";
crbNextButton.setAttribute("destination", "document.getElementById('crbMachineChoice').click();");
}
/// Posts a page view data type to a CoreMetrics server.
/// Used for tracking installer progress.
/// Attr1 = Reserved
/// Attr2 = Computer Number
/// Attr3 = Client Version
this.postCoreMetric = function (pageId)
{
var dt = new Date();
var st = dt.getTime();
var ciProd = "90382861";
var pageCatId = "CLIENT/INSTALLER2"
var computerUID = top.document.getElementById('crbComputerNumber').innerHTML;
var cjuid = "1";
var cjuidPadding = "1"
if (0 == computerUID.length) {
computerUID = st;
}
if ("DONE" == pageId) {
cjuid = "7"
cjuidPadding = "7"
}
for (var i = 1; i < (23 - computerUID.length); ++i) {
cjuid = cjuid + cjuidPadding;
}
cjuid = cjuid + computerUID;
var cjsid = "1";
for (var i = 1; i < (10 - computerUID.length); ++i) {
cjsid = cjsid + "0";
}
cjsid = cjsid + computerUID;
var url = "http%3A///localhost%3A668/html/Installation.htm";
var imgRoot = "http://data.";
var img = "coremetrics.com/eluminate?tid=1&vn1=4.1.1&vn2=mobile&ec=UTF-8&cjen=1" +
"&ci=" + ciProd +
"&st=" + st +
"&cg=" + pageCatId +
"&pi=ClientInstallerPhase/" + pageId +
"&ul=" + url +
"&cjuid=" + cjuid +
"&cjsid=" + cjsid +
"&cjvf=1";
var imgProd = imgRoot + img;
var imgFull = $('<img src="' + imgProd + '" />')
$("#phases").append(imgFull)
}
}
var Installation = new Installation__();
function onPKHint(hint)
{
document.getElementById('crbPKInputHint').innerHTML = hint;
}
// This gets called from InstallFinalizer.cpp
function setExportPrivateKeyAllowed(allowed)
{
$('.l_ShowEncryption').text(allowed ? 'true' : 'false');
}
function PopulateMachineList(sMachineList)
{
Installation.populateMachineList(sMachineList);
}
function ShowRestoreDecorations()
{
}
function onPhase(x)
{
Installation.onPhase(x);
}
var MoreLessHelper__ = function(moreSelector, lessSelector) {
var moreSelector_ = moreSelector;
var lessSelector_ = lessSelector;
this.showMore = function() {
if (moreSelector_) {
$(moreSelector_).show();
}
if (lessSelector_) {
$(lessSelector_).hide();
}
forceHeightChange();
}
this.showLess = function() {
if (moreSelector_) {
$(moreSelector_).hide();
}
if (lessSelector_) {
$(lessSelector_).show();
}
forceHeightChange();
}
function forceHeightChange() {
var jq = $('.NeedsResizeHack');
jq.css('height', '1px');
jq.css('height', 'auto');
}
}
// Called by install finalizer. Conveys schedule options to system.
function FinishSchedule()
{
Installation.finalizeBackupSchedule();
}