﻿// JavaScript Document
 /*

Data structure of Web.

[Description]
    Data structure of Web.

[History]
    #!0000,Mike,2006/06/13,New Release
*/


function AVNetwork(){
	this.ConnectionType = 0;
    this.ipaddr = "";
    this.gwaddr = "";
    this.netmask = "";
    this.m_Dns_server1 = "";
    this.m_Dns_server2 = "";
    this.mac = "";
    
    this.pppoe_name = "";
    this.pppoe_pwd = "";
    this.steam_port = 0;
    this.web_port = 0;
}

function AVDdns(){
    this.m_EN_DDns = 0;
    this.ddns_name = "";
    this.ddns_pwd = "";
    this.ddns_domain = "";
    this.systemNameOpt = 0;
}

function AVSntp(){
    this.m_NationID = 0;
    this.m_MOD = 0;
    this.m_Server = "";
}

function AVFtp(){
    this.m_Username = "";
    this.m_Password = "";
    this.m_Port = 0;
    this.m_Server = "";
    this.m_Directory = "";    
}

function AVSmtp(){
    this.m_Server = "";
    this.m_Sender = "";
    this.m_Receiver = "";
    this.m_Authentication = 0;
    this.m_Username = "";
    this.m_Password = "";    
}

function AVDvr(){
	this.chNumber = 16;
	this.title = "";
    this.Hue = "";
	this.Saturation = "";
    this.Contrast = "";
    this.Brightness = "";
    this.cov = "";
    this.record = "";
}

function AVDvrDevice(){
	this.chNumber = 16;
    this.device = "";
	this.id = "";
    this.protocol= "";
    this.rate = "";
}

function AVDvrDetection(){
	this.chNumber = 16;
    this.detect = "";
	this.ls = "";
	this.ss = "";
    this.ts= "";
    this.re = "";
    this.alarm = "";
    this.hiderowidx = 0;
}

function AVDvrBackup(){
	this.StartTime = "";
    this.EndTime = "";
	this.channel = 0;
	this.hddnumber = 0;
	//this.
}

function AVDvrSearch(){
	this.hddNumber = 0;
    this.listType = 0;
	this.maxList = 2048;
}

function AVDvrRecordList(){
	this.no = "";
	this.listType = 0; //0:all, 1:Menu, 2:System, 3:Alarm, 4:Motion
	this.event = "";
	this.channel = "";
	this.time = "";
	this.downLoadTime = "";
	this.downLoadChannel = 0;
	this.hddNumber = 0;
}
	
function AVAlarm(){
    this.enable = 0;
	this.chkEmail = 0;
    this.chkFtp = 0;
    this.picNumbers = 0;
    this.alarmDuration = 0;
}

function AVGeneral(){
    this.version = "";
	this.turbo = 0;
	this.language = 0; // 0:default, 1:English, 2:Chinese
	this.ServerTime = "";
    this.macaddr = "";
    this.maxlog = 0;
    this.title = "";
}

function AVGeneralLog(){
	this.no = "";
	this.listType = 0; //0:all, 1:Menu, 2:System, 3:Alarm, 4:Motion
	this.event = "";
	this.channel = "";
	this.time = "";
	this.result = "";
	this.maxList = 0;
	this.maxServerlog = 0;
}

function AVAccount(){
	this.accountNo = 0;
	this.username = "";
	this.password = "";
    this.userlevel = "";
	this.lifetime = "";
	this.phonenum1 = "";
	this.phonenum2 = "";
	this.phonenum3 = "";
	this.idcode = "";
	this.NotifySys = false;
}

function AVSequence(){
	this.sequence = 0;
	this.anchor_no = 0;
    this.preset_no = 0;
	this.dwell_time = 0;
	this.speed = 0;
}

function AVUserInfo(){
	this.onlineNo = 0;
	this.username = "";
	this.ipaddress = "";
    this.userlevel = "";
	this.resolution = "";
	this.quality = "";
	this.channel = "";
}
	
function AVSoloMpeg4(){
    this.vsystemOpt = 0;
	this.title = "";
    this.resolutionOpt = "";
    this.qualityOpt = "";
}

function AVDecoder(){
    this.Hue = "";
	this.Saturation = "";
    this.Contrast = "";
    this.Brightness = "";
}

