/** 自動生成副檔每列每個欄位(舊版)
 * Add detail rows in column
 */
function addnewrows_td(item_id,relative_path,SID,new_ERI,id,name,types,size,tvalue,qqrid,query_fields,return_fields,js_number,qqrcv)
{
	var new_row = "";
	
	if (size == null){ size = 0; }
	if (tvalue == null){ tvalue = ''; }
	if (qqrid == null){ qqrid = ''; }
	if (query_fields == null){ query_fields = ''; }
	if (return_fields == null){ return_fields = ''; }
	if (js_number == null){ js_number = 0; }
	if (qqrcv == null){qqrcv = 1; }/*預設開啟qqrcv*/
	
	if(types != 'hidden'){
		new_row = "<td>";
	}
	
	if(types == 'select'){
		new_row += "<select ";
		new_row += "id=\""+ id + new_ERI +"\" ";
		new_row += "name=\""+ item_id + name +"\" >";
	}else if(types != 'str'){
		new_row += "<input type=\""+types+"\" ";
		new_row += "size=\""+size+"\" ";
		new_row += "id=\""+ id + new_ERI +"\" ";
		new_row += "name=\""+ item_id + name +"\" ";
		new_row += "value=\""+ tvalue +"\" ";
	}else{
		new_row += tvalue;
		new_row += "<input type=\"hidden\" ";
		new_row += "id=\""+ id + new_ERI +"\" ";
		new_row += "name=\""+ item_id + name +"\" ";
		new_row += "value=\""+ tvalue +"\" ";
	}
	
	//下拉選單
	if(types == 'select'){
		for (var i=0;i<js_number;i++) {
			//alert(query_fields[i]);
			new_row += "<option value=\""+query_fields[i]+"\" >"+return_fields[i]+"</option>"
		}
	}
	
	//速查
	if(qqrid != ''){
		var return_qqr = "";
		for (var i=0;i<js_number;i++) {
			//alert(return_fields[i] + new_ERI);
			if(return_qqr != ''){
				return_qqr += ",";
			}
			return_qqr += return_fields[i] + new_ERI
		}
		//速查按鈕
		if(qqrcv == 1){
			new_row += "onChange=\"return_qqr_sr('"+relative_path+"core/cw5e_mqqr_cv.php?sid="+SID+"&mode=qqr&aid=" + qqrid + "&ccv=&field= "+ query_fields[0] +"&value='+EncodeURLutf8($('#"+ id + new_ERI + "').val()), '"+ return_qqr +"', '"+query_fields+"', '');\" ";
		}
		new_row += " > ";
		
		
		new_row += "<input type=\"button\" value=\"...\" onClick=\"load_popup_box('"+relative_path+"core/cw5e_mqqr_cv.php?sid="+SID+"&mode=qqr&aid=" + qqrid + "&ccv=&col=" + return_qqr + "&ret=" + query_fields + "', 'fast_query', 0, 0)\">";
		
		new_row += "</td>";
	}else if(types == 'hidden'){
		new_row += ">";
	}else if(types == 'str'){
		new_row += "</td>";
	}else if(types == 'select'){
		new_row += "</select>";
	}else{
		new_row += "></td>";
	}
	
	return new_row;
}