//############################################################################
//                 GELIEVE DEZE BOODSCHAP NIET TE VERWIJDEREN                #
//############################################################################
//                         CREATED BY MARCO PELSSERS                         #
//                                   FOR                                     #
//                                ARTIMEDES                                  #
//   info@mpolo.be                                             24/11/2009    #
//############################################################################
//                 		   ALLE RECHTEN VOORBEHOUDEN                         #
//############################################################################

var xmlHttp;

function getCalc(cur_img) {
	
	xmlHttp=GetXmlHttpObject();
	
	if (xmlHttp==null) {
	  alert ("Browser does not support HTTP Request");
	  return;
	} 

	var url="ajax/mycalc.php";
	url=url+"?img="+cur_img;
	url=url+"&aantal="+document.getElementById('qty'+cur_img).value;
	url=url+"&breedte="+document.getElementById('product'+cur_img+'[breedte]').value;
	url=url+"&hoogte="+document.getElementById('product'+cur_img+'[hoogte]').value;
	url=url+"&omlijsting="+document.getElementById('product'+cur_img+'[omlijsting]').value;
	url=url+"&effect="+document.getElementById('product'+cur_img+'[effect]').value;
	//alert(document.getElementById('product'+cur_img+'[effect]').value);
	//alert(url);
	xmlHttp.onreadystatechange=stateChanged_calc;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 



function geefResultatenIn_calc(dedata) {
//alert(dedata);
	if (dedata == "") {
		return;
	}else{	
	
	/*
	0 => img
	1 => price
	*/
		arr_split = dedata.split(";");
	document.getElementById('pcont'+arr_split[0]+'[price]').innerHTML = 'EUR '+parseFloat(arr_split[1]).toFixed(2);
	document.getElementById('price'+arr_split[0]).value = parseFloat(arr_split[1]).toFixed(2);
	}
}


function stateChanged_calc() { 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")  {
		//alert(xmlHttp.responseText); 
			geefResultatenIn_calc(xmlHttp.responseText);
 	} 
}