function AVUser(){
    this.username = "" ;         // 
    this.password = "" ;       
    this.ConnectType = "" ;    
    this.MediaType = "MPEG4" ;    /* MPEG4, JPEG */
    this.StreamFormat = "" ;    /* MPEG4, MJPG */
    this.ulevel = "GUEST";
    this.VideoSystem = "";
    this.islogin = 0;
    this.SupportLG = "ENGLISH&"; /* Factory Support Language */
    this.language = 0; /* Language : 1:English, 2:Chineses, 3:Greek */
    this.sound = 0;    /* Sound: 0:turn off, 1:turn on */
    this.leftSrc = "";
    this.confSrc = ""; /* left config src */
    this.mainSrc = "";
    this.topSrc = "";
    this.dvrCh = 4; /* how many channel DVR have */
    this.soundCh = 0; /* how many channel DVR sound have */
    this.CruiseMode = "";
    this.ConnectMode = "TCP";  /* TCP:Internet, UDP:Local */
    this.TurboEn = 0;  /* 0:turbo disable, 1:turbo enable */
    this.AutomoveEn = 0;  /* 0:auto move disable, 1:auto move enable */
    this.ProductType = "";  /* DVR, IP CAMERA */
    this.ProductID = "";  /* Product-ID-Minor */
    this.isDvrPtz = false;  /* DVR support PTZ */
    this.IndepFlag = false;  /* DVR independent flag */
    this.isIndepCh = false;  /* DVR independent channel */
    this.DvrCurrCh = 0;  /* DVR current channel, 0: none, 1: channel 1 */
    this.player = "ActiveX";  /* ActiveX or QuickTime */
    this.OemPID = "Unknow Product ID";  /* Product-ID for OEM */
}

function AVPos(){
	this.SearchType = ""; /* Quick, Advanced */
	this.PosId      = 1;
	this.dvrChId    = 1;
	this.startTime  = "";
	this.endTime    = "";
    this.content    = ""; /* Quick */
    this.result     = "";
    this.totalCnt   = 0;
    this.perPageCnt = 30;
    this.ItemName    = ""; /* Advanced */
    this.ItemNameUn  = "";
    this.AmountStart = 0;
    this.AmountEnd   = 0;
    this.CountStart  = 0;
    this.CountEnd    = 0;
    this.MiscWords   = "";
    this.MiscWordsUn = "";
    this.EventId = "";     /* Event */
}

function AVData(){
    var qs = location.search ;
    var ut = 0 ;
    var i ;    
/*    
    if( qs.indexOf("first_admin",0)!=-1 ){
        // first admin
        ut = 1 ;
    }else if( qs.indexOf("other_admin",0)!=-1 ){
        // other admin
        ut = 2 ;
    }else if( qs.indexOf("guest",0)!=-1 ){
        // guest
        ut = 3 ;
    }else{
        top.navigate( "home.html" ) ;
    }
*/
	ut = 1 ; 	
	
    this.on_polling = 0 ; // ¬O¤£¬O¥¿¦bpolling
    this.btn_connect = 0;
    
    this.utype = ut ;           // 0:¥¼µn¤J,  1:super admin, 2:normal admin, 3:guest
    this.ln = qs.substring(qs.indexOf("=",0)+1,qs.length) ;      // ¥H¤°»ò¦W¦rµn¤Jªº
    this.get_flag = 0 ;         // global get data flag
    this.get_pending_flag = 0;  // global get data pending flag, ¬°¤F¨¾¤î­«ÂÐget³Q©¿²¤±¼    
    this.set_flag = 0 ;         // global set data flag
    this.set_qs = "" ;          // global set data query string
    this.polling_timer = 0 ;    // ¦s©ñpolling timer id
    this.auto_touch = 0;        // default is ON
    this.wp='';

    
    /* ¤W­±ªº°Ï¶ô³Ì¦n¤£­n°Ê¡A¤£µM´N­n«Ü¦³§â´¤¤~¥h°Ê */


    this.user = new AVUser();
    this.net = new AVNetwork();
    this.ddns = new AVDdns();
    this.sntp = new AVSntp();
    this.ftp = new AVFtp();
	this.smtp = new AVSmtp();
        
    this.dvr = new AVDvr();
    this.device = new AVDvrDevice();
    this.detection = new AVDvrDetection();
    this.recordlist = new AVDvrRecordList();
    this.backup = new AVDvrBackup();
    
    this.alarm = new AVAlarm();
    this.general = new AVGeneral();
    this.log = new AVGeneralLog();
    this.account = new AVAccount();
    this.sequence = new AVSequence();
    this.userinfo = new AVUserInfo();
    this.mpeg4 = new AVSoloMpeg4();
    this.decoder = new AVDecoder();
    this.pos = new AVPos();
    
    this.cur_seltype = "Home";
    this.refresh = 0 ; // »Ý¤£»Ý­n refresh ºô­¶
    
    var nt = new Date() ;
    this.uptime = nt.getTime() ;

}

top.dt = new AVData() ;

