if (isPTZ) self.location = "ptzvid.html";
var DPTZ = true;
var isAnamorphic = '16:9';
if (isAnamorphic == "16:9") {
isAnamorphic = true;
}
else {
isAnamorphic = false;
}
var MAX_LEFT = 1920;
var MAX_TOP = 1080;
var MAX_RAWWIDTH = 1920;
var MAX_RAWHEIGHT = 1080;
if (isAnamorphic) {
MAX_LEFT = Math.ceil(MAX_TOP * (16.0 / 9.0));
MAX_RAWWIDTH = Math.ceil(MAX_RAWHEIGHT * (16.0 / 9.0));
}
var orient = "none";
if (orient.match("90") || orient.match("270") ||
orient.match("BLTR") || orient.match("TLBR")) {
var tmpvar;
tmpvar = MAX_RAWWIDTH;
MAX_RAWWIDTH = MAX_RAWHEIGHT;
MAX_RAWHEIGHT = tmpvar;
tmpvar = MAX_TOP;
MAX_TOP = MAX_LEFT;
MAX_LEFT = tmpvar;
}
var mods = new Object();
var IgnoreDS = 1;
mods.wx = 0;
mods.wy = 0;
if (IgnoreDS) {
mods.ww = 1920;
mods.wh = 1080;
}
else {
mods.ww = 1920;
mods.wh = 1080;
}
if (isAnamorphic) {
mods.ww = Math.ceil(mods.wh * (16.0 / 9.0));
}
var wrw = 1920;
var wrh = 1080;
var cropLeft = 0;
var cropTop = 0;
if (isAnamorphic)
wrw = Math.ceil(wrh * (16.0 / 9.0));
if (wrw > MAX_LEFT) wrw = MAX_LEFT;
if (wrh > MAX_TOP) wrh = MAX_TOP;
var highQuality = 0;
if (IgnoreDS) {
var ds = 1;
}
else {
var ds = 1;
}
var displayDS = '1';
if ((isCamera_7 || isMole) && (displayDS == 1)) {
highQuality = 1;
if (wrh < 1200) {displayDS = 2;}
else {displayDS = 4;}
}
if (isMobile) {
highQuality = 0;
displayDS = 4;
}
if (!displayDS) displayDS = ds;
mods.ds = displayDS;
var dsArray = new Array(1,1.5,2,3,4,5,6,7,8,10,12,14,16);
var dsIndex;
if (isCamera_6) dsArray = new Array(1,2,4);
if (isCamera_7) dsArray = new Array(1,2,4,8);
if (isMole) dsArray = new Array(1);
var snap = "spush";
var image = new Object();
image.width=wrw;
image.height=wrh;
var imAttr ="";
var ovstring = "";
var focusMode = 1;
var urimods="";
var magForHighQuality = 4;
var DEBUG = false;
function activate() {
if (isRaptor) AjaxGetOid ("17.4");
else setEcam2("OidCB17.4","ON");
return false;
}
function round(val, tolerance) {
var rv = val;
if (Math.abs(rv - Math.round(rv)) < tolerance) {
rv = Math.round(rv);
}
return rv;
}
function getArgs() {
var args = new Object();
var query = location.search.substring(1);
query = query.replace(/\?/g,"&");
var pairs = query.split("&");
for (var i=0; i0){
if(isCondor && liveStreamJpegPortrait) {
image.height = image.height*600/image.width;
image.width = 600;
}
else{
image.height = image.height*900/image.width;
image.width = 900;
}
}
if (!isCamera_6 && args.ov) ovstring = "?ov=" + parseInt(args.ov);
if(isCondor && liveStreamJpegPortrait) {
imAttr = ' width="' + image.height
+ '" height="' + image.width + '" border=0 ';
}
else {
imAttr = ' width="' + image.width
+ '" height="' + image.height + '" border=0 ';
}
}
function getArgsLocal(args) {}
function magnification() {
if (isCamera_6) return image.height/(wrh/mods.ds);
return image.height*mods.ds/mods.wh/ds;
}
function setOvstring() {
var magfactor = magnification();
if (isCamera_6) ovstring = "";
else {
if (magfactor < 0.9 || magfactor > 1.1) ovstring = "?ov=0";
else ovstring = "";
}
if (magfactor > magForHighQuality)
ovstring += "?jg=92";
}
function setDSIndex() {
for (var i=0;i= dsArray[i]) dsIndex = i;
}
return dsIndex;
}
function lowerDS() {
if (dsIndex==null) setDSIndex();
if (dsIndex==0) return false;
mods.ds = dsArray[--dsIndex];
return true;
}
function raiseDS() {
if (dsIndex==null) setDSIndex();
if (dsIndex==(dsArray.length-1)) return false;
mods.ds = dsArray[++dsIndex];
return true;
}
function setDS() {
var oldMag = magnification();
var newMag = oldMag;
if (newMag>1.0){
while (Math.abs(newMag-1.0) <= Math.abs(oldMag-1.0)) {
if (! lowerDS()) break;
oldMag = newMag;
newMag = magnification();
}
if (Math.abs(newMag-1.0) > Math.abs(oldMag-1.0)) {
raiseDS();
oldMag = newMag;
newMag = magnification();
}
}
if (newMag<1.0) {
while (Math.abs(newMag-1.0) <= Math.abs(oldMag-1.0)) {
if (! raiseDS()) break;
oldMag = newMag;
newMag = magnification();
}
if (Math.abs(newMag-1.0) > Math.abs(oldMag-1.0)) {
lowerDS();
oldMag = newMag;
newMag = magnification();
}
}
if (! isCamera_6) {
while (mods.ww*ds/mods.ds > wrw
|| mods.wh*ds/mods.ds > wrh) {
if (! raiseDS()) break;
}
}
setOvstring();
}
function adjustSizes(tolerance) {
var tmpH = Math.round(mods.wh/ds);
var tmpW = Math.round(mods.ww/ds);
if (image.height > tmpH) {
var mult = Math.round(image.height/tmpH);
if ((Math.abs(image.height - mult*tmpH) < tolerance) ||
(Math.abs(image.width - mult*tmpW) < tolerance)) {
image.height = mult*tmpH;
image.width = mult*tmpW;
}
} else {
var mult = Math.round(tmpH/image.height);
if ((Math.abs(image.height - tmpH/mult) < tolerance) ||
(Math.abs(image.width - tmpW/mult) < tolerance)) {
image.height = Math.round(tmpH/mult);
image.width = Math.round(tmpW/mult);
}
}
}
function sizeUp(factor) {
var eps = 2;
if (image.height*factor>wrh+eps || image.width*factor>wrw+eps) {
handleError("maxsize");
}
else if (isCamera_6 &&
(image.height*factor>mods.wh+eps ||
image.width*factor>mods.ww+eps))
handleError("maxsize");
else {
image.height = Math.ceil(image.height*factor);
image.width = Math.ceil(image.width*factor);
if (image.height>wrh) image.height = wrh;
if (image.width >wrw) image.width = wrw;
adjustSizes(5);
loadNewPage();
}
return false;
}
function sizeDown(factor) {
if (mods.ds >= 16 ||
image.height < 100 ||
image.width < 100) handleError("minsize");
else {
image.height = Math.round(image.height/factor);
image.width = Math.round(image.width/factor);
adjustSizes(5);
loadNewPage();
}
return false;
}
function sizeMax() {
if ((image.height == wrh &&
image.width == wrw))
handleError("maxsize");
else {
image.height = wrh;
image.width = wrw;
loadNewPage();
}
return false;
}
function imageArgs() {
if (isCamera_7) {
if (highQuality) {
return "?ds=1";
}
else {
return "?ds=" + mods.ds;
}
}
if (isCamera_6) {
if (DPTZ) {
ds = mods.ds;
return "?wx=" + mods.wx + "?wy=" + mods.wy
+ "?ww=" + mods.ww + "?wh=" + mods.wh
+ "?ds=" + mods.ds
+ ovstring + urimods;
} else {
return urimods;
}
}
else
return "?ww=" + mods.ww + "?wh=" + mods.wh
+ "?wx=" + mods.wx + "?wy=" + mods.wy
+ ((mods.ds == ds) ? "":("?ds=" + mods.ds))
+ ovstring + urimods;
}
function stillImageString() {
var now = new Date();
return "now.jpg?snap=pre" + imageArgs() + "?dummy=" + now.getTime();
}
var haveVsmac = "0";
function imageString() {
var now = new Date();
if (haveVsmac == "1") return "VSMAC";
return "now.jpg?snap=" + snap + imageArgs() + "?dummy=" + now.getTime();
}
function myURL() {
var now = new Date();
var rv = location.pathname + imageArgs()
+ "?width=" + image.width + "?height=" + image.height;
if (focusMode>1) rv += "?mode=" + focusMode;
rv += "?dummy=" + now.getTime();
return rv;
}
function getVarsFromApplet() {
}
function loadNewPage() {
getVarsFromApplet();
setDS();
self.location = myURL();
return false;
}