<!--
var xmlHttp;
function createXHRCART(){
	if (window.XMLHttpRequest) {
		xmlHttp = new XMLHttpRequest();
	}else if (window.ActiveXObject) {
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}

	if (!xmlHttp) {
		alert('您使用的瀏覽器不支援 XMLHTTP 物件');
		return false;
	}
}



function sendRequestCART(IDDS,url){
	
	var x1="";
	var x2="";
	var x3="";
	var x1a="";
	var x2a="";
	var x3a="";
	//
	if(document.getElementById("Add") !=null){var x = document.getElementById("Add").value;}
	
	if(document.getElementById("ll1t_"+IDDS) !=null){ var x1 = document.getElementById("ll1t_"+IDDS).value;}
	if(document.getElementById("ll2t_"+IDDS) !=null){ var x2 = document.getElementById("ll2t_"+IDDS).value;}
	if(document.getElementById("ll3t_"+IDDS) !=null){ var x3 = document.getElementById("ll3t_"+IDDS).value;}
	
	if(document.getElementById("select_item1_"+IDDS) !=null){ var x1a = document.getElementById("select_item1_"+IDDS).value;}
	if(document.getElementById("select_item2_"+IDDS) !=null){ var x2a = document.getElementById("select_item2_"+IDDS).value;}
	if(document.getElementById("select_item3_"+IDDS) !=null){ var x3a = document.getElementById("select_item3_"+IDDS).value;}

	//alert('MMx1=' + x1 +'MMx2=' + x2+'MMx3=' + x3);
	//alert('MMx1a=' + x1a+'MMx2a=' + x2a+'MMx3a=' + x3a);
	//alert(document.getElementById);
	
	createXHRCART(); //檢查是否支援XML
	//if (x != ""){ //檢查值
		var postSTR= '&select_item1=' + x1a +'&ll1t='+ x1 + '&select_item2=' + x2a +'&ll2t='+ x2 + '&select_item3=' + x3a +'&ll3t='+ x3 +'&Add='+ x +'&timeStamp='+new Date().getTime();
		var url= url + '&select_item1=' + x1a +'&ll1t='+ x1 + '&select_item2=' + x2a +'&ll2t='+ x2 + '&select_item3=' + x3a +'&ll3t='+ x3 +'&Add='+ x +'&timeStamp='+new Date().getTime();

//}
	//alert('MMurl0:' + url);
	xmlHttp.open('POST',url,true);
	xmlHttp.onreadystatechange=catchResultCART;
	//xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=utf-8');
	xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	//xmlHttp.SetRequestHeader("Content-Type","text/xml")
	//xmlHttp.send(getFormValueCART(af));
	//xmlHttp.send(null);
	xmlHttp.send(postSTR);
}

//轉頁
//function transfer()
//{window.location.href='index_AUTH.php';}
//setTimeout("location='index_AUTH.php'",3000) ;
//document.location.replace('index_AUTH.php');
//location.href='index_AUTH.php';
//}  ///////xmlHttp.readyState未初始化(0)，正在加載(1)，已加載(2)，交互(3)，已完成(4)
//		//alert(msgs[4].toString());

function catchResultCART(){
	
	//alert(xmlHttp.responseText);
	
	if (xmlHttp.readyState==4){
		s=xmlHttp.responseText;	
		msgs=eval(s);
		if (xmlHttp.status == 200) {
			
			//alert('MMS0:' + msgs[0]);
			//alert('MMS3:' + msgs[3]);
			//alert('MMS2:' + msgs[2]);
			//alert('ADD:' + msgs[3]);
			//alert('MMS4:' + msgs[4]);
			
			var obj=document.getElementById(msgs[2]);
			
			
			switch(msgs[1].toString()){
					
					case "recalt":
						
						//FF.form.submit();
						obj.innerHTML=msgs[0];	
						//window.location.href="index_down.php?sele=viewCart";
						//setTimeout(obj.innerHTML="", 5000);
						//document.FF.action='index_down.php?sele=viewCart'; //action = 要送的後端程式 
					
					break;
			
					default:

						obj.innerHTML=msgs[0];
						//window.location.href="index_down.php?sele=viewCart"; 
						
					break;

			}
		}
	}
}

function getFormValueCART(form){
	var str='',ft,fv;

	for (var i=0;i<form.elements.length;i++){
		fv=form.elements[i];
		ft=fv.type.toLowerCase();

		switch(ft){
			case 'select-one':
				str+=fv.name+'='+escape(fv.value)+'&';
				break;
			case 'radio':
				if (fv.checked){
					str+=fv.name+'='+escape(fv.value)+'&';
				}
				break;
			case 'checkbox':
				if (fv.checked){
					str+=fv.name+'='+escape(fv.value)+'&';
				}
				break;
			case 'text':
				str+=fv.name+'='+escape(fv.value)+'&';
				break;
			case 'password':
				str+=fv.name+'='+escape(fv.value)+'&';
				break;
			case 'hidden':
				str+=fv.name+'='+escape(fv.value)+'&';
				break;
			case 'textarea':
				str+=fv.name+'='+escape(fv.value)+'&';
				break;
			default:
				break;
		}
	}

	return str
}

//-->

