﻿	var CstHttpReq2;
 	//创建XMLHttpRequest对象       
    function createXMLHttpRequest2() {
		if(window.XMLHttpRequest) { //Mozilla 浏览器
			CstHttpReq2 = new XMLHttpRequest();
		}
		else if (window.ActiveXObject) { // IE浏览器
			try {
				CstHttpReq2 = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				try {
					CstHttpReq2 = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {}
			}
		}
		
	}
	//发送请求函数
	function sendRequest2(url) {
		createXMLHttpRequest2();		
		CstHttpReq2.open("GET", url, true);
		CstHttpReq2.onreadystatechange = processResponse2;//指定响应函数
		CstHttpReq2.send(null);  // 发送请求
	}
	// 处理返回信息函数
    function processResponse2() {
    	if (CstHttpReq2.readyState == 4) { // 判断对象状态
        	if (CstHttpReq2.status == 200) { // 信息已经成功返回，开始处理信息
            	updateList2();
            } else { //页面不正常
                window.alert("您所请求的页面有异常。processResponse2() ");
            }
        }
    }
	// 
	function refreshList2(sel) {
	    var brandID = sel;
	  
	    if(brandID == "" ) {
	        clearList2();
	        return;
	    }    

	    var url = "/cst/dyList.do?BrandID=" + brandID;	        
		sendRequest2(url)	
	}

	function updateList2() {
	    clearList2();
	    var product = document.getElementById("phoneType2");
	    var results = CstHttpReq2.responseXML.getElementsByTagName("phoneType");	
	    var results2 = CstHttpReq2.responseXML.getElementsByTagName("phoneType2");    	   
	    var option = null;
		
	    for(var i = 0; i < results.length; i++) {
	        option = document.createElement("option");	        
	        option.setAttribute("value",results2[i].firstChild.nodeValue) ;       
	        option.appendChild(document.createTextNode(results[i].firstChild.nodeValue));
	        product.appendChild(option);
	    }
	}

	function clearList2() {
	    var ServName = document.getElementById("phoneType2");
	    while(ServName.childNodes.length > 0) {
	        ServName.removeChild(ServName.childNodes[0]);
	    }
	}
