// Copyright (c) 2001 Industrial Video & Control Co. LLC. All rights reserved. //====================================================================================================================== // Predefined Scripts Necessary to use the system - Javascript Modifications should not be necessary be beow this line. //======================================================================================================================fg== var SWITCHarray = new Array(1); // dynamically generated by relay-server /info request var ReverseSWITCHarray = new Array(1); // dynamically generated by relay-server /info request tempImage = new Image(); tempImage2 = new Image(); tempImage2.src = "/IVC/images/errors/temporarilyDown.jpg"; updateCount = 0; imageloaded = 0; presetnumber = 1; panpresetnumber = 1; var pointClickLink = 1; // just make this var global to this file // Make sure this is the top page //if (top.location == self.location) {top.location.href="index.htm"} // Other variables - Do not modify. // now found in the display routines // // panImageName = new Array(numberOfPanoramas); // for (i=1; i<= numberOfPanoramas; i++) { // panImageName[i] = "/IVC/images/panorama/panimage" + channel + "-" + i +".jpg"; // } extension = new Date(); extension = extension.getTime(); count = framesPerStream; function initPageTimer() { time=setTimeout("initPageScript();",2000); } function getCookie(NameOfCookie) { if (document.cookie.length > 0) { begin = document.cookie.indexOf(NameOfCookie+"="); if (begin != -1) { begin += NameOfCookie.length+1; end = document.cookie.indexOf(";", begin); if (end == -1) end = document.cookie.length; return unescape(document.cookie.substring(begin, end)); } } return null; } function setCookie(NameOfCookie, value) { document.cookie = NameOfCookie + "=" + escape(value) + "; path=/"; } function initPage() { // parent.sidebar.location='/blank.htm'; // parent.controlframe.location='/blank.htm'; // parent.queueframe.location='/blank.htm'; // parent.infoframe.location='/blank.htm'; // MERGE if (parent.controlType == "manage") { parent.controlFlag = 1; } else { parent.controlFlag = 0; } if (getCookie("CamNum") != null) { parent.cameraNumber = getCookie("CamNum") } else { //channel = 1; channel = parent.cameraNumber } if (useChannelDropDownBox == 1) { //document.selectionForm.cameraSelectionList.selectedIndex= parent.cameraNumber - 1; channel = parent.cameraNumber; // JDM-1 use mapping document.selectionForm.cameraSelectionList.selectedIndex = ReverseSWITCHarray[channel] - 1; } // Look for the appropriate control type // MERGE if (parent.controlType == "control" || parent.controlType == "") { //if (!controlType) { // Use default control routine movebaseurl=baseurl + "/control/" + channel } else { // Use specified control routine // MERGE movebaseurl=baseurl + "/" + parent.controlType + "/" + channel //movebaseurl=baseurl + "/" + controlType + "/" + channel if (returnType != "") parent.sidebar.location= movebaseurl + '/cmd=mng&return=' + returnType; } baseImagePath = baseurl + "/video/" + channel //queueRequestURL = movebaseurl + "/queuestatus" queueRequestURL = "/queue1.htm" singleImagePath = baseImagePath + '/1/' + 'fps=' + maxFramesPerSecond; multiImagePath = baseImagePath + '/' + framesPerStream + '/fps=' + maxFramesPerSecond; alertflag = 0; window.status = "Live streaming video..."; // Sets status bar in browser //document.mainimage.src="images/loading.gif" // Display image before video loads. // Make sure Variables are defined script_doNotUseVideo = "" + parent.main.doNotUseVideo; if (script_doNotUseVideo == "undefined") { time=setTimeout("setPageProperties()",1000); firstImage(); } if (updateImageAfterMove == 1) { // MERGE if (channel == 0) return; document.mainimage.onload = ""; document.mainimage.src = baseImagePath + '/1/'; } } function setPageProperties() { count = framesPerStream; scriptName=""; if (queuingEnabled == 1) { parent.queueframe.location = queueRequestURL; } // Load Presets into Pull Down Menu if '1' // MERGE if (usePresetDropDownBox == 1 && useChannelDropDownBox == 1 && channel != 0) { //if (usePresetDropDownBox == 1 && useChannelDropDownBox == 1) { scriptName = baseurl + '/info/' + parent.cameraNumber + '/presetlist&cameralist/' + extension; //alert(scriptName ); // MERGE } else if (usePresetDropDownBox == 1 && channel != 0) { //} else if (usePresetDropDownBox == 1) { scriptName = baseurl + '/info/' + parent.cameraNumber + '/presetlist'; //alert(scriptName ); // MERGE } else if (useChannelDropDownBox == 1 && channel != 0) { //} else if (useChannelDropDownBox == 1) { scriptName = baseurl + '/info/' + parent.cameraNumber + '/cameralist'; //alert(scriptName ); } if (scriptName != "") { //text = "" //parent.infoframe.document.write("" + text + "getting-info\n\n"); parent.infoframe.location = scriptName; } // Rename Links for (Count = 0; Count < document.links.length; Count ++) { Ret = document.links[Count].href; if (Ret == 'http://127.0.0.1/point_click_link/') { pointClickLink = Count; //document.links[Count].href=movebaseurl + "/cmd=point&iheight=" + document.mainimage.height + "&iwidth=" + document.mainimage.width } else if (Ret == 'http://127.0.0.1/first_imagemap_link' ) { firstImageMapLink = Count; } else if (Ret == 'http://127.0.0.1/panorama_link_1') document.links[Count].href = movebaseurl + "/cmd=pan&panpresetnumber=1&iheight=" + document.panimage1.height + "&iwidth=" + document.panimage1.width else if (Ret == 'http://127.0.0.1/panorama_link_2') document.links[Count].href = movebaseurl + "/cmd=pan&panpresetnumber=2&iheight=" + document.panimage2.height + "&iwidth=" + document.panimage2.width else if (Ret == 'http://127.0.0.1/panorama_link_3') document.links[Count].href = movebaseurl + "/cmd=pan&panpresetnumber=3&iheight=" + document.panimage3.height + "&iwidth=" + document.panimage3.width } // Update the Point & Click Reference document.links[pointClickLink].href=movebaseurl + "/cmd=point&iheight=" + document.mainimage.height + "&iwidth=" + document.mainimage.width updateControlPanelLinks(); } function enlargePopup() { remote = window.open("enlarge.htm", "IVCRemote", "top=1,width=600,height=460,resizable=yes,scrollbars=0"); document.mainimage.src=document.mainimage.src; } function goToPreset( ){ index = document.selectionForm.presetSelectionList.selectedIndex; presetnumber = document.selectionForm.presetSelectionList.options[index].value; movedata=movebaseurl + "/cmd=dir&dir=p&presetnumber=" + presetnumber; parent.sidebar.location=movedata; document.selectionForm.presetSelectionList.selectedIndex=0; document.selectionForm.presetSelectionList.options[0].text='Going to ' + document.selectionForm.presetSelectionList.options[index].text; id = setTimeout("displayPresetText()",2000); } function setOption(){ index = document.selectionForm.optionSelectionList.selectedIndex; selectionnumber = document.selectionForm.optionSelectionList.options[index].value; if (selectionnumber == 3) { parent.location = "/IVC/EVM/index.htm" } if (selectionnumber == 1) { enlargePopup(); } if (selectionnumber == 2) { if (updateImageAfterMove == 0) { updateImageAfterMove = 1; update(); } else { updateImageAfterMove = 0; initPage(); } } if (selectionnumber == 4) { updatePan(1); } if (selectionnumber == 5) { updatePan(2); } if (selectionnumber == 6) { updatePan(3); } if (selectionnumber == 7) { // Normal Light if(parent.main.lowlightenable > 0) { parent.sidebar.location = "/setvar/" + parent.cameraNumber + "/type=vcv&lowLightEnable=0"; } else { parent.sidebar.location = "/setvar/" + parent.cameraNumber + "/type=vcv&lowLightEnable=1"; } if (parent.main.state_active != 1) { alert("Feed must be active to use this feature."); } parent.history.go(); document.mainimage.src = document.mainimage.src; } if (selectionnumber == 8) { // IR Low Light parent.sidebar.location = parent.zoombaseurl + "8101040102FF"; document.mainimage.src = document.mainimage.src; //setTimeout("LowLight();" ,2000); } if (selectionnumber == 9) { // IR Normal Light parent.sidebar.location = parent.zoombaseurl + "8101040103FF"; document.mainimage.src = document.mainimage.src; //setTimeout("DarkLight();" ,2000); } if (selectionnumber == 10) { maxFramesPerSecond = 0; singleImagePath = baseImagePath + '/1/' + 'fps=' + maxFramesPerSecond; multiImagePath = baseImagePath + '/' + framesPerStream + '/fps=' + maxFramesPerSecond; firstImage(); } if (selectionnumber == 11) { maxFramesPerSecond = 1; singleImagePath = baseImagePath + '/1/' + 'fps=' + maxFramesPerSecond; multiImagePath = baseImagePath + '/' + framesPerStream + '/fps=' + maxFramesPerSecond; firstImage(); } if (selectionnumber == 12) { maxFramesPerSecond = 2; singleImagePath = baseImagePath + '/1/' + 'fps=' + maxFramesPerSecond; multiImagePath = baseImagePath + '/' + framesPerStream + '/fps=' + maxFramesPerSecond; firstImage(); } if (selectionnumber == 13) { maxFramesPerSecond = 3; singleImagePath = baseImagePath + '/1/' + 'fps=' + maxFramesPerSecond; multiImagePath = baseImagePath + '/' + framesPerStream + '/fps=' + maxFramesPerSecond; firstImage(); } if (selectionnumber == 14) { maxFramesPerSecond = 4; singleImagePath = baseImagePath + '/1/' + 'fps=' + maxFramesPerSecond; multiImagePath = baseImagePath + '/' + framesPerStream + '/fps=' + maxFramesPerSecond; firstImage(); } if (selectionnumber == 15) { maxFramesPerSecond = 5; singleImagePath = baseImagePath + '/1/' + 'fps=' + maxFramesPerSecond; multiImagePath = baseImagePath + '/' + framesPerStream + '/fps=' + maxFramesPerSecond; firstImage(); } if (selectionnumber == 16) { if (parent.SERVERMODE == 1) //SERVERMODE_NORMAL = 1 FIXME MAJDOUB { parent.main.location = '/multicam.htm'; } else { alert("Sorry You are only allowed to view one Camera") } } // JDM-2 if (selectionnumber == 17) { parent.location = '/IVC/EVM/ARCH-index.htm'; } // Enable Feed if (selectionnumber == 18) { parent.main.location = "/setvar/" + parent.cameraNumber + "/type=feed&f_active=1"; } document.selectionForm.optionSelectionList.selectedIndex=0; } function LowLight(){ parent.sidebar.location = movebaseurl + "/cmd=video&function=VISCA-8101044A00000003FF"; document.mainimage.src = document.mainimage.src; } function DarkLight(){ parent.sidebar.location = movebaseurl + "/cmd=video&function=VISCA-8101044A00000000FF"; document.mainimage.src = document.mainimage.src; } function updatePan(preset) { managerbaseurl = movebaseurl + "/cmd=pan&function=update&return=refresh&panpresetnumber=" + preset ; parent.sidebar.location=managerbaseurl; document.mainimage.src = document.mainimage.src; } function displayPresetText(text){ text = "Preset Views"; document.selectionForm.presetSelectionList.options[0].text=text } function savePicture(){ if (useMpegViewer && (parent.main.document.selectionForm.mainCamLivePlayer.getServerModelType() == 18 )) { try { parent.main.document.selectionForm.mainCamLivePlayer.TakeSnapShot(document.selectionForm.pictureName.value, channel); } catch (e) { //alert( e); } alert("Image is saved to C:\\IVC\\Archive\\snaps\\"+channel ); } else { snapString = baseurl + "/snapshot/" + channel + "/cmd=snap&name=" + document.selectionForm.pictureName.value; parent.sidebar.location = snapString; document.mainimage.src = document.mainimage.src; } } function saveVideoWithoutDuration(){ if (useMpegViewer && parent.main.document.selectionForm.mainCamLivePlayer.getServerModelType() == 18 ) { try { parent.main.document.selectionForm.mainCamLivePlayer.SaveVideo(document.selectionForm.pictureName.value, 1); } catch (e) { //alert( e); } } else { parent.sidebar.location = "/storage/" + parent.cameraNumber + "/cmd=dump&name=" + document.selectionForm.pictureName.value; document.mainimage.src = document.mainimage.src; alert("Video Frames are being saved to Disk."); } } function saveVideoWithDuration(){ if (useMpegViewer && parent.main.document.selectionForm.mainCamLivePlayer.getServerModelType() == 18 ) { try { parent.main.document.selectionForm.mainCamLivePlayer.SaveVideo(document.selectionForm.pictureName.value, 1); } catch (e) { //alert( e); } } else { parent.sidebar.location = "/storage/" + parent.cameraNumber + "/cmd=dump&dumpDuration=" + document.selectionForm.videoDuration.value + "&name=" + document.selectionForm.pictureName.value; document.mainimage.src = document.mainimage.src; alert("Video Frames are being saved to Disk."); if (parent.main.saveVideoTimeout != null) { clearTimeout(parent.main.saveVideoTimeout); parent.main.saveVideoTimeout = null; } } parent.main.saveVideoTimeout = setTimeout("savingVideo(5000, 0);",1000); } function stopSaveVideo(){ if (useMpegViewer && parent.main.document.selectionForm.mainCamLivePlayer.getServerModelType() == 18) { try { parent.main.document.selectionForm.mainCamLivePlayer.SaveVideo(document.selectionForm.pictureName.value, 0); } catch (e) { //alert( e); } } else { parent.sidebar.location = "/storage/" + parent.cameraNumber + "/cmd=dump&dumpDuration=0"; document.mainimage.src = document.mainimage.src; if (parent.main.saveVideoTimeout != null) { clearTimeout(parent.main.saveVideoTimeout); parent.main.saveVideoTimeout = null; parent.main.document.selectionForm.saveVideoButton.src = '/IVC/images/SaveVideo.gif'; parent.main.document.dumpingVideo = 0; } } } function savingVideo(startCountdown, flipSaveVideoButton){ camNumber = getCookie("CamNum"); if (camNumber == null) camNumber = 1; scriptName = '/info/' + camNumber + '/getvar&dumpingVideo'; text = "