﻿function AllReQueslist()
{
    var http_requestlistppt = false;
    var objs;
    var allconerid='';
    this.Allconerid='';
    this.falg=0;
    var falg_two=0;
    function getCookielist20091130(name){var arr = document.cookie.match(new RegExp('(^| )'+name+'=([^;]*)(;|$)'));if(arr != null) return unescape(arr[2]); return null; }
    this.makeRequestlistppt=function (url,conerid) {
	     this.http_requestlistppt = false;
        if (window.XMLHttpRequest) { // Mozilla, Safari,...
            this.http_requestlistppt = new XMLHttpRequest();
            if (this.http_requestlistppt.overrideMimeType) {
                this.http_requestlistppt.overrideMimeType('text/xml');
            }
        } else if (window.ActiveXObject) { // IE
            try {
                this.http_requestlistppt = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    this.http_requestlistppt = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }
        if (!this.http_requestlistppt) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }
        falg_two=this.falg;
	    this.Allconerid=conerid;
	    allconerid=conerid;
	    objs=this.http_requestlistppt;
        this.http_requestlistppt.onreadystatechange =function()
        {
            if(objs.readyState == 4)
            {
                  if(objs.status == 200)
                  {   if(allconerid!=null&&allconerid!=""){
                 
                         if(allconerid.indexOf("MessgListToUsr")!=-1)
                         {
                                var valuea=objs.responseText;
                                if(parseInt(valuea)>0)
                                {
//                                    var summoney=document.getElementById("SumMoney").innerHTML;
//                                    document.getElementById("trThisDjMoney").style.display="";
//                                    document.getElementById("ThisDjMoney").innerHTML=valuea;
//                                    document.getElementById("SumMoney").innerHTML=parseInt(summoney)-parseInt(parseInt(valuea));
//                                    document.getElementById(allconerid).value=valuea;
//                                    document.getElementById("FristOrList").style.display="none";
                                        window.location.reload();
                                    return false;
                                }
                                else 
                                {
                                     document.getElementById("trThisDjMoney").style.display="none";
                                    // return false;
                                }
                                if(parseInt(valuea)==-2)
                                {
                                    alert("invalid voucher!"); 
                                    return false;
                                }
                                if(parseInt(valuea)==-1)
                                {
                                   alert("Voucher has been used!"); 
                                    return false;
                                }
                         }
                         else 
                         {
                            document.getElementById(allconerid).innerHTML=objs.responseText.split('uuptt')[1];
                         }
                        }
                        else 
                        {
                            if(falg_two==0)
                            {
                                var userid=getCookielist20091130("SetCookiesIsLoging");
                                if(parseInt(userid)>0){new AllReQueslist().makeRequestlistppt("/frmSign.aspx?uutp="+new Date().toString(),"frm_Sign001");}
			                    else {document.getElementById("Messglist").innerHTML="Invalid user ID or password!";}
			                    document.getElementById("memberName").disabled="";
			                    document.getElementById("memberPass").disabled="";
			                    document.getElementById("Register").disabled="";
			                     document.getElementById("loginPic").disabled="";
                            }
                            if(falg_two==1)
                            {
                                var userid=getCookielist20091130("SetCookiesIsLoging");
                                if(parseInt(userid)>0){new AllReQueslist().makeRequestlistppt("/frmsmallsign.aspx?uutp="+new Date().toString(),"frm_Sign002");}
			                    else {document.getElementById("Messglist_two").innerHTML="Invalid user ID or password!";}
			                    document.getElementById("memberName").disabled="";
			                    document.getElementById("memberPass").disabled="";
			                    document.getElementById("Register_two").disabled="";
			                    document.getElementById("loginPic").disabled="";
                            }
                        }
                  }
                  else {
                   //  alert('There was a problem with the request.');
                 }
            }
            
        }
        this.http_requestlistppt.open('GET', url, true);
        this.http_requestlistppt.send(null);
    }
}
