
    var xmlMobile;
    
    function getMobileList( n){

        document.cform.mark.value = n;
        var brandsn = document.cform.brandsn[n].value;
        
        document.cform.mobiles[n].options[0] = new Option( '請選擇型號', '0000000000');
        document.cform.mobiles[n].length = 1;
        
        if( brandsn != '0000000000'){
        
            var url = './xml/xml_mobile_list.jsp?brandsn=' + brandsn;

            if( window.XMLHttpRequest) xmlMobile = new XMLHttpRequest();
            else if( window.ActiveXObject) xmlMobile = new ActiveXObject('Microsoft.XMLHTTP');
                  
            // xmlMobile = GetXmlHttpObject();
            xmlMobile.open( 'GET', url, false);
            xmlMobile.onreadystatechange = setMobileList;
            xmlMobile.send( null);

        }

    }
    
    function setMobileList(){

        var i, j;
        var total;
        var serialno, name;
        var n;
        
        if( xmlMobile.readyState == 4 && xmlMobile.status == 200){ 
            
            total = parseInt( xmlMobile.responseXML.getElementsByTagName('total')[0].firstChild.nodeValue);

            n = document.cform.mark.value;

            if( total > 0){
                
                document.cform.mobiles[n].length = total + 1;
                document.cform.mobiles[n].options[0] = new Option( '請選擇型號', '0000000000');
                
                for( i = 0; i < total; i ++){

                    serialno = xmlMobile.responseXML.getElementsByTagName('serialno')[i].firstChild.nodeValue;
                    name = xmlMobile.responseXML.getElementsByTagName('name')[i].firstChild.nodeValue;

                    j = i + 1;

                    document.cform.mobiles[n].options[j] = new Option( name, serialno);

                }
              
            }

        }

    }

    function getMobileListT( n){

        document.tform.mark.value = n;
        var brandsn = document.tform.brandsn[n].value;
        
        document.tform.mobiles[n].options[0] = new Option( '請選擇型號', '0000000000');
        document.tform.mobiles[n].length = 1;
        
        if( brandsn != '0000000000'){
        
            var url = './xml/xml_mobile_list.jsp?brandsn=' + brandsn;
                  
            // xmlMobile = GetXmlHttpObject();
            
            if( window.XMLHttpRequest) xmlMobile = new XMLHttpRequest();
            else if( window.ActiveXObject) xmlMobile = new ActiveXObject('Microsoft.XMLHTTP');
            
            xmlMobile.open( 'GET', url, false);
            xmlMobile.onreadystatechange = setMobileListT;
            xmlMobile.send( null);

        }

    }
    
    function setMobileListT(){

        var i, j;
        var total;
        var serialno, name;
        var n;
        
        if( xmlMobile.readyState == 4 && xmlMobile.status == 200){ 
            
            total = parseInt( xmlMobile.responseXML.getElementsByTagName('total')[0].firstChild.nodeValue);

            n = document.tform.mark.value;

            if( total > 0){
                
                document.tform.mobiles[n].length = total + 1;
                document.tform.mobiles[n].options[0] = new Option( '請選擇型號', '0000000000');
                
                for( i = 0; i < total; i ++){

                    serialno = xmlMobile.responseXML.getElementsByTagName('serialno')[i].firstChild.nodeValue;
                    name = xmlMobile.responseXML.getElementsByTagName('name')[i].firstChild.nodeValue;

                    j = i + 1;

                    document.tform.mobiles[n].options[j] = new Option( name, serialno);

                }
              
            }

        }

    }