var request=null; var response="undefined"; var devCfg="undefined"; var sensorCfg="undefined"; var error="Error"; var g_szCompressType="mpeg4"; var g_szRotate="None"; var requestTimeout=30000; var updateJPG=1; function CreateRequest() { request=null; try{ request=new XMLHttpRequest(); } catch(trymicrosoft){ try{ request=new ActiveXObject("Msxml2.XMLHTTP"); } catch(othermicrosoft){ try{ request=new ActiveXObject("Microsoft.XMLHTTP"); } catch(failed){ request=false; } } } if(!request) alert(loadLangString("L_Err_Initial_XMLHttpRequest",false)); return request; } function updatePage() { if(request.readyState==4){ if(request.status==200){ response=request.responseText alert(response); //response=request.responseText.split("\n"); //alert(request.responseText); //alert(response[0]); } else if(request.status==404) alert(loadLangString("L_Request_URL_Not_Exist",false)); else alert(loadLangString("L_Err_Status_Code_Is",false)+request.status); } } function requestAbort() { alert(loadLangString("L_ServerNoResponse",false)); request.abort(); } function requestAbortSPA() { request.abort(); } function HttpRequest(method,cgistr,cb,async,timeout) { var tempstring=eval("'"+cgistr+"'"); var timer; //alert(method+' '+tempstring); request=CreateRequest(); if(request===null){ //Sorry,no Ajax alert(loadLangString("L_Ajax_Not_Available",false)); return null; } request.open(method,tempstring,async);//synchronous //request.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); if(timeout>0){//alert(timeout); if(tempstring=="http://192.168.1.219/cgi-bin/hello" || tempstring.indexOf("firmwareupgrade") > 0){ timer=setTimeout("requestAbortSPA()",timeout); } else{ timer=setTimeout("requestAbort()",timeout); } } if(async){ request.onreadystatechange=function(){ if(request.readyState==4){ if(timeout>0) clearTimeout(timer); if(request.status==200){ response=request.responseText //alert(response); //devCfg=response; if(cb) cb(request.responseText); //response=request.responseText.split("\n"); //alert(request.responseText); //alert(response[0]); } else if(request.status==404) alert(loadLangString("L_Request_URL_Not_Exist",false)); else if(request.status==0){/*alert("Request abort");*/ } else{/*alert("Error: status code is "+request.status);*/ } } } } if(method=="POST"){ //request.setRequestHeader("Content-Type","multipart/form-data"); request.send(cgistr); } else{ if(tempstring!="http://192.168.1.219/cgi-bin/hello"){ request.setRequestHeader("If-Modified-Since","Sat, 1 Jan 2000 00:00:00 GMT"); } //for logout use if(tempstring=="/cgi-bin/admin/param?action=list&group=General.Time.SyncType"){ request.setRequestHeader("Authorization","Basic Og=="); tempstring="none"; } try{ request.send(null); if(tempstring=="none"){ return; } } catch(e){ return ; } } if(async) return null; if(request.status!=200){ if(timeout>0){ //alert("clear timeout error"); clearTimeout(timer); } return error; } else{ if(timeout>0){ //alert("clear timeout"); clearTimeout(timer); } return request.responseText; } } function SendCGICMD() { /*if(arguments[0]!=null){ setLastCGICMD(arguments[0]); }*/ return HttpRequest("GET",arguments[0],arguments[1]?arguments[1]:null,arguments[2]?arguments[2]:false,arguments[3]?arguments[3]:requestTimeout); } /* *GetDeviceInfo(catalog,level,cb) *catalog(must): cgi command *level(optional): admin/operator/view *cb(optional): call back function */ function GetDeviceInfo() { var level="admin"; if(arguments[1]) level=arguments[1]; var cgi=eval("'/cgi-bin/"+level+"/param?action=list&group="+arguments[0]+"'"); devCfg=HttpRequest("GET",cgi,null,false,requestTimeout); if(arguments[2]) arguments[2](); } function GetSensorInfo() { var level="admin"; if(arguments[1]) level=arguments[1]; var cgi=eval("'/cgi-bin/"+level+"/param_option?ImageSource="+arguments[0]+"'"); sensorCfg=HttpRequest("GET",cgi,null,false,requestTimeout); if(arguments[2]) arguments[2](); } function GetSensorVariable(variable) { //alert(devCfg); //alert(variable); if(sensorCfg==undefined){ vars=""; return vars } var vars=sensorCfg.split(variable+"="); if(vars[1]==undefined){ //alert("Error: Undefined!"); vars=""; return vars } var pair=vars[1].split("\n"); //alert(pair[0]); return pair[0]; } function GetQueryVariable(variable) { //alert(devCfg); //alert(variable); if(devCfg==undefined){ vars=""; return vars } var vars=devCfg.split(variable+"="); if(vars[1]==undefined){ //alert("Error: Undefined!"); vars=""; return vars } var pair=vars[1].split("\n"); //alert(pair[0]); return pair[0]; } function GetQueryVariableEx2(variable,cfg) { //alert(devCfg); //alert(variable); if(cfg==undefined){ vars=""; return vars } var vars=cfg.split(variable+"="); if(vars[1]==undefined){ //alert("Error: Undefined!"); vars=""; return vars } var pair=vars[1].split("\n"); //alert(pair[0]); return pair[0]; } function doCheckEmpty(strTxt) { if(get_Length(strTxt)<=0) return false; if(chk_Empty(strTxt)) return false; return true; } function pausecomp(millis) { var date=new Date(); var curDate=null; do{ curDate=new Date(); }while(curDate-date= 0){ vars=progress[1].split("%"); return (vars[0]); }else{ return (progress[1]); } }else{ return "Unknown"; } } //Qmik added start, Scott Chang, 2007/4/10 function replaceEscapes(strTxt) { return(escape(strTxt)); } function saveData(strPath,strData) { if(strData=="") strData="None"; var cgi=eval("'/cgi-bin/operator/filewrite?SAVE.filePath="+strPath+"'"); cgi+=eval("'&SAVE.fileData="+strData+"'"); SendCGICMD(cgi); } function readData(strPath) { var cgi=eval("'/cgi-bin/operator/fileread?READ.filePath="+strPath+"'"); var data=HttpRequest("GET",cgi,null,false,requestTimeout); if(data=="None") data=""; return (data); } //Qmik added end, Scott Chang, 2007/4/10 : start, Scott Chang, 2007/4/20 function Clear_Seq(strType,strValue) { var cgi=eval("'/cgi-bin/operator/seqclear?Clear."+strType+"="+strValue+"'"); UpdateParam(cgi); } function getCookies(name) { var arr=document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)")); if(arr!=null) return unescape(arr[2]); return null; } function delCookies(name) { var exp=new Date(); exp.setTime(exp.getTime()-1); var cval=getCookie(name); if(cval!=null) document.cookie=name+"="+cval+";expires="+exp.toGMTString(); } function getVideoFmt() { fmt=getCookies("VideoIdx"); if(fmt==null){ setCookies("VideoIdx","0"); return "0"; } if(fmt!="0" && fmt!="1" && fmt!="2" && fmt!="3"){ setCookies("VideoIdx","0"); return "0"; } if(GetQueryVariable("Image.VideoOut.Enabled")=="on" && GetQueryVariable("Image.VideoOut.Index")==fmt && ProfileImageSource != "ov9715"){ if(fmt=="0") fmt="1"; else if(fmt=="1" || fmt=="2") fmt="0"; setCookies("VideoIdx",fmt); } return fmt; } function setVideoFmt(fmt) { if(fmt!="0" && fmt!="1" && fmt!="2" && fmt!="3") return; setCookies("VideoIdx",fmt); g_szCompressType=fmt; } function getProfileFmt() { fmt=getCookies("ProfileIdx"); if(fmt==null){ setCookies("ProfileIdx","0"); return "0"; } return fmt; } function setProfileFmt(stream) { if(parseInt(stream,10)<0){ return; } setCookies("ProfileIdx",stream); } function getDisplayFmt() { fmt=getCookies("DisplayIdx"); if(fmt==null){ setCookies("DisplayIdx","1"); return "1"; } return fmt; } function setDisplayFmt(format) { if(parseInt(format,10)<0){ return; } setCookies("DisplayIdx",format); } function getImageRotate() { rotate=getCookies(g_szRotate); if(rotate==null){ setCookies(g_szRotate,"None"); return "None"; } if(rotate!="None" && rotate!="Mirror" && rotate!="Flip" && rotate!="MirrorFlip"){ setCookies(g_szRotate,"None"); return "None"; } return rotate; } function setImageRotate(rotate) { if(rotate!="None" && rotate!="Mirror" && rotate!="Flip" && rotate!="MirrorFlip") return; setCookies(g_szRotate,rotate); g_szRotate=rotate; } function setProtocol(protocol) { setCookies("ProtocolType",protocol); g_szProtocolType=protocol; } function getProtocol() { var protocol=getCookies("ProtocolType"); if(protocol!="1" && protocol!="2" && protocol!="3" && protocol!="4"){ protocol="3";//set as HTTP } return protocol; } function setBufferEn(En) { setCookies("Buffering",En); Buffer_Enable=En; } function getBufferEn() { var buff=getCookies("Buffering"); if(buff==null) buff="0";//set as disable return buff; } function setViewSize(size) { setCookies("ViewSize",size); VIEW_SIZE=size; } function getViewSize() { var size=getCookies("ViewSize"); if(size==null) size="fit";//set as 1X return size; } var CGICMD=""; function setLastCGICMD(str) { CGICMD+=(str+"\n \n"); if(CGICMD.length>1000){ return; } setCookies("LastCGICMD",CGICMD); } function getLastCGICMD() { var cgi=getCookies("LastCGICMD"); if(cgi!=null){ return cgi; } else{ return "empty"; } } function ExtractString(str,start,end) { var re1,re2; re1=str.split(start); if(re1[1]==undefined) return re1; re2=re1[1].split(end); return re2[0]; } function ReplaceAll(strSource,strFind,strRepl) { var str5=new String(strSource); while(str5.indexOf(strFind)!=-1){ str5=str5.replace(strFind,strRepl); } return str5; } var portCfg=""; function checkPortAssignment(type,curPort) { var i=0; var vport; var pArray=new Array( "General.System.HTTPPort", "Syslog.ServerPort", "General.Network.RTSP.Port", /*"General.Network.UPnP.NATTraversal.HTTPPort", "General.Network.UPnP.NATTraversal.HTTPSPort", "General.Network.UPnP.NATTraversal.RTSPPort",*/ "General.Network.RTP.R0.AudioPort", "General.Network.RTP.R1.AudioPort", "General.Network.RTP.R2.AudioPort", "General.Network.RTP.R3.AudioPort", "General.Network.RTP.R4.AudioPort", "General.Network.RTP.R5.AudioPort", "General.Network.RTP.R6.AudioPort", "General.Network.RTP.R7.AudioPort", "General.Network.RTP.R8.AudioPort", "General.Network.RTP.R9.AudioPort", "General.Network.RTP.R0.VideoPort", "General.Network.RTP.R1.VideoPort", "General.Network.RTP.R2.VideoPort", "General.Network.RTP.R3.VideoPort", "General.Network.RTP.R4.VideoPort", "General.Network.RTP.R5.VideoPort", "General.Network.RTP.R6.VideoPort", "General.Network.RTP.R7.VideoPort", "General.Network.RTP.R8.VideoPort", "General.Network.RTP.R9.VideoPort"); var langAry=new Array( "Please check HTTP Port", "Please check System Log Port", "Please check RTSP Port", /*"Please check HTTP Port", "Please check HTTPS Port", "Please check RTSP Port",*/ "Please check Profile 1 RTSP Multicast Audio Port", "Please check Profile 2 RTSP Multicast Audio Port", "Please check Profile 3 RTSP Multicast Audio Port", "Please check Profile 4 RTSP Multicast Audio Port", "Please check Profile 5 RTSP Multicast Audio Port", "Please check Profile 6 RTSP Multicast Audio Port", "Please check Profile 7 RTSP Multicast Audio Port", "Please check Profile 8 RTSP Multicast Audio Port", "Please check Profile 9 RTSP Multicast Audio Port", "Please check Profile 10 RTSP Multicast Audio Port", "Please check Profile 1 RTSP Multicast video Port", "Please check Profile 2 RTSP Multicast video Port", "Please check Profile 3 RTSP Multicast video Port", "Please check Profile 4 RTSP Multicast video Port", "Please check Profile 5 RTSP Multicast video Port", "Please check Profile 6 RTSP Multicast video Port", "Please check Profile 7 RTSP Multicast video Port", "Please check Profile 8 RTSP Multicast video Port", "Please check Profile 9 RTSP Multicast video Port", "Please check Profile 10 RTSP Multicast video Port"); if(portCfg==""){ portCfg=SendCGICMD("/cgi-bin/operator/param?action=list&group=General.Network.RTSP&group=General.Network.RTP&group=General.Network.UPnP&group=General.System&group=Syslog.ServerPort") } for(i=0;i0 && pArray[i].indexOf("AudioPort")>0){ continue; } if(type.indexOf("VideoPort")>0 && pArray[i].indexOf("VideoPort")>0){ continue; } if(type!=pArray[i]){ vport=GetQueryVariableEx2(pArray[i],portCfg); if(vport==curPort){ alert(langAry[i]); return false; } if(pArray[i].indexOf("VideoPort")>0 || pArray[i].indexOf("AudioPort")>0){ if(parseInt(vport)+1==curPort){ alert(langAry[i]); return false; } } } } return "OK"; } var addressCfg=""; function checkMCAddressAssignment(type,curIP) { if(addressCfg=="") addressCfg=SendCGICMD("/cgi-bin/operator/param?action=list&group=General.Network.RTP.R0.IPAddress&group=General.Network.RTP.R1.IPAddress"); if(type!="General.Network.RTP.R0.IPAddress") if(GetQueryVariableEx2("General.Network.RTP.R0.IPAddress",addressCfg)==curIP) return loadLangString("L_ComputerView",false)+" - "+loadLangString("L_MulticastStreaming",false)+" - "+loadLangString("L_MulticastAddress",false); if(type!="General.Network.RTP.R1.IPAddress") if(GetQueryVariableEx2("General.Network.RTP.R1.IPAddress", addressCfg)==curIP) return loadLangString("L_MobileView",false)+" - "+loadLangString("L_MulticastStreaming",false)+" - "+loadLangString("L_MulticastAddress",false); return "OK"; } function StyleCustomize(curframe) { var style=SendCGICMD("/cgi-bin/view/param?action=list&group=Layout"); var BGColorEnabled; var BGColor; var TextColorEnabled; var TextColor; if(curframe=="menu"){ BGColorEnabled=GetQueryVariableEx2('Layout.OwnMenuBGColorEnabled',style); BGColor=GetQueryVariableEx2('Layout.OwnMenuBGColor',style); TextColorEnabled=GetQueryVariableEx2('Layout.OwnMenuTextColorEnabled',style); TextColor=GetQueryVariableEx2('Layout.OwnMenuTextColor',style); } /*else if(curframe=="banner"){ BGColorEnabled=GetQueryVariableEx2('Layout.Banner.OwnBGColorEnabled',style); BGColor=GetQueryVariableEx2('Layout.Banner.OwnBGColor',style); TextColorEnabled=GetQueryVariableEx2('Layout.OwnTextColorEnabled',style); TextColor=GetQueryVariableEx2('Layout.OwnTextColor',style); }*/ else{ BGColorEnabled=GetQueryVariableEx2('Layout.OwnBGColorEnabled',style); BGColor=GetQueryVariableEx2('Layout.OwnBGColor',style); TextColorEnabled=GetQueryVariableEx2('Layout.OwnTextColorEnabled',style); TextColor=GetQueryVariableEx2('Layout.OwnTextColor',style); } var BGPictureAddr=GetQueryVariableEx2('Layout.BGPicture.Address',style); var BGPicturePath=GetQueryVariableEx2('Layout.BGPicture.Path',style); var BGPictureSource=GetQueryVariableEx2('Layout.BGPicture.Source',style); if(BGColorEnabled=="yes") document.body.style.backgroundColor=BGColor; if(TextColorEnabled=="yes") document.body.style.color=TextColor; var url; if(BGPictureSource=="own"){ url=eval('"url(style/user/image/'+BGPicturePath+')"'); if(BGPicturePath!="none") document.body.style.backgroundImage=url; } else if(BGPictureSource=="external"){ url=eval('"url('+BGPictureAddr+')"'); document.body.style.backgroundImage=url; } } function UpdateParam() { if(arguments[0]!=null){setLastCGICMD(arguments[0]);} var re=HttpRequest("GET",arguments[0],null,false,requestTimeout); if((re.search(/OK/g)>=0)||arguments[1]==false){ alert(loadLangString("L_ApplySuccess",false)); return true; } else{ alert(re); return false; } } function IframeResize() { if(parent.document.getElementById("setPage")!=undefined){ if(document.body.offsetHeight<460){ parent.document.getElementById("setPage").height=460; } else{ parent.document.getElementById("setPage").height=document.body.offsetHeight+8; } /*if(document.body.offsetHeight<550){ parent.document.getElementById("setPage").height=550; } else{ parent.document.getElementById("setPage").height=document.body.offsetHeight+100; }*/ } FixStyle(); } function FixStyle() { if(getOs().indexOf("IE")<0){ CSS_Change("radio","margin","8px 6px 0px 0px"); CSS_Change("checkbox","margin","8px 6px 0px 0px"); } } function CSS_Change(class1,tag,val) { var all=document.getElementsByTagName('*'); for(var i=0;i=length){ element=element.substr(0,length-4); element+='...'; } for(txtidx=element.length;txtidx0){ popW=popAry[i]; break; } } popW="help/help_"+popW; if(openHelpFlag==1){ if(openHelpWin){ if(openHelpWin.closed==false){ openHelpWin.close(); } } } openHelpFlag=1; openHelpWin=window.open(popW,"help",getWinFeature(550,700,1,1,0)); } function checkValidChar(str) { var reg=/[+=\s]/g; if(str!=""){ var val=reg.test(str); if(val){ alert(loadLangString("L_Warn_The_Character_Not_Allowed",false)+"\"+ , = , and space.\""); } return val; } else{ return false; } } function checkValidChar2(str)/*allow space*/ { var reg=/[+=]/g; if(str!=""){ var val=reg.test(str); if(val){ alert(loadLangString("L_Warn_The_Character_Not_Allowed",false)+"\"+ , =.\""); } return val; } else{ return false; } } function checkValidParam(str,param,error) { if(str!=""){ var val=param.test(str); if(val){ alert(loadLangString("L_Warn_The_Character_Not_Allowed",false)+error); } return val; } else{ return false; } } function checkValidPath(str) { var reg=/[+=\\\/\:\*\?\"\<\>\|\s\(\)\&\#\%]/g; if(str!=""){ var val=reg.test(str); if(val){ alert(loadLangString("L_Warn_The_Character_Not_Allowed",false)+" + , = , \\ , / , : , * , ? , \" , \< , \> , | , ( , ) , & , # , % and space."); } return val; } else{ return false; } } function checkValidPath1(str) { var reg=/[\\\/\:\*\?\"\<\>\|\s\(\)\%]/g; if(str!=""){ var val=reg.test(str); if(val){ alert(loadLangString("L_Warn_The_Character_Not_Allowed",false)+" \\ , / , : , * , ? , \" , \< , \> , | , ( , ) , % and space."); } return val; } else{ return false; } } function checkAllowedStr(str) { if(str.length==0) return true; var tmp=str.match(/[0-9a-zA-Z.]+/g); if(tmp==null){ alert(loadLangString("L_Warn_Only_Allow_Characters",false)+" 0-9 , a-z , A-Z , \".\""); return false; } if(tmp[0]==str){ } else{ alert(loadLangString("L_Warn_Only_Allow_Characters",false)+" 0-9 , a-z , A-Z , \".\""); return false; } return true; } function checkAllowedStr1(str)/*allow _ */ { if(str.length==0) return true; var tmp=str.match(/[0-9a-zA-Z._]+/g); if(tmp==null){ alert(loadLangString("L_Warn_Only_Allow_Characters",false)+" 0-9 , a-z , A-Z , \".\" , \"_\""); return false; } if(tmp[0]==str){ } else{ alert(loadLangString("L_Warn_Only_Allow_Characters",false)+" 0-9 , a-z , A-Z , \".\" , \"_\""); return false; } return true; } function checkAllowedMail(str) { if(str.length==0) return false; if(str.search(/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/)==-1){ alert(loadLangString("L_Warn_InputWrong",false)); return false; } str=str.substring(str.length-1,str.length); if(!isNaN(str)){ alert(loadLangString("L_Warn_InputWrong",false)); return false; } return true; } function getWinFeature(winWidth,winHeight) { var PosX=(screen.width-winWidth)/2; var PosY=(screen.height-winHeight)/2; var resize=arguments[2]==undefined?0:arguments[2]; var scrollbar=arguments[3]==undefined?0:arguments[3]; var status=arguments[4]==undefined?0:arguments[4]; var feature=eval("'width="+winWidth+"px,height="+winHeight+"px,top="+PosY+",left="+PosX+ ",resizable=1"+//for https recommand ",scrollbars="+scrollbar+ ",status="+status+"'"); return feature; } function getWinFeatureSPARK(winWidth,winHeight) { var PosX=0; var PosY=0; var resize=0; var scrollbar=arguments[3]==undefined?0:arguments[3]; var status=arguments[4]==undefined?0:arguments[4]; var feature=eval("'width="+winWidth+"px,height="+winHeight+"px,top="+PosY+",left="+PosX+ ",resizable=0"+//for https recommand ",scrollbars="+scrollbar+ ",status="+status+"'"); return feature; } function DetectMobile() { var mobile=(/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm|transform/i.test(navigator.userAgent.toLowerCase())); return mobile; } function GetNewEventMedia(re) { var media=""; re=re.replace("S",""); //Check new media add success. GetDeviceInfo("Event.Media.M"+re,"operator"); media=GetQueryVariable("Event.Media.M"+re+".Type"); return media; } function EventAddServer(cgi,ServerAct) { var addCgi=cgi,addRe=""; var removeCgi=""; var re=SendCGICMD(addCgi); if((re.search(/OK/g)>=0)){ if(ServerAct!="mod"){ re=re.split("OK")[1].replace(/\s/g,"");//get server/media index //If add media fail, remove this setting if(GetNewEventMedia(re)==""){ removeCgi="/cgi-bin/operator/param?action=remove&group=Event.Server.S"+re.replace("S","")+"&group=Event.Media.M"+re.replace("S",""); re=SendCGICMD(removeCgi); //Add again re=SendCGICMD(addCgi); if((re.search(/OK/g)>=0)){ re=re.split("OK")[1].replace(/\s/g,"");//get server/media index //If add media fail, remove this setting if(GetNewEventMedia(re)==""){ re=SendCGICMD(removeCgi); //Add again re=SendCGICMD(addCgi); addRe=re; if((re.search(/OK/g)>=0)){ re=re.split("OK")[1].replace(/\s/g,"");//get server/media index //If add media fail, remove this setting if(GetNewEventMedia(re)==""){ re=SendCGICMD(removeCgi); alert("Retry Fail: "+addRe+"addCgi"+addCgi+"---\nremoveCgi"+removeCgi); return false; } } } } } } return re; } else{ alert(loadLangString("L_Warn_InputWrong",false)); return false; } } //add for jquery span->onchange function spanToSelect(event,ui) { event.target.onchange(); } //var custMenu={change:spanToSelect,create:spanToSelect}; var custMenu={change:spanToSelect}; //end //add for jquery span->onclick function spanToClick(event,ui) { event.target.onclick(); } var custMenuClick={change:spanToClick}; //end //add for jquery radio image function custRadio(ev) { var tid=ev.currentTarget.id; if('no'==tid || (!tid)) return; tid='#'+tid; var custRadioOff={primary:"ui-icon-radio-za-ucheck"}; var custRadioOn={primary:"ui-icon-radio-za-check"}; //var custRadioOff={primary:"ui-icon-circle-check"}; //var custRadioOn ={primary:"ui-icon-circle-check"}; //Remove icons from all buttons $(tid+' input').button("option","icons",custRadioOff); //Add icon to the selected button $('input:checked',this).button("option","icons",custRadioOn).button("refresh"); } //end function logoutChrome() { var loc=window.location; var port=loc.port; var iframe=document.createElement('iframe'); iframe.style.display="none"; if(port){ port=':'+port; } else{ port=':80'; } iframe.src=loc.protocol+'//anonymous@'+loc.hostname+port; document.body.appendChild(iframe); } //for log out start function clearAuthenticationCache(page) { //Default to a non-existing page (give error 500). //An empty page is better, here. if(!page){ page='.force_logout'; } try{ if(getOs().indexOf("IE")>=0){ //IE clear HTTP Authentication document.execCommand("ClearAuthenticationCache"); } else{ var isChrome=!!window.chrome && !!window.chrome.webstore; var xmlHttp=false; if(window.XMLHttpRequest){ xmlHttp=new XMLHttpRequest(); } xmlHttp.open("GET","./",false,"user","user"); xmlHttp.send(null); xmlHttp.abort(); /*if(isChrome){//for chrome logoutChrome(); } else{ //Let's create an xmlhttp object var xmlhttp=createXMLObject(); //Let's prepare invalid credentials xmlhttp.open("GET",".force_logout_offer_login_mozilla",false,"user","user"); //xmlhttp.open("GET",'.force_logout',true,"logout","logout"); //Let's send the request to the server xmlhttp.send(""); //Let's abort the request xmlhttp.abort(); }*/ window.location.href="setting.htm"; } } catch(e){ alert("logout fail."); //There was an error return; } //reload page if(page=="indexpage"){ window.location.href="index.htm"; } else if(page=="setpage"){ window.location.href="setting.htm"; } else{ window.location.href="index.htm"; } //window.location.href="index.htm"; //window.location.assign("/cgi-bin/hello"); } function createXMLObject() { try{ if(window.XMLHttpRequest){ xmlhttp=new XMLHttpRequest(); } //code for IE else if(window.ActiveXObject){ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } } catch(e){ xmlhttp=false } return xmlhttp; } //for log out end updateScroller=function () { var bHorOk=false; var bVerOk=false; var ww=window.innerWidth; var wh=window.innerHeight; var screenw=screen.width; var screenh=screen.height; var modex=arguments[0]?arguments[0]:'hidden'; var modey=arguments[1]?arguments[1]:'hidden'; /*var heightlimit=arguments[2]?arguments[2]:900; var widthlimit=arguments[3]?arguments[3]:1440; if(wh>heightlimit || (screenw-40)widthlimit || (screenh-40)900) mode='auto'; else if(force) mode=force; else if(bHorOk && bVerOk) mode='hidden'; $('body').css('overflow',mode); document.title=('mode:'+mode+' ('+ww+','+wh+')'); }*/ pageApplyScroller=function () { if(! ''.endsWith){ String.prototype.endsWith=function(suffix){ return this.indexOf(suffix,this.length-suffix.length)!==-1; }; } initSize={w:0,h:0}; if(window.location.toString().endsWith('resize=helper')){ initSize.w=$('body').width(); initSize.h=$('body').height(); updateScroller(); $(window).resize(function(){updateScroller();}) } if(window.location.toString().endsWith('resize=hidden')){ updateScroller('hidden'); } } function OnSubmitMouseOut(val) { if(EID(val)){ EID(val).style.backgroundColor=""; } } function OnSaveBtnMouseDown() { if(EID("submitBtnbottom")){ EID("submitBtnbottom").style.backgroundColor="#cccccc"; } } function Sleep(delay) { var start=new Date().getTime(); while(new Date().getTime()