/* ---------------------------- */
/* XMLHTTPRequest Enable 		*/
/* ---------------------------- */
function createObject() {
	var request_type;
	var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer"){
	request_type = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		request_type = new XMLHttpRequest();
	}
		return request_type;
}

var http = createObject();

/* -------------------------- */
/* SEARCH					 */
/* -------------------------- */
function calc() {

// Set te random number to add to URL request
nocache = Math.random();
http.open('get','ecom/store2/bespoke/bsk102_updateprice.php?nocache='+nocache+GetInfoStringPrice());
http.onreadystatechange = autosuggestReply;
http.send(null);
}
function GetInfoStringPrice(){
	    var elLength = document.anything.elements.length;
	    var sData="";
		/*
        var iCount=0;
        iCount = document.getElementsByName('ItemID').length;
        if(iCount>0){
		  sData += "&id=" + document.anything.ItemID.value;
	    } */
		var iCount=0;
        for (i=0; i<elLength; i++) {
          var type = document.anything.elements[i].type;
          if (type=="select-one") {
		   sData += "&opt[]=" + document.anything.elements[i].value;
	      }
        }
		sData += "&quantity=" + document.anything.ItemQuantity.value;
        sData += "&id=" + document.anything.ItemID.value;
		return sData;
}
function autosuggestReply() {
if(http.readyState == 4){
	var response = http.responseText;
	e = document.getElementById('costCalc');
	if(response!=""){
		e.innerHTML=response;
	} 
}
}



