No camera images at the selected time.
Click to play the next images.
");
$("#fileName").html("");
}
function CheckBrowser() {
var ua = $.browser;
if (ua.msie && ua.version < 8.0) {
return false;
} else {
if (ua.msie && ua.version == 8.0) {
isIE8 = true;
}
isSupport = true;
return true;
}
}
function getClientBounds() {
var clientWidth;
var clientHeight;
if ($.browser.msie) {
clientWidth = document.body.clientWidth;
clientHeight = document.body.clientHeight;
}
else if ($.browser.safari) {
clientWidth = window.innerWidth;
clientHeight = window.innerHeight;
}
else if ($.browser.Opera) {
clientWidth = Math.min(window.innerWidth, document.body.clientWidth);
clientHeight = Math.min(window.innerHeight, document.body.clientHeight);
}
else {
clientWidth = Math.min(window.innerWidth, document.documentElement.clientWidth);
clientHeight = Math.min(window.innerHeight, document.documentElement.clientHeight);
}
return { width: clientWidth, height: clientHeight };
}
function AdjustScreenSize(type) {
var h = 600, w = 800;
h = $(window).height();
w = $(window).width();
h = window.innerHeight;
w = window.innerWidth;
AdjustSize(w - 20, h - 30, 0);
// Log("h:" + h + " w:" + w);
// var imgObj = $("#cameraImg");
// Log("img:h:" + $(imgObj).height() + " w:" + $(imgObj).width());
// if ($(imgObj).height() > h || $(imgObj).width() > w) {
// $(imgObj).height(h);
// $(imgObj).width(w);
// }
}
function GetInitDate() {
var date = new Date();
date.setFullYear(2000, 0, 1); // 2000, Jan, 1
return date;
}
function GetSlideDate(value) {
var strCurrDate = $(".datePicker").val();
var currDate = new Date();
if (strCurrDate != null && strCurrDate != "") {
strCurrDate = strCurrDate.replace(/-/g, "/");
currDate = new Date(Date.parse(strCurrDate));
}
if (value > 0) {
currDate.setHours(parseInt(value / 60));
currDate.setMinutes(parseInt(value % 60));
currDate.setSeconds(0);
}
return currDate;
}
function Resize(i) {
var img = $("#cameraImg");
if (img == null) {
return;
}
var sizes = GetImageSizes();
if (sizes != null && sizes.length == 2 && i != 0) {
AdjustSize(sizes[0], sizes[1], i);
} else if (dataSource != null && dataSource.length > 0) {
var temImage = new Image();
temImage.onload = function () {
AdjustSize(temImage.width, temImage.height, i);
};
temImage.src = "data:image/jpg;base64," + dataSource[0].imgContent;
}
}
function AdjustSize(width, height, balance) {
var img = $("#cameraImg");
if (img == null || img[0]==null ||
img[0].src.indexOf("CameraLoading.gif") > 0) {
return;
}
//debugger;
var h, w;
switch (balance) {
case 0:
h = height;
w = width;
break;
case 1:
h = height + 30;
w = width + 30;
break;
case -1:
if (height < 30) { height = 30; }
if (width < 30) { width = 30; }
h = height - 30;
w = width - 30;
break;
}
var temImage = new Image();
temImage.onload = function () {
//AdjustSize(temImage.width, temImage.height, i);
var oh = temImage.height, ow = temImage.width;
var h_scale = (h) / oh; //John, 10/4/2012, reduce height by 100
var w_scale = w / ow;
var scale = Math.min(h_scale, w_scale);
img.height(oh * scale);
img.width(ow * scale);
//img.resize(oh * scale, ow * scale);
Log("h:" + img.height() + " w:" + img.width());
//alert("h:" + img.height() + " w:" + img.width() + " Scale:" + scale);
SetImageSize(img.height(), img.width());
};
temImage.src = "data:image/jpg;base64," + dataSource[0].imgContent;
}
function GetImageSizes() {
var hight = localStorage.getItem("imgHeight")
if (hight != null && hight != undefined && hight + "" != "0") {
hight = parseInt(hight);
var width = localStorage.getItem("imgWidth");
width = parseInt(width);
return new Array(width, hight);
} else {
return null;
}
}
function SetImageSize(hight, width) {
localStorage.setItem("imgHeight", hight);
localStorage.setItem("imgWidth", width);
}
function onFinishSlide(obj) {
$.mobile.hidePageLoadingMsg("b");
Log("--" + (pressing ? "Pressing" : "Not Pressing"));
if (pressing) {
pressing = false;
var d = GetSlideDate();
var v = GetJOSNDate(d);
if ($(obj).parent().siblings(0).attr("name") == "pro_camerashow") {
ShowByDate(v);
} else {
GetOnePackageImages(v);
}
}
}
var pressing = false;
function BindEvent() {
var slideControl = $('.slider').next().children('a');
slideControl.unbind("vmousedown");
slideControl.unbind("vmouseup");
$('.slider').unbind("change");
$(document).unbind("vmouseup");
slideControl.bind('vmousedown', function () {
Stop();
pressing = true;
});
$('.slider').bind("change", function (event, ui) {
var slider_value = this.value;
var d = GetSlideDate(slider_value);
var str = d.getFullYear() + "-" + FormatTime(d.getMonth() + 1) + "-" + FormatTime(d.getDate()) + " " + FormatTime(d.getHours()) + ":" + FormatTime(d.getMinutes()) + ":" + FormatTime(d.getSeconds());
$(".datePicker").val(str);
if (pressing)
$.mobile.showPageLoadingMsg("b", str, true);
});
$('.slider').next().children('a').bind('vmouseup', function (event) {
onFinishSlide(this);
});
$(document).bind('vmouseup', function () {
if (pressing) {
slideControl.trigger("mouseup");
}
});
var beforeDate = null;
var now = new Date();
var min = new Date();
min.setTime(now.getTime() - (1000 * 24 * 60 * 60 * 1000));
var beforeStatusRunning = !stopped;
$('.datePicker').scroller({
preset: 'datetime',
minDate: new Date(min.getFullYear(), min.getMonth(), min.getDate(), min.getHours(), min.getMinutes(), min.getSeconds()),
maxDate: new Date(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), now.getMinutes(), now.getSeconds()),
theme: 'sense-ui',
display: 'modal',
mode: 'calbox',
dateFormat: 'yy-mm-dd',
timeFormat: 'HH:ii:ss',
onShow: function (html, inst) {
showTime = false;
beforeDate = $(".datePicker").val();
beforeStatusRunning = !stopped;
Stop();
},
onSelect: function (dateText, inst) {
showTime = true;
if (beforeDate == dateText) {
if (beforeStatusRunning) {
Start();
}
return;
}
try{
$('.slider').slider('enable');
}catch(e){}
dateText = dateText.replace(/-/g, "/");
d = new Date(Date.parse(dateText));
var v = GetJOSNDate(d);
if ($(this).attr("name") == "dt_camerashow") {
ShowByDate(v);
} else {
GetOnePackageImages(v);
}
return;
},
onCancel: function () {
$('.slider').slider('enable');
if (beforeStatusRunning) {
Start();
}
}
});
Log("Event Binding...");
}
function StartCameraShow() {
$("#cameraImg").load(function () {
$(this).data = null;
});
BindEvent();
detectSpeed = true;
AdjustScreenSize(0);
$(window).resize(function () {
AdjustScreenSize(1);
});
var date = GetInitDate(); // set it to Jan 1, 2000
isSearch = 1; // Search for the last image;
ShowByDate(GetJOSNDate(date)); // Starts playing at the last image zip file;
$(".cameraname").html(cameraname);
stopTimer = setTimeout("Stop()", playfor);
}
//--------End Camera Show---
//--------Slide Show--------
var imgPreWidth = 80, imgPreHeight = 60;
function GetShortName(name) {
if (name.length > 10)
return name.substring(0, 5) + "..." + name.substring(name.length - 3);
return name;
}
var cacheItems = new Array();
var pullOnePackageTask = null;
function GetOnePackageImages(dtDateTime) {
currMaxDateTime = dtDateTime;
stopped = false;
ct = new Jscex.Async.CancellationToken();
$(".imgListBox").html("