(function () {
if (!
/*@cc_on!@*/
0) return;
var e = "abbr, article, aside, audio, canvas, datalist, details, dialog, eventsource, figure, footer, header, hgroup, mark, menu, meter, nav, output, progress, section, time, video".split(', ');
var i = e.length;
while (i--) {
document.createElement(e[i])
}
})()
String.prototype.format = function () {
var args = arguments;
return this.replace(/{(\d+)}/g, function (match, number) {
return typeof args[number] != 'undefined'
? args[number]
: match
;
});
};
function CreateFBLike() {
if (typeof showFB != "undefined") {
if (showFB == 0)
return;
}
if (location.href.toLowerCase().indexOf("/secure/camera/") >= 0) {
return;
}
//$("#FBContainer").css("display", "");
(function (d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) { return; }
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=286601451370037";
fjs.parentNode.insertBefore(js, fjs);
} (document, 'script', 'facebook-jssdk'));
}
function FBUnaccessible() {
$("#FBContainer").css("width", "0");
}
function ExpireTip() {
var oneDay = 1000 * 3600 * 24;
//sUtcDate = "10/26/2014 5:24:30 AM";
var expiredDate = new Date(Date.parse(sExpirationDate+" UTC"));//after convertion, expireDate is a local datetime.
var used = parseInt(plans[0].Used);
var total = parseInt(plans[0].CamLicense);
var licenseClass = "enoughLicense";
if (used > total)
{
licenseClass = "notEnoughLicense";
}
if (!isNaN(expiredDate.getTime())) {
//var expiredDate = new Date(createdDate.getTime() + oneDay * 3);
var now = new Date();
//var nowUtc = new Date(now.getTime() + (now.getTimezoneOffset() * 60000));
var timeDiff = Math.ceil(expiredDate.getTime() - now.getTime());
var expireDateLocal = FormatDateTime(expiredDate);
var expireTip = "Your cloud recording free trial will expire and switch to the free plan at " + expireDateLocal;
if (timeDiff > oneDay * 2) {
document.write("Free trial");
} else if (timeDiff>0 && timeDiff <= oneDay * 2) {
document.write("Free trial");
//check if the account will be expired.
//document.write("Your free service will expire in ");
//var timeinDay = parseInt(timeDiff / oneDay) + 1;
//if (timeinDay > 1) {
// //only left few hours.
// document.write(timeinDay + " days");
//} else {
// //left at latest 2 days.
// var diffinHour = parseInt((timeDiff) / (1000 * 3600));
// diffinHour = diffinHour < 1 ? 1 : diffinHour;
// if (diffinHour > 1) {
// document.write(diffinHour + " hours");
// } else {
// document.write(diffinHour + " hour");
// }
//}
//document.write("");
} else {
//means the account already expired.
//document.write("");
document.write("");
}
document.write("Camera License (" + used + "/" + total + ")");
document.write("Subscribe");
}
else { // paid account
//document.write("Paid account");
if(used>total)
document.write("Camera License (" + used + "/" + total + ")");
//document.write("Upgrade");
}
// $('.accttip').hover(function (e) { // Hover event
// if (plans == null || plans == "NULL" || plans == "")
// return;
// var template = "";
// template += '';
// template += '- Account
';
// template += '- Camera Licenses: ' + plans[0].CamLicense + '
';
// template += '- Retention: ' + plans[0].Retention + '
';
// template += '- Image Plan
';
// //template += '- Camera License:' + plans[0].CamLicense + '
';
// template += '- Resolution: ' + plans[0].Resolution + '
';
// template += '- Upload Frequency: ' + plans[0].Frequency + '
';
// //template += '- Retention:' + plans[0].Retention + '
';
// template += '- Motion Detection: ' + plans[0].Motion + '
';
// template += '- Video Plan
';
// // template += '- Camera License:' + plans[1].CamLicense + '
';
// template += '- Resolution: ' + plans[1].Resolution + '
';
// template += '- Upload Frequency: ' + plans[1].Frequency + '
';
// //template += '- Retention:' + plans[1].Retention + '
';
// template += '- Motion Detection: ' + plans[1].Motion + '
';
// template += '';
// var $obj = $(".plantooltip");
// if ($obj.length == 0 || $obj == undefined || $obj == null) {
// $obj = $(template).appendTo('body');
// }
// var left = (e.pageX + 20);
// if (e.pageX + $obj.width() + 10 > $(window).width()) {
// left = $(window).width() - ($obj.width() + 80)
// }
// $obj.css('top', (e.pageY - 10) + 'px')
// .css('left', left + 'px')
// .fadeIn('slow');
// }, function () { // Hover off event
// if ($('.plantooltip').length > 0) {
// $('.plantooltip').remove();
// }
// }).mousemove(function (e) { // Mouse move event
// if ($('.plantooltip').length <= 0)
// return;
// var left = (e.pageX + 20);
// if (e.pageX + $('.plantooltip').width() + 10 > $(window).width()) {
// left = $(window).width() - ($('.plantooltip').width() + 80)
// }
// $('.plantooltip')
// .css('top', (e.pageY - 10) + 'px')
// .css('left', left + 'px');
// });
}
function CheckNewMessage(newMsgNum) {
if (newMsgNum <= 0) {
return;
}
if (newMsgNum >= 100)
newMsgNum = "99+";
$(".msgNum").text(newMsgNum);
$(".msgNum").show();
}