// Copyright (c) 2006 Industrial Video & Control Co. LLC. All rights reserved. var imagesLoaded = new Array(); function displayViewLayout() { var errorMsg = checkViewLayoutParams(); if (errorMsg.length == 0) { var tableLayout = getViewLayout(); var divViewLayout = document.getElementById("divViewLayout"); divViewLayout.innerHTML = tableLayout; } else alert(errorMsg); } function getViewLayout() { //alert("rows: " + rows + " columns: " + columns + " order: " + order + " feeds: " + feeds); var tableLayout = ""; var feedIndex = 0; var orderUpper = order.toUpperCase(); for (var r = 0; r < rows; ++r) { if (orderUpper == "V") feedIndex = r; tableLayout += ""; for (var c = 0; c < columns; ++c) { var imageName = "image" + (r+1) + (c+1); tableLayout += ""; if (orderUpper == "H") feedIndex++; else feedIndex += columns; } tableLayout += ""; } tableLayout += "
"; var feedId = feeds[feedIndex]; var imageType = feedImageTypes[feedIndex]; if (feedId == null || imageType == null) tableLayout += getErrorImageCell(imageName); else { var fps = feedFps[feedIndex]; if (fps == null) fps = 1; if (imageType != 1 || useIvcAx) tableLayout += getIvcAxImageCell(feeds[feedIndex], imageName, fps); else tableLayout += getJpegImageCell(feeds[feedIndex], imageName, fps); } tableLayout += "
"; //alert(tableLayout); return tableLayout; } function getJpegImageCell(feedId, imageName, fps) { var cell = ""; if (feedId != null) { cell = ""; cell += ""; cell += ""; cell += ""; cell += ""; cell += ""; cell += ""; cell += ""; } return cell; } function getErrorImageCell(imageName) { var cell = ""; return cell; } function loadImage(image, feedId, fps) { if (image != null && feedId != null && feedId > 0) { if (navigator.appName == "Netscape" && isImageLoaded(image.name) == false) image.onload = ""; image.src = getImageSrc(feedId, fps); window.status = "Receiving unlimited frames..."; if (isImageLoaded(image.name) == false) imagesLoaded[imagesLoaded.length] = image.name; } } function getImageSrc(feedId, fps) { // /video/// var frames = (navigator.appName == "Netscape") ? 0 : 1; var path = getRelayServerUrl() + "/video/" + feedId + "/" + frames + "/" + "fps=" + fps + "/" + (new Date()).getTime(); return path; } function getRelayServerUrl() { return (location.protocol + "//" + location.hostname + ((location.port != "") ? (":" + location.port) : "")); } function isImageLoaded(imageName) { var loaded = false; for (var i = 0; i < imagesLoaded.length; ++i) { if (imagesLoaded[i] == imageName) { loaded = true; break; } } return loaded; } function checkViewLayoutParams() { var errorMsg = ""; if (rows <= 0) errorMsg = "Number of rows: " + rows + " specified was invalid."; else if (columns <= 0) errorMsg = "Number of columns: " + columns + " specified was invalid."; else if (feeds == null) errorMsg = "No feeds were specified for the view."; else { var orderUpper = order.toUpperCase(); if (orderUpper != "V" && orderUpper != "H") errorMsg = "Order: " + order + " was invalid."; } return errorMsg; } function imageClicked(oImage, feedId, oEvent) { if (enablePtClk) { var pos = getObjectPos(oImage, oEvent); var x = pos[0]; var y = pos[1]; requestPointClick(feedId, imageWidth, imageHeight, x, y); } } function imageMouseMoved(oImage, oEvent) { oImage.style.cursor = getHandCursorName(); }