//== mybiogazelle javascripts ==================================================================

//getCurrentPrice(); ====================================================================

function getCurrentPrice(){
	var url = "getPurchasePrice.php?";

	//-- alles op form capturen
	//-- product id ------------------------------------------------------------
	var productid = document.getElementById('product');
	if(productid.selectedIndex!=undefined){
		var productid = productid.options[productid.selectedIndex].value;
	} else {
		var productid = productid.value;
	}
	
	url = url+"pid="+productid;
	//-- nrlicenses ------------------------------------------------------------
	var nritems = document.getElementById('nr_licenses');
	nritems = nritems.value;
	url = url+"&nri="+nritems;
	
	//-- upgradeprot_id --------------------------------------------------------
	var upgradeprotid = document.getElementById('upgradeprot_id');
	if (upgradeprotid!=undefined) {
	  if(upgradeprotid.selectedIndex!=undefined){
		  var upgradeprotid = upgradeprotid.options[upgradeprotid.selectedIndex].value;
	  } else {
		  var upgradeprotid = upgradeprotid.value;
	  }
  	  url = url+"&up="+upgradeprotid;
	}
	//-- nr_upgradeprot --------------------------------------------------------
	// var nrupgradeprot = document.getElementById('nr_upgradeprot');
	// nrupgradeprot = nrupgradeprot.value;
	
	//--transactioncost_id---------------------------------------------------------
	var transactioncost_id = document.getElementById('transactioncost_id');
	if(transactioncost_id.selectedIndex!=undefined){
		var transactioncost_id = transactioncost_id.options[transactioncost_id.selectedIndex].value;
	} else {
		var transactioncost_id = transactioncost_id.value;
	}
	url = url+"&tid="+transactioncost_id;	

	//-- promocode --------------------------------------------------------
	var promcode = document.getElementById('prom_code');
	if (promcode!=undefined) {	
	  promcode = promcode.value;
	  if (promcode != "") url = url+"&prc="+promcode;	
	}
	
	var locationid;
	//-- location_id --------------------------------------------------------
	if(document.getElementById('location_id')){
  	  locationid = document.getElementById('location_id');
	  if(locationid.selectedIndex!=undefined){
		locationid = locationid.options[locationid.selectedIndex].value;
	  } else {
		locationid = locationid.value;
	  }
    }
	else {
	  locationid = "";
	}	
    url = url+"&loc="+locationid;
	
	//--url = url+"&nrup="+nrupgradeprot;
	makeHttpRequest(url,"alertCurrentPrice",false);
}

function alertCurrentPrice(output){
	var cprice = document.getElementById('currentprice');
	cprice.value = output;
}
