﻿// JScript 文件
 function returl(v)
 {
     if(window.location.href.indexOf("ad=NO")!=-1)
{
   if(window.location.href.indexOf("Integral=1")!=-1)
   {
        return window.location.pathname+"?ad=NO&Integral=1&countryid="+v;
   }
return window.location.pathname+"?ad=NO&countryid="+v;

}
  if(window.location.href.indexOf("Integral=1")!=-1)
   {
     return window.location.pathname+"?Integral=1&countryid="+v;
   }
     return window.location.pathname+"?countryid="+v;
    
 
 

 }
 function OrderbyPoint(v)
 {
      //alert(window.location.href.indexOf("?"));
 if(v==1)
 {
    if(window.location.href.indexOf("?")!=-1)
{
    
    return window.location.href.replace("&Integral=0","").replace("Integral=0","")+"&Integral=1";
}
else
{
   return window.location.href+"?Integral=1";
}
 }
 else
 {
       if(window.location.href.indexOf("?")!=-1)
{
    return window.location.href.replace("&Integral=1","").replace("Integral=1","")+"&Integral=0";
}
else
{
   return window.location.href+"?Integral=0";
}
 }
 }
  // alert(window.location.pathname);
 function CheckAll(form,sel)
          {            
            var defaultcheck = sel.checked; 
                for(i=0;i<form.elements.length;i++)
                {
                    if(form.elements[i].name=='SPId' )
                    {
	                    form.elements[i].checked = defaultcheck;
	                }  
                 }

                 if (!defaultcheck) {
                     if (document.getElementById("subinquiry")) {
                         document.getElementById("subinquiry").disabled = true;
                     }
                 if(document.getElementById("subinquiry1")!=null)
                   document.getElementById("subinquiry1").disabled = true;	
              }
              else {
                  if (document.getElementById("subinquiry")) {
                      document.getElementById("subinquiry").disabled = false;
                  }
                  if(document.getElementById("subinquiry1")!=null)
                   document.getElementById("subinquiry1").disabled = false;		
              }
          }

          function CheckAll1(form, sel,ii) {
              var defaultcheck = sel.checked;
              for (i = 0; i < form.elements.length; i++) {
                  if (form.elements[i].name == 'SPId') {
                      form.elements[i].checked = defaultcheck;
                  }
              }
             
                  if (!defaultcheck) {
                  
                      document.getElementById("subinquiry" + ii + "").disabled = true;

                  }
                  else {
                      document.getElementById("subinquiry" + ii + "").disabled = false;

                  }
              
              
          }
          function checkbtn1(form,ii) {
              var flag = false;
              for (var i = 0; i < form.elements.length; i++) {
                  var e = form.elements[i];
                  if ((e.name == 'SPId' && e.checked == true)) {
                      flag = true;
                      break;
                  }
              }
            
                  if (!flag) {
                      document.getElementById("subinquiry" + ii + "").disabled = true;

                  }
                  else {
                      document.getElementById("subinquiry" + ii + "").disabled = false;

                  }
              
             
          }
          
 
          
             function check()
    {
        if(document.getElementById("forbuytext").value.length<20)
        {
               alert("Please Enter between 20 to 2,000 characters.");
               return false;
        }
  
    }
       function strlen(){ 
    document.getElementById("charcount").innerHTML=document.getElementById("forbuytext").value.replace(/[^\x00-\xff]/g,"**").length;

} 
          function checkbtn(form)
          {  
                var flag = false;
                for(var i=0;i<form.elements.length;i++)
                {
                    var e = form.elements[i];
                    if ((e.name == 'SPId' && e.checked == true ) )
                    { 
                        flag=true;
                        break;
                    }
                }
                
                if(!flag)
                {
                    document.getElementById("subinquiry").disabled = true;	
                     if(document.getElementById("subinquiry1")!=null)
                   document.getElementById("subinquiry1").disabled = true;	 
                }
                else
                {
                    document.getElementById("subinquiry").disabled = false;	  
                     if(document.getElementById("subinquiry1")!=null)
                   document.getElementById("subinquiry1").disabled = false;	
                }
            }
