﻿ try{document.execCommand("BackgroundImageCache", false, true);}
catch(e){}
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)
                                {
                                    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;
                                }
                                  if(parseInt(valuea)==-3)
                                {
                                    alert("Sorry,your coupon is overdue!");
                                    return false;
                                }
                         }
                         else 
                         {
                            document.getElementById(allconerid).innerHTML=objs.responseText.split('uuptt')[1];                            
                         }
                         
                         
                        if(allconerid.indexOf("labtext")!=-1)
                        {
                             var returnvalue=objs.responseText;
                             if(parseInt(returnvalue)==-2)
                             {
                               document.getElementById(allconerid).innerHTML="Invalid credit card number";
                               return false;
                             } 
                            if(parseInt(returnvalue)==-1)
                            {
                              document.getElementById(allconerid).innerHTML="";
                              document.getElementById('<%=btnok.ClientID%>').click();
                            }
                        }
                        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 
			                    {
			                        if(userid=="-1")
			                        {
			                            document.getElementById("Messglist").innerHTML="Sorry, you have been suspended.<br/><span><a href='/memberLostpass.aspx' style='color:#FFFFFF'>Forgot Password?</a></span>";
			                        }
			                        else
			                            document.getElementById("Messglist").innerHTML="Invalid user ID or password!<br/><span><a href='/memberLostpass.aspx' style='color:#FFFFFF'>Forgot Password?</a></span>";
			                    }
			                    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="";
                            }
                               if(falg_two==2)
                            {                           
                                 var num=objs.responseText;
                                 var CtxtName=document.getElementById('txtName2');
                                 if(num==1)
                                 {
                                      if(CtxtName.value.length < 6 || CtxtName.value.length > 100)
                                      {
                                           document.getElementById("spanName").style.display="block";
                                           document.getElementById("spanName").style.color="#ff0000";
                                           if(document.all){
	                                       document.getElementById("spanName").innerText="Your user ID must contain 6 to 100 numbers or characters.";
	                                       }else
	                                       {
	                                            document.getElementById("spanName").textContent ="Your user ID must contain 6 to 100 numbers or characters.";
	                                       }
	                                  }else
	                                  {
                                           document.getElementById("spanName").style.display="block";
                                           document.getElementById("spanName").style.color="#ff0000";
                                           if(document.all){
	                                       document.getElementById("spanName").innerText="Please enter your another user ID."; 
	                                       }
	                                       else
	                                       {
	                                             document.getElementById("spanName").textContent="This user ID has already been taken."; 
	                                       }
	                                  }
	                              }   
	                              else
                                  {
                                      if(CtxtName.value.length < 6 || CtxtName.value.length > 100)
                                      {
                                           document.getElementById("spanName").style.display="block";
                                           document.getElementById("spanName").style.color="#ff0000";
                                           if(document.all){
	                                       document.getElementById("spanName").innerText="Your user ID must contain 6 to 100 numbers or characters.";
	                                       }
	                                       else
	                                       {
	                                           document.getElementById("spanName").textContent="Your user ID must contain 6 to 100 numbers or characters.";
	                                       }
	                                  }
	                                  else
	                                  {
                                           document.getElementById("spanName").style.display="block";
                                           document.getElementById("spanName").style.color="#33CC99";
                                           if(document.all){
	                                       document.getElementById("spanName").innerText="This user ID is available.";
	                                       }else
	                                       {
	                                           document.getElementById("spanName").textContent="This user ID is available.";
	                                       }
	                                  }
                                  }
                            }
                            if(falg_two==3)
                            {
                                var num=objs.responseText;
                                var CtxtEmail=document.getElementById('txtEmailRegister');
                                if(num==1)
                                 {  
                                     document.getElementById("spanEmail").style.display="block";
                                     document.getElementById("spanEmail").style.color="#ff0000";
                                     if(document.all){
	                                  document.getElementById("spanEmail").innerText="Sorry, this email address has already been registered, please enter another one.";
	                                  }else
	                                  {
	                                       document.getElementById("spanEmail").textContent="Sorry, this email address has already been registered, please enter another one.";
	                                  }
                                	        
                                  }
                                  else
                                  {
                                        
                                        var index = CtxtEmail.value.indexOf("@");
                                        var num3 = CtxtEmail.value.indexOf(".");
                                        var num4 = CtxtEmail.value.indexOf(" ");
                                        var length = CtxtEmail.value.length;
                                        if ((index < 1) || (num4 != -1))
                                        {
                                             document.getElementById("spanEmail").style.display="block";
                                             document.getElementById("spanEmail").style.color="#ff0000";
                                             if(document.all){
	                                         document.getElementById("spanEmail").innerText="Invalid email address format. Please try again.";
	                                         }else
	                                         {
	                                             document.getElementById("spanEmail").textContent="Invalid email address format. Please try again.";
	                                         }
                                         }
                                         else
                                         {     
                                              document.getElementById("spanEmail").style.display="block";
                                              document.getElementById("spanEmail").style.color="#33CC99";
                                              if(document.all){
	                                          document.getElementById("spanEmail").innerText="This email address is available.";
	                                          }else
	                                          {
	                                            document.getElementById("spanEmail").textContent="This email address is available.";
	                                          }
	                                     }
                                  }
                            }
                        }
                  }
                  else {
                     //alert('There was a problem with the request.');
                 }
            }
            
        }
        this.http_requestlistppt.open('GET', url, true);
        this.http_requestlistppt.send(null);
    }
}
 function SetSelectValues()
       {try{
            var valus=GetCodeList('nationalityCookie');
            var sele=document.getElementById("select");
            for(var i=0;i<sele.options.length;i++)
            {
                if(sele.options[i].value.indexOf(valus)>0)
                {
                    sele.options[i].selected =true;
                    break;
                }
            }
            }catch(e){}
       }
function GetUrllist()
{
    var s=window.location.href;
//    if(s.indexOf('products')>0)
//    {
//        var url=s.split('/');
//        var urllist="products/"+((url[url.length-1].indexOf(".html")>0||url[url.length-1].indexOf(".aspx")>0)? url[url.length-1]:"index.html");
//        return urllist;
//    }
//    else
//    {
//        var url=s.split('/');
//        var urllist=(url[url.length-1].indexOf(".html")>0||url[url.length-1].indexOf(".aspx")>0)? url[url.length-1]:"index.html";
//        return urllist;
//    }
    var rege = new RegExp("http(s)?://");
    var str = s.replace(rege, "");
    var strArr = str.split("/");
    var returnUrl="";
    if(typeof strArr != "underfined")
    {
        for(var i=1;i<strArr.length;i++)
        {
            returnUrl+= strArr[i]+"\/";
        }
    }
    return returnUrl.substr(0, returnUrl.length -1);
      
}
function killErrors() {
return true;
}
window.onerror = killErrors;
