if(swm_nas == null){ var swm_nas=false; /* fix �Lnas�\���,func.js �̨S�[�J���ѼƳy��UI���Ͽ��~	 */ }
if(swm_s_sslvpn == null) { var swm_s_sslvpn=false; /* fix �Lsslvpn�\���,func.js �̨S�[�J���ѼƳy��UI���Ͽ��~ */ }
var isIE = (function(){
var undef,
v = 3,
div = document.createElement('div'),
all = div.getElementsByTagName('i');
while (
div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->',
all[0]
);
return v > 4 ? v : undef;
}());
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i=0; i<ca.length; i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1);
if (c.indexOf(name) == 0) return c.substring(name.length,c.length);
}
return "";
}
function get_csrf_token(){
var csrf_cookie_name = "CSRFTOKEN";
return getCookie(csrf_cookie_name);
}
function GURL(x){location=x+'&csrftok='+get_csrf_token();}
function makesure(p,l){if (confirm(p)) GURL(l);}
function MGURL(x){parent.main.location=x+'&csrftok='+get_csrf_token();}
function Mmakesure(p,l){if (confirm(p)) MGURL(l);}
function dw(str){document.write(str+"\n")}
function TP()
{
f=document.forms[0];
if(f._IPmode.selectedIndex==0) var DynIP=true;//Dynamic IP
else var DynIP=false;
IPType(DynIP)
}
function IPType(c)
{
if(c)
{
document.forms[0].WI.value="0.0.0.0"
document.forms[0].WN.value="0.0.0.0"
document.forms[0].WG.value="0.0.0.0"
}
document.forms[0].WI.disabled=c
document.forms[0].WN.disabled=c
document.forms[0].WG.disabled=c
}
function clearField()
{
f=document.forms[0];
if(f._IPmode.selectedIndex==0)//Dynamic IP
{
f._1.name="WI"
f._2.name="WN"
f._3.name="WG"
}
}
function chkMTU(H)
{
f=document.forms[0]
if(arguments.length==0)return true
if((f.IM0.value<576)||(f.IM0.value>H))
{
alert("MTU is invalid! (576<=MTU<="+H+")");
return false;
}
else return true;
}
function SetCkBox(chkbox,ckv,nckv,chkid,hids,hide) //chkid=�����\�઺�`�}��(checkbox)
{
f=chkbox.form
for(cb=0;cb<f.length;cb++){if(f.elements[cb]==chkbox)break;}
if (!window.ActiveXObject)
{
f.elements[cb-1].style.display="none"
f.elements[cb-1].type="text"
}
f.elements[cb-1].value=(f.elements[cb].checked)?ckv:nckv
if(arguments.length==4){ //���`�}���������~�|do "prim_switch" function
prim_switch(chkid);
}else if(arguments.length==6){
switch_hidden(chkid,hids,hide);}
}
function SetSelHidval(selectobjs)
{
if(typeof(selectobjs)=="object") { f=selectobjs.form }
else { f=document.forms[0]; }
for(cb=0;cb<f.length;cb++){if(f.elements[cb]==selectobjs)break;}
if (!window.ActiveXObject)
{
f.elements[cb-1].style.display="none"
f.elements[cb-1].type="text"
}
f.elements[cb-1].value=(typeof(selectobjs)=="object")? selectobjs.value : selectobjs
}
var d2=new Array(
GetElmCont("sntp_0","Sunday")
,GetElmCont("sntp_0","Monday")
,GetElmCont("sntp_0","Tuesday")
,GetElmCont("sntp_0","Wednesday")
,GetElmCont("sntp_0","Thursday")
,GetElmCont("sntp_0","Friday")
,GetElmCont("sntp_0","Saturday")
)
var m2=new Array(
GetElmCont("sntp_0","January")
,GetElmCont("sntp_0","February")
,GetElmCont("sntp_0","March")
,GetElmCont("sntp_0","April")
,GetElmCont("sntp_0","May")
,GetElmCont("sntp_0","June")
,GetElmCont("sntp_0","July")
,GetElmCont("sntp_0","August")
,GetElmCont("sntp_0","September")
,GetElmCont("sntp_0","October")
,GetElmCont("sntp_0","November")
,GetElmCont("sntp_0","December")
)
function turnTime(c)
{
date=c.getDate()<10?"0"+c.getDate():c.getDate()
hour=c.getHours()<10?"0"+c.getHours():c.getHours()
min=c.getMinutes()<10?"0"+c.getMinutes():c.getMinutes()
sec=c.getSeconds()<10?"0"+c.getSeconds():c.getSeconds()
return d2[c.getDay()]+" "+m2[c.getMonth()]+" "+date+", "+c.getFullYear()+" "+hour+":"+min+":"+sec
}
function op(b,e,d)
{
var o=""
for(i=b;i<=e;i++)
{
o+="<OPTION value="+i+">"
if(i<10) o+="0"
o+=i
if(arguments.length==3)i=i+d-1
}
return o
}
function locate(fm,dest)
{
for(var j=0;j<fm.length;j++)
{
if(fm.elements[j].name==dest) break;
}
return j;
}
function seldaytime()
{
document.forms[0].daytime[1].checked=true;
}
function saveResult(sc)
{
if(document.getElementById('_sr_')==null) dw("<div id='_sr_'></div>")
idsr=document.getElementById('_sr_')
if(arguments.length>0) {
msg = (sc == "0") ? GetElmCont("wary_0","No change!") : GetElmCont("wary_0","Saved!");
if(idsr!=null)idsr.innerHTML="<font color=red>"+msg+"</font>";
}
else if(sc==null){
idsr.innerHTML ="";
}
swids('_sr_',(arguments.length>0));
}
function rebomsgs(scs)
{
if(arguments.length<=0)rmsg=""
else if(scs == 0) rmsg=GetElmCont("wary_0","No change!")
else rmsg=GetElmCont("wary_0","Saved! The change doesn't take effect until router is rebooted.")
SetElmCont("_sr_","<font color=red>"+rmsg+"</font>")
swid("_sr_",(arguments.length>0))
if(document.getElementById("_rebo_100")!=null)
document.getElementById("_rebo_100").style.display=((arguments.length>0)&&(scs != 0))?'inline':'none';
}
function hideAllDiv(aryss)
{
str_ary=aryss.toString()
arys=str_ary.split(",")
for(i=0;i<Math.floor(arys.length/2)*2;i++)
{
swDiv(arys[i],0)
}
}
function DisplayMenu(idd,fromAry)
{
ary=new Array();
ary=ary.concat((arguments.length>1)?fromAry:div_id);
hideAllDiv(ary)
hideAllDiv(div_ses)
if(ary[idd].indexOf(',')==-1)
{
dwt=ary[idd]
}
else
{
dis=ary[idd].split(',')
dwt=dis[0]
for(d1=1;d1<dis.length;d1++)
{
swDiv(dis[d1],1)
}
}
swDiv(dwt,1)
}
function swDiv(divID,divStyle)
{
for(p=0;p<arguments.length/2;p++)
{
if(arguments[p*2+1]==0)      dStyle='none';
else if(arguments[p*2+1]==1) dStyle='';
else dStyle=arguments[p*2+1]
ww=document.getElementById(arguments[p*2])
if(ww!=null)  ww.style.display = dStyle;
}
return divID+" -> "+dStyle
}
function xDiv(divID,divx)
{
for(p=0;p<arguments.length/2;p++)
{
ww=document.getElementById(arguments[p*2])
if(ww!=null)  ww.disabled = !(arguments[p*2+1])
}
}
function setck()
{
for(p=0;p<arguments.length/2;p++)
{
ww=document.getElementById(arguments[p*2])
if(ww!=null)  ww.checked = (arguments[p*2+1])
}
}
function createXHR()
{
var xhr = false;
if (window.XMLHttpRequest) {
xhr = new XMLHttpRequest();
if (xhr.overrideMimeType) {
xhr.overrideMimeType('text/xml');
}
} else if (window.ActiveXObject) {
try {
xhr = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xhr = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
return xhr;
}
function displaymsg(msg,div)
{
if(document.all) eval("document.all."+div+".innerHTML='"+msg+"'")
else if (document.getElementById) document.getElementById(div).innerHTML=msg
}
function tt(i)
{
return i<10 ? "0"+i : i
}
function hhmmss(t)
{
ss=tt(t%60); t=(t-ss)/60
mm=tt(t%60); t=(t-mm)/60
hh=tt(t)
return hh+":"+mm+":"+ss
}
function SetElmCont2(idx,cont)
{
ddiv=document.getElementById(idx)
if(ddiv!=null) ddiv.innerHTML=cont
}
function GetElmCont2(idx,dcont)
{
ddiv=document.getElementById(idx)
if(ddiv!=null) return ddiv.innerHTML
else return dcont
}
function icl(fn){includejs(fn)}
function iclifm(iffn)
{
var t=new Date();ztv='rc='+t.getTime()
aa=(arguments.length<2)?"":(searchpath+"&")
srcv=iffn+".htm?"+aa+ztv
dw("<iframe src='"+srcv+"' style='display:none' name='"+iffn+"' frameborder=0 scrolling=no></iframe>")
}
function clrsel(b)
{
cfrom=(arguments.length==1)?0:arguments[1]
bl=b.length
for(j=0;j<bl-cfrom;j++)
{
b.options[cfrom].value=""
b.options[cfrom]=null
}
}
function pushselopt(sel,stext,sval)
{
sopt=new Option(stext,sval)
sellen=sel.length
sel.options[sellen]=sopt
}
function findInArr3(findkey,arr)
{
if(arr.length==0)return false
for (x in arr)
{
if(arr[x] == findkey)return x
}
return false
}
function strcut(strs,maxlen,strtail)
{
return (strs.length<=maxlen)?strs:(strs.substr(0,maxlen)+strtail)
}
/***************** begin: function designed by Leaf ****************/
function setEnable(isCheck, hiddenID)
{
document.getElementById(hiddenID).value = ((isCheck.checked)? 1 : 0);
}
function getEnable(APEnable, Echeckbox)
{
var isEnable = document.getElementById(APEnable);
if(isEnable.value == "1"){
document.getElementById(Echeckbox).checked = true;
}
}
function disablebyDiv(div_id, isdisable)		//disable elements in Div
{
var target_id = document.getElementById(div_id);
disableElem(target_id, isdisable);
}
function disableElem(elem, disable)			//disable elements
{
var childs = elem.childNodes;
for(var i = 0; i < childs.length; i++){
if(childs[i].nodeType == 1){
childs[i].disabled = disable;
if(childs[i].childNodes){
disableElem(childs[i], disable);
}
}
}
}
/***************** end: function designed by Leaf ****************/
function sleep(ms)
{
var dt = new Date();
dt.setTime(dt.getTime() + ms);
while (new Date().getTime() < dt.getTime());
}
function init_prim_switch(chkid){
itm=eval("document.getElementById('"+chkid+"')")
if(!itm.checked) {prim_switch(chkid);}
}
function init_switch(chkid,hidss,hidee){
itm=eval("document.getElementById('"+chkid+"')")
if(!itm.checked) {switch_hidden(chkid,hidss,hidee);}
}
function prim_switch(chkidd){
f=document.forms[0]
itmm=eval("document.getElementById('"+chkidd+"')")
for(s=0;s<f.length;s++){if(f.elements[s].name=="switch_start")break;}
for(e=0;e<f.length;e++){if(f.elements[e].name=="switch_end")break;}
for(p=s;p<e;p++){
if(f.elements[p].type=="hidden"   //hidden�����}��,�קK�y��bug
||f.elements[p].id=="_wary_99" //save button
||f.elements[p].id=="_wary_100" //undo button
||f.elements[p].id=="_rebo_100" //reboot button
) continue;
if(itmm.checked){ //all items enable
f.elements[p].disabled=false;
}
else{            //all items disable
f.elements[p].disabled=true;
}
}
}
function vwan_switch(chkidd,chkenablee,objname){
f=document.forms[0]
start_name="switch_start";
end_name=objname+"_switch_end";
if(objname){
start_name=objname+"_switch_start";
end_name=objname+"_switch_end";
}
itmm=eval("document.getElementById('"+chkidd+"')")
for(s=0;s<f.length;s++){if(f.elements[s].name==start_name)break;}
for(e=0;e<f.length;e++){if(f.elements[e].name==end_name)break;}
for(p=s;p<e;p++){
if(f.elements[p].type=="hidden"   //hidden�����}��,�קK�y��bug
||f.elements[p].id=="_wary_99" //save button
||f.elements[p].id=="_wary_100" //undo button
||f.elements[p].id=="_rebo_100" //reboot button
) continue;
if(chkenablee){ //all items enable
f.elements[p].disabled=false;
}
else{            //all items disable
f.elements[p].disabled=true;
}
}
}
function switch_hidden(chkidd,hidstatt,hidendd){
f=document.forms[0]
itmm=eval("document.getElementById('"+chkidd+"')")
for(s=0;s<f.length;s++){if(f.elements[s].name==hidstatt)break; }
for(e=0;e<f.length;e++){if(f.elements[e].name==hidendd)break; }
for(p=s;p<e;p++){
if(f.elements[p].type=="hidden"   //hidden�����}��,�קK�y��bug
||f.elements[p].id=="_wary_99" //save button
||f.elements[p].id=="_wary_100" //undo button
||f.elements[p].id=="_rebo_100" //reboot button
) continue;
if(itmm.checked){ //all items enable
f.elements[p].disabled=false;
chgprimode(1)
}
else{            //all items disable
f.elements[p].disabled=true;
}
}
}
/*
���� prim_switch ���O �i�H�ۤv�]�w start �� end id �W��
chkidd => chekcbox id
hidstatt => disabled start index
hidendd => disabled end index
by kent
*/
function all_disabled(chkidd,hidstatt,hidendd)
{
f=document.forms[0]
itmm=eval("document.getElementById('"+chkidd+"')")
for(s=0;s<f.length;s++){if(f.elements[s].name==hidstatt)break;}
for(e=0;e<f.length;e++){if(f.elements[e].name==hidendd)break;}
for(p=s;p<e;p++){
if(f.elements[p].type=="hidden"   //hidden�����}��,�קK�y��bug
||f.elements[p].id=="_wary_99" //save button
||f.elements[p].id=="_wary_100" //undo button
||f.elements[p].id=="_rebo_100" //reboot button
||f.elements[p].id=="_wary_101" //refresh button
) continue;
if(itmm.checked){ //all items enable
f.elements[p].disabled=false;
}
else{            //all items disable
f.elements[p].disabled=true;
}
}
}
/*
get xml node value
xmlDoc => xml objec
xml_name => tag name
value_index => value index
node = null => return empty
node = object => return nodeValue
by kent
*/
function xml_getvalue(xmlDoc,xml_name,value_index)
{
var value = xmlDoc.getElementsByTagName(xml_name)[value_index];
value = value.childNodes[0];
return (value != null)?value.nodeValue:"";
}
function Interfc_info(val){//get �ثe router �Ҧ� wan , Lan and Vlan Info
/*
aryW : �ثe router �Ҧ� wan Operation Mode's status
aryW[Wan1,Wan2,Wan3,...]
aryW[?]=1:Failover ; aryW[?]=0:Always on ; aryW[?]=2:Disable
aryVL : �ثe router �Ҧ� LAN and VLan Enable's status
aryVL[LAN,VLAN1,VLAN2,VLAN3,...]
aryVL[0]=1:Lan Enabled.
aryVL[?]=1:VLan? Enabled.
val =0:return aryVL ; val =1:return aryW
*/
/*
C_WEBUI_WAN_TMP_OPMODE �^�Ǧr��N�� wan Operation Mode �� status('-'���j�C��Wan)
C_VLAN_GROUP_ACTIVE  �^�ǼƦr�N�� lan vlan1~3 ��_�Q�ϥ�
vlan_enable[0]~[2] �N�� vlan1~3 ��_�Q�ϥ�
C_VLAN_GROUP_ACTIVE  | lan | valn1 | valn2 | valn3|
15           |  1  |   1   |   1   |   1  |
14           |  1  |   1   |   1   |   0  |
13           |  1  |   1   |   0   |   1  |
12           |  1  |   1   |   0   |   0  |
11           |  1  |   0   |   1   |   1  |
����.........
*/
var wan_value = "";
var vlan_enable = [];
var vlan_active = parseInt("8");
var vlan_actice_arr = [];
var aryVL = [];
var aryW =[];
var str00= "N2"  //"del
vlan_enable[0] = 0;
vlan_enable[1] = 0;
vlan_actice_arr[0] = 8 & vlan_active;  //ck Lan
vlan_actice_arr[1] = 4 & vlan_active;  //ck VLan1
vlan_actice_arr[2] = 2 & vlan_active;  //ck VLan2
vlan_actice_arr[3] = 1 & vlan_active;  //ck VLan3
aryVL[0] = (vlan_actice_arr[0] != 0)?1:0   // �P�O lan �O�_��Q�ϥ�
for(c=0;c<(vlan_enable.length-1);c++){  // �P�O vlan 1~x �O�_��Q�ϥ�
aryVL[c+1] = (vlan_actice_arr[c+1] != 0)?"1":"0" ; // 20170104 ���� C_VLAN_SVR_ENABLE
/*alert("del dd"+(c+1)+"="+aryVL[c+1]
+" ,vlan_actice_arr[c+1]="+vlan_actice_arr[c+1]
+" ,vlan_enable[c]="+vlan_enable[c]
+" ,vlan_actice_arr[c+1]="+vlan_actice_arr[c+1]
)*/
}
wan_value = "0-2".split("-");
for(q=0;q<wan_value.length;q++){  // �P�O Wan 1~x �O�_��Q�ϥ�
aryW[q] = wan_value[q] ;
}
return (val==0)?aryVL:aryW
}
/*=================== wps.js =================================*/
var http_request,staret;
var mesg=new Array("&nbsp;","&nbsp;")
var elem=new Array()
function makeRequest(url,elem) {
http_request = false;
var t=new Date()
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request) {
alert('Giving up :( Cannot create an XMLHTTP instance');
return false;
}
http_request.open('GET', url+t.getTime(), true);
if(arguments.length > 1)
http_request.onreadystatechange = stateChangedXML;
else
http_request.onreadystatechange = stateChangedText;
http_request.send(null);
}
function stateChangedXML() {
if (http_request.readyState == 4) {
if (http_request.status == 200) {
var xmldoc = http_request.responseXML//.documentElement;
for(aj=0;aj<elem.length;aj++)
{
mesg[aj]=xmldoc.getElementsByTagName(elem[aj])[0].childNodes[0].nodeValue;
}
} else {
}
}
}
function stateChangedText() {
if (http_request.readyState == 4) {
if (http_request.status == 200) {
mesg = http_request.responseText;
} else {
}
}
}
function loadXMLDocs(dname)//loadXMLDocs can't be used anymore becaause of Synchronize.
{
if(dname.indexOf("?")!=-1 && dname.indexOf("csrftok=")==-1) {
dname +='&csrftok='+get_csrf_token(); // append CSRF token to avoid changing CSID without sending csrftok
}
try
{
if (window.ActiveXObject)
{
var errormsg = "Check Browser and security settings";
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;
xmlDoc.load(dname);
}
else if(window.XMLHttpRequest)
{
var errormsg = "Error handling XMLHttpRequest request";
var d = new XMLHttpRequest();
d.open("GET", dname, false);
d.send(null);
xmlDoc=d.responseXML.documentElement;
} else {
var errormsg = "Error.";
xmlDoc = document.implementation.createDocument("","",null);
xmlDoc.async=false;
xmlDoc.load(dname);
}
return xmlDoc;
}
catch(e)
{
return null;
}
}
function loadXMLDocsAsync(url, success_func, error_func, complete_func) {
var httpRequest = new XMLHttpRequest();
httpRequest.onreadystatechange = function() {
if(httpRequest.readyState == 4) { // request finished
if(httpRequest.status == 200) { // 200 OK response
success_func(httpRequest.responseXML); // pass the XMLDoc to success function
}
else { // There was a problem with the request, such as 404 (Not Found)
if(typeof(error_func)!="undefined") {
error_func(); // execute error function if exists
}
}
if(typeof(complete_func)!="undefined") {
complete_func(); // execute complete function if exists
}
}
};
httpRequest.open('GET', url, true);
httpRequest.send('');
}
function rlists(xmlurls,frs)
{
rlist(xmlurls,frs)
setTimeout("rlists('"+xmlurls+"','"+frs+"')",staret*1000)
}
function rlists2(xmlurls)
{
rlist(xmlurls)
setTimeout("rlists2('"+xmlurls+"');showdbm(1);telstra();swErrorMsg();",staret*1000)
}
function rlist(xmlurl,fr)
{
xmlDoc=null;
loadXMLDocsAsync(xmlurl,
function(fr){ // ajax success function START
return function(xml){
var xmlDoc=xml;
z=xmlDoc.getElementsByTagName("item")
if(z==null)return;
if(z.length <= 0)return;
var sw_topology=(typeof(swm_status_network) != "undefined")?swm_status_network:false;
for(j=0;j<z.length;j++)
{
zn=z[j].childNodes[0]
nv=(zn!=null)?zn.nodeValue:"&nbsp;"
ddiv=document.getElementById(z[j].getAttribute("name"))
if(ddiv!=null && ddiv.innerHTML!=nv){
ddiv.innerHTML=(nv=="")?"&nbsp;":nv //change value
}
}
if(fr=="status"){                 //from status.htm
reload_array(0,xmlDoc);   //rewrite Array local_conn and multi_conn
if(sw_topology) change_topology(); //base on local_conn and multi_conn`s value show topology
set_v4wan_value();
}
else if(fr=="sta_wireless"){      //from sta_wireless.htm
reload_array(1,xmlDoc);
if(sw_topology) change_topology();
chk_auth(); //for QR Code
chgLang();
}
else if(fr=="no_chglang") return; //�Ĥ@���i�Jstatus.htm��,�]��sta_refresh.xml���nrun chgLang(1),���Mstatus.htm�|����run chgLang(1)
else if(fr=="sta_vpn"){           //from sta_vpn.htm
submk2v4(); //for ipsec Local Subnets and Remote Subnets
try{sw_dynvpn_client();} catch(e){}
vpn_refresh(z.length);
}
else if(fr=="diagnostic"){
trans_diag();
}
/*
status�bxml reload�ɦ��@��string�i��Q���s���N, ex. "enable" "disable" "connect" "disconnect"
�o��string�|�ܦ��^��
����n����k�O���ӥu½Ķ���ܪ�string
���k�O�bxml�̪�span id�R�W�� "_1~xml" �� "_atbox_1~xml"
���|���Nstatus.htm�̪�span
�M��run chgLang(1)...�blang.js½Ķ�r���,�N�u½Ķid�����O~xml��string
*/
chgLang(1) //����½Ķonly
};
}(fr) // ajax success function END
);
}
function reload_array(f,xmlDoc){
if(f==0){ //status.htm only
for(a=0;a<ALL_INDEXV_sta.length-1;a++){
eval("ALL_INDEXV_sta[a]=xmlDoc.getElementsByTagName('wan_ind"+a+"')[0].childNodes[0].nodeValue")
}
for(a=0;a<ALL_mac_sta.length-1;a++){
if(xmlDoc.getElementsByTagName("mac_ind"+a)[0].childNodes[0]!=null)
eval("ALL_mac_sta[a]=xmlDoc.getElementsByTagName('mac_ind"+a+"')[0].childNodes[0].nodeValue")
}
}
if(xmlDoc.getElementsByTagName("locon_ind")[0].childNodes[0]!=null){
local_conn[0]=xmlDoc.getElementsByTagName("locon_ind")[0].childNodes[0].nodeValue
}
for(a=0;a<16;a++){
if(xmlDoc.getElementsByTagName("mucon_ind"+a)[0].childNodes[0]!=null)
eval("multi_conn[a]=xmlDoc.getElementsByTagName('mucon_ind"+a+"')[0].childNodes[0].nodeValue")
}
}
/*=================== wps.js =================================*/
var xmlhttp;
function loadXMLDoc_post(url,val)
{
xmlhttp=null;
if (window.XMLHttpRequest)
{// code for all new browsers
xmlhttp=new XMLHttpRequest();
}
else if (window.ActiveXObject)
{// code for IE5 and IE6
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
if (xmlhttp!=null)
{
xmlhttp.open("POST",url,true);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send(val+'&csrftok='+get_csrf_token());
}
else
{
}
}