	/**
	*	Javascript to manage product variations 
 	*	Create Ajax request object (for all browser types)
 	*/ 
			
	function updateVarationSelectors(productid,selectedvariant,language,productindex,baseurl) {
		var ajaxRequest;
		try {
			// Opera 8.0+, Firefox, Safari
			ajaxRequest = new XMLHttpRequest();
		} catch (e) {
			// Internet Explorer Browsers
			try {
				ajaxRequest = new ActiveXObject('Msxml2.XMLHTTP');
			} catch (e) {
				try {
					ajaxRequest = new ActiveXObject('Microsoft.XMLHTTP');
				} catch (e) {
					// Something went wrong!
					alert('Failed to generate AJAX object.');
					return false;
				}
			}
		}
	
		// Function that will receive data sent from the server
		ajaxRequest.onreadystatechange = function() {
			// Check ready state
			if(ajaxRequest.readyState == 4) {
				document.getElementById('productvariations'+productindex).innerHTML = ajaxRequest.responseText;
			}
		};
		
		ajaxRequest.open('GET', baseurl+'/includes/ajaxfunctions/update_variations.php?productid='+productid+'&selectedvariant='+selectedvariant+'&language='+language+'&productindex='+productindex, true);
		ajaxRequest.send(null);
	
	}
	
	function updatePrice(productid,selectedvariant,language,productindex,vatrate,baseurl) {
		var ajaxRequest;
		try {
			// Opera 8.0+, Firefox, Safari
			ajaxRequest = new XMLHttpRequest();
		} catch (e) {
			// Internet Explorer Browsers
			try {
				ajaxRequest = new ActiveXObject('Msxml2.XMLHTTP');
			} catch (e) {
				try {
					ajaxRequest = new ActiveXObject('Microsoft.XMLHTTP');
				} catch (e) {
					// Something went wrong!
					alert('Failed to generate AJAX object.');
					return false;
				}
			}
		}
	
		// Function that will receive data sent from the server
		ajaxRequest.onreadystatechange = function() {
			// Check ready state
			if(ajaxRequest.readyState == 4) {
				vatElement = document.getElementById('productexcvatprice'+productindex);
				if(vatElement != null) {
					incVatPrice = Math.round(ajaxRequest.responseText*(1+(vatrate/100))*100)/100;
					incVatString = new String(incVatPrice);
					if(incVatString.indexOf('.') < 0) {
						incVatString += '.';
					}
					while(incVatString.indexOf('.') >  incVatString.length-3) {
						incVatString += '0';
					}
					document.getElementById('productprice'+productindex).innerHTML = incVatString;
					document.getElementById('productexcvatprice'+productindex).innerHTML = ajaxRequest.responseText;
				} else {
					document.getElementById('productprice'+productindex).innerHTML = ajaxRequest.responseText;
				}
			}
		};
		
		ajaxRequest.open('GET', baseurl+'/includes/ajaxfunctions/update_product_price.php?productid='+productid+'&selectedvariant='+selectedvariant+'&language='+language+'&productindex='+productindex, true);
		ajaxRequest.send(null);
	
	}