';
if(i<8){
tempstr += inner;
}
else{
tempstr1 += inner;
}
}
else{
chnName = lg.get("IDS_CH")+(i+1);
if(i<16){
tempstr1+='';
}else if(i<24){
tempstr2+='';
}else{
tempstr3+='';
}
}
}
document.getElementById(joinDiv+"_1").innerHTML=tempstr;
document.getElementById(joinDiv+"_2").innerHTML=tempstr1;
if(gDvr.nChannel>16 && gDvr.nChannel<=24){
document.getElementById(joinDiv+"_3").innerHTML=tempstr2;
}
if(gDvr.nChannel>24){
document.getElementById(joinDiv+"_3").innerHTML=tempstr2;
document.getElementById(joinDiv+"_4").innerHTML=tempstr3;
}
}
function CreateLiveBtn(){
//live页面根据通道号生成通道
if ($(".mclcontainer").attr("name") != "isDown"){return;}
var liveHtml="";
for(var i=1;i<=gDvr.nChannel;i++){
liveHtml+='\
'+gDvr.chname[i-1]+'
\
\
\
\
';
}
$("#liveleft").html(liveHtml);
//回放页面根据通道生成通道号
var playHtml="";
if(gDvr.nChannel===32){
// $("#playBackChannal").css("height","385px");
$("#rss").css("margin-top","5px");
for(var i=1;(i<=gDvr.nChannel) && (i<=16);i++){
playHtml+=(" \
"+
"
" +gDvr.chname[i-1]+"
"+
"
");
}
$("#playBack_td1").prop("innerHTML", playHtml);
playHtml="";
for(var i=17;(i<=gDvr.nChannel) && (i<=32);i++){
playHtml+=(" \
"+
"
" +gDvr.chname[i-1]+"
"+
"
");
}
$("#playBack_td2").prop("innerHTML", playHtml);
}else if(gDvr.nChannel===24 || gDvr.nChannel===25){
// $("#playBackChannal").css("height","290px");
$("#rss").css("margin-top","5px");
for(var i=1;(i<=gDvr.nChannel) && (i<=12);i++){
playHtml+=(" \
"+
"
" +gDvr.chname[i-1]+"
"+
"
");
}
$("#playBack_td1").prop("innerHTML", playHtml);
playHtml="";
for(var i=13;i<=gDvr.nChannel;i++){
playHtml+=(" \
"+
"
" +gDvr.chname[i-1]+"
"+
"
");
}
$("#playBack_td2").prop("innerHTML", playHtml);
}else if(gDvr.nChannel===20){
// $("#playBackChannal").css("height","290px");
$("#rss").css("margin-top","5px");
for(var i=1;(i<=gDvr.nChannel) && (i<=8);i++){
playHtml+=(" \
"+
"
" +gDvr.chname[i-1]+"
"+
"
");
}
$("#playBack_td1").prop("innerHTML", playHtml);
playHtml="";
for(var i=9;i<=gDvr.nChannel;i++){
playHtml+=(" \
"+
"
" +gDvr.chname[i-1]+"
"+
"
");
}
$("#playBack_td2").prop("innerHTML", playHtml);
}else if(gDvr.nChannel===10 || gDvr.nChannel===12){
// $("#playBackChannal").css("height","230px");
$("#rss").css("margin-top","5px");
for(var i=1;(i<=gDvr.nChannel) && (i<=4);i++){
playHtml+=(" \
"+
"
" +gDvr.chname[i-1]+"
"+
"
");
}
$("#playBack_td1").prop("innerHTML", playHtml);
playHtml="";
for(var i=5;i<=gDvr.nChannel;i++){
playHtml+=(" \
"+
"
" +gDvr.chname[i-1]+"
"+
"
");
}
$("#playBack_td2").prop("innerHTML", playHtml);
}else{
for(var i=1;(i<=gDvr.nChannel) && (i<=8);i++){
playHtml+=(" \
"+
"
" +gDvr.chname[i-1]+"
"+
"
");
}
$("#playBack_td1").prop("innerHTML", playHtml);
playHtml="";
for(var i=9;(i<=gDvr.nChannel) && (i<=16);i++){
playHtml+=(" \
"+
"
" +gDvr.chname[i-1]+"
"+
"
");
}
$("#playBack_td2").prop("innerHTML", playHtml);
}
UI.Button("div[id^='liveChn_Play_']", 31, null, function(e, p){ //live页面左边栏按钮注册
var $p = $(p);
var str = $p.attr("id");
var cmd = (str.split("_")[2]*1-1);
if (e.type == "mousedown"){
if ($p.attr("name") == "disable" ){
return false;
}else if($p.attr("name") != "active" ){
gDvr.PlayVideo(cmd, gVar.nStreamType);
getOSDName(cmd);
channelPlay[cmd] = 1;
if(cmd == curSelChn){
showPTZ(cmd);
}
$p.css("background-position", "-31px 0px").attr("name","active");
$(".liveBtnBt2").css("background-position", "0px -31px");
}
else{
gDvr.StopVideo(cmd);
channelPlay[cmd] = 0;
if(cmd == curSelChn){
hidePTZ(cmd);
}
$p.css("background-position", "0px 0px").attr("name","");
//点击left页面的play图标,关掉任何一个视频,Zoom图标都切到off状态
if($(".liveBtnBt11").attr("name") == "active"){
$(".liveBtnBt11").css("background-position", "-32px 0px").attr("name", "");
}
}
return false;
}else if(e.type == "mouseover"){
if($p.attr("name")=="disable")
return false;
}
else if(e.type == "mouseout"){
if($p.attr("name")=="disable")
return false;}
else if(e.type == "mouseup"){
if($p.attr("name")=="disable")
return false;
}
if($p.attr("name") != "active"){
return true;
}
return false;
});
UI.Button("div[id^='liveChn_Rec_']", 31, null, function(e, p){ //Rec页面左边栏按钮注册
var $p = $(p);
var str = $p.attr("id");
var cmd = (str.split("_")[2]*1-1);
if (e.type == "mousedown"){
if($p.attr('name') == "disable"){
return false;
} else {
if(channelPlay[cmd] == 1 && channelRec[cmd] != 1){
var nRet = gDvr.StartRecord(cmd);
$p.css("background-position", "-31px -25px");
channelRec[cmd] = 1;
if(nRet != 0){
ShowPaop(lg.get("IDS_RECORD_SAVE_PATH"),lg.get("IDS_REC_ERR"));
}
}else if(channelRec[cmd] == 1){
gDvr.StopRecord(cmd);
channelRec[cmd] = 0;
$p.css("background-position", "0px -25px");
var str = gDvr.GetLocalSettings();
var xmlDoc = parseXmlFromStr(str);
var strTemp = xmlDoc.getElementsByTagName("LocalSettings")[0].getAttribute("SelectDiskDriver");
ShowPaop(lg.get("IDS_RECORD_SAVE_PATH"), "" + strTemp + ":\\webclient2\\videos" + "
");
}
}
}
});
UI.Button("div[id^='liveChn_Cap_']", 31, null, function(e, p){ //CAP页面左边栏按钮注册
var $p = $(p);
var cmd = ($p.attr("id").split("_")[2]*1-1);
if (e.type == "mousedown") {
if ($p.attr('name') == "disable") {
return false;
} else if (channelPlay[cmd] == 1) {
gDvr.CaptureImage(cmd);
var str = gDvr.GetLocalSettings();
var xmlDoc = parseXmlFromStr(str);
var strTemp = xmlDoc.getElementsByTagName("LocalSettings")[0].getAttribute("SelectDiskDriver");
ShowPaop(lg.get("IDS_IMAGE_SAVE_PATH"), "" + strTemp + ":\\webclient2\\images" + "
" + lg.get("IDS_PREVIEW") + " " + lg.get("IDS_PATH") + "");
}
}
return true;
});
$(".liveChannelRow").mouseover(function(){$(this).css("background", "#0f2c47");}).mouseout(function(){$(this).css("background", "url(images/content_bg.png)");});
}
//过滤方向键
function keyboardFilter(e){
e = e || window.event;
if(!e.srcElement)
e.srcElement = e.target;
if ((e.keyCode >= 37 && e.keyCode <= 40) /*|| (e.keyCode == 8)*/ || (e.keyCode == 9)){//取消 退格键 过滤
return false;
}
return true;
}
//对端口进行限制
function NumberRangeLimt(ctrId,minVal,maxVal){
var str = ($("#"+ctrId.id).val()).replace(/\D/g,'');
if(minVal != maxVal)
{
if(str != "" && str < minVal) {return minVal;}
if(str > maxVal) {return maxVal;}
}
return str;
}
function Reset(){
$("#username").val("");
$("#passwd").val("");
$("#login_language").val(gVar.lg);
// $("#login_language").change();
$("#username").focus();
}
function AutoClose(title)
{
autoCloseTime--;
if(autoCloseTime <= 0)
{
if($.browser.msie){
window.opener=null;
window.open('', '_self', '');
window.close();
}else{
window.location.reload(true);
}
}
if($.browser.msie){
ShowPaop(title, lg.get("IDS_DVR_REBOOT")+" "+autoCloseTime.toString()+" "+lg.get("IDS_SECOND"));
}else{
ShowPaop(title, lg.get("IDS_DVR_REBOOT")+" "+autoCloseTime.toString()+" "+lg.get("IDS_SECOND"));
}
window.setTimeout(function(){AutoClose(title);}, 1000);
}
function CreateCalendar(iType) {
var szLanguage = '';
if ($.cookie("language") == 'CHS') {
szLanguage = 'zh-cn';
} else if ($.cookie("language") == 'CHT'){
szLanguage = 'zh-tw';
} else {
szLanguage = 'en';
}
if (iType == 0) {
WdatePicker({startDate:'%y-%M-%d %h:%m:%s', dateFmt:'yyyy-MM-dd HH:mm:ss', alwaysUseStartDate:false, minDate:'1970-01-01 00:00:00', maxDate:'2037-12-31 23:59:59', readOnly:true, lang:szLanguage, isShowClear:false});
} else if (2 == iType) {
WdatePicker({dateFmt:'HH:mm:ss', alwaysUseStartDate:false, readOnly:true, lang:szLanguage, isShowClear:false});
} else {
WdatePicker({startDate:'%y-%M-%d %h:%m:%s', dateFmt:'yyyy-MM-ddTHH:mm:ss', alwaysUseStartDate:false, minDate:'1970-01-01 00:00:00', maxDate:'2037-12-31 23:59:59', readOnly:true, lang:szLanguage, isShowClear:false});
}
}
/*************************************************
Function: Base64
Description: Base64编码解码
Input: 无
Output: 无
return: 无
*************************************************/
var Base64 = {
// private property
_keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
// public method for encoding
encode: function(input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
input = Base64._utf8_encode(input);
while(i < input.length) {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if(isNaN(chr2)) {
enc3 = enc4 = 64;
} else if(isNaN(chr3)) {
enc4 = 64;
}
output = output + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
}
return output;
},
// public method for decoding
decode: function(input) {
var output = "";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while(i < input.length) {
enc1 = this._keyStr.indexOf(input.charAt(i++));
enc2 = this._keyStr.indexOf(input.charAt(i++));
enc3 = this._keyStr.indexOf(input.charAt(i++));
enc4 = this._keyStr.indexOf(input.charAt(i++));
chr1 = (enc1 << 2) | (enc2 >> 4);
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
chr3 = ((enc3 & 3) << 6) | enc4;
output = output + String.fromCharCode(chr1);
if(enc3 != 64) {
output = output + String.fromCharCode(chr2);
}
if(enc4 != 64) {
output = output + String.fromCharCode(chr3);
}
}
output = Base64._utf8_decode(output);
return output;
},
// private method for UTF-8 encoding
_utf8_encode: function(string) {
string = string.replace(/\r\n/g, "\n");
var utftext = "";
for(var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
if(c < 128) {
utftext += String.fromCharCode(c);
} else if((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
} else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}
return utftext;
},
// private method for UTF-8 decoding
_utf8_decode: function(utftext) {
var string = "";
var i = 0;
var c = c1 = c2 = 0;
while(i < utftext.length) {
c = utftext.charCodeAt(i);
if(c < 128) {
string += String.fromCharCode(c);
i++;
} else if((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i + 1);
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i += 2;
} else {
c2 = utftext.charCodeAt(i + 1);
c3 = utftext.charCodeAt(i + 2);
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}
}
return string;
}
};