function ajax(){
      this.method;
      this.url;
      this.responsetype;
      this.content;
      var http_request = false;
      this.getExecObj = function(reValue){ 
            if(window.XMLHttpRequest) {
                  http_request = new XMLHttpRequest();
                  if (http_request.overrideMimeType) {
                           http_request.overrideMimeType("text/xml");
                  }
            }
            else if (window.ActiveXObject) {
                  try {
                           http_request = new ActiveXObject("Msxml2.XMLHTTP");
                  } catch (e) {
                           try {
                                      http_request = new ActiveXObject("Microsoft.XMLHTTP");
                           } catch (e) {}
                  }
            }
            if (!http_request) {
                  window.alert("创建XMLHttpRequest对象实例失败.");
                  return false;
            }
            
            if(this.method.toLowerCase()=="get") {
                  http_request.open(this.method, this.url, true);
            }
            else if(this.method.toLowerCase()=="post") {
                  http_request.open(this.method, this.url, true);
                  http_request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
            }
            else {                           
                  window.alert("http请求类别参数错误。");
                  return false;
            }
            http_request.send(this.content);            
            
            var reTextResponse = function() {
                  if (http_request.readyState == 4) {
                        if (http_request.status == 200) {   
                                    reValue(http_request.responseText);                                          
                        } else {
                                 alert("页面有异常。");
                        }
                  }
            }            
            var reXMLResponse = function() {
                  if (http_request.readyState == 4) {
                        if (http_request.status == 200) {   
                                    reValue(http_request.responseXML);                                          
                        } else {
                                 alert("页面有异常。");
                        }
                  }
            }
             
            if(this.responsetype.toLowerCase()=="text") {    
                  http_request.onreadystatechange = reTextResponse;
            }
            else if(this.responsetype.toLowerCase()=="xml") {
                  http_request.onreadystatechange = reXMLResponse;
            }
            else {
                  window.alert("参数错误。");
                  return false;
            }
      }       
}
      
        // 调用方法      
var _ajax = new ajax()
_ajax.method = "post";                                 //是get还是post
_ajax.url = "http://"+ location.hostname +"/Returnlist.aspx";                         //请求的地址
_ajax.responsetype = "text";                           //处理返回内容的类型
_ajax.content = "id=2";                                //发送的内容
_ajax.getExecObj(                                      //对返回值处理 
      function(str){
                        document.getElementById("select1").outerHTML = "<select name='select1' onchange='rsp(this)'><option value='0'>选择大产品</option>"+ str + "</select>"
                              }
);   

function rsp(obj)
{

    if(obj.value=="0")
    {
     if(obj.name=="select1")
     {
         document.getElementById(obj.name + "1").outerHTML = "<select name='"+ obj.name + "1" +"' onchange='rsp(this)'><option value=''>选择小产品</option></select>"
         document.getElementById(obj.name + "11").outerHTML = "<select name='"+ obj.name + "11" +"'><option>选择省</option></select>"
     }
     if(obj.name=="select11")
         document.getElementById(obj.name + "1").outerHTML = "<select name='"+ obj.name + "1" +"'><option>选择省</option></select>"
         return ;
    }

    var _ajax = new ajax()
        _ajax.method = "post";                                 //是get还是post
        _ajax.url = "http://"+ location.hostname +"/Returnlist.aspx";                         //请求的地址
        _ajax.responsetype = "text";                           //处理返回内容的类型
        _ajax.content = "id=" + obj.value.split("|")[0];                     //发送的内容
        if(obj.name=="select11")
        _ajax.content = "id=" + obj.value.split("|")[0] + "&type=4" ;        //发送的内容
        _ajax.getExecObj(
             function(str){
                             if(obj.name=="select1")
                                    document.getElementById(obj.name + "1").outerHTML = "<select name='"+ obj.name + "1" +"' onchange='rsp(this)'><option value=''>选择小产品</option>"+ str + "</select>"
                             if(obj.name=="select11")
                                    document.getElementById(obj.name + "1").outerHTML = "<select name='"+ obj.name + "1" +"'><option>选择省</option>"+ str + "</select>"
                          }
                        );   
}

function subr()
{
    var temp="";
    var ofname="";
    
    if(document.getElementById("select1").value != "")
    {
        temp=document.getElementById("select1").value.split("|")[1];
	
	 if(document.getElementById("select1").value.split("|").length > 2)
           ofname=document.getElementById("select1").value.split("|")[2] + ".html";
         else
            ofname=document.getElementById("select1").value.split("|")[1] + ".html";
    }
    if(document.getElementById("select11").value != "")
    {
        temp+="/" +document.getElementById("select11").value.split("|")[1];
         ofname=document.getElementById("select11").value.split("|")[1] + ".html";;
    }     
    if(document.getElementById("select111").value != "")
    {
        temp+="/" + document.getElementById("select111").value.split("|")[1];
         ofname=document.getElementById("select111").value.split("|")[1] + ".html";
    }
    
           if(temp.length > 0)
           {
		if(temp.indexOf("chnip.net/") > 0)
		{
	              window.location=temp+"/"+ofname
		}
		else
		{
                      window.location="http://www.ebchn.com/" + temp+"/"+ofname
		}
           }
}