/*
	Used for products that share a parent
	with multiple children.
	It updates the the display of the following fields:
	- IDProduct
	- Image
	- Property
	- Model
	- UPC
	- Price
*/

/*
	 ALSO, to update the hidden fabric field for those products that have the option
*/

function DisplayMultipleProductInfo(IDProduct){

	new Ajax.Request('products_display_multiples_info_ajax.php',
  {
		method: 'post',
		parameters: 'idprod='+IDProduct,
		asynchronous: false,
		onSuccess: function(transport){
			Response = transport.responseText.evalJSON()
			if (Response.success){

				// Shows or not the 'Add to Cart' button
				if (Response.CartButton==1){

				}

				// Changes the select box
				document.getElementById('Property'+IDProduct).selected = true


				if (Response.Model)
				{	document.getElementById('DivModel').style.display = 'block'
				}else{ document.getElementById('DivModel').style.display = 'none'}
            document.getElementById('Model').innerHTML = Response.Model

				if (Response.UPC != 0)
				{	document.getElementById('DivUPC').style.display = 'block'
				}else{ document.getElementById('DivUPC').style.display = 'none'}
				document.getElementById('UPC').innerHTML = Response.UPC

				document.getElementById('Price').innerHTML = Response.Price

				if (Response.CartButton == '1')
				{	document.getElementById('DivCartButton').style.display = 'block'
				}else{ document.getElementById('DivCartButton').style.display = 'none'}
				document.getElementById('IDProduct').value = IDProduct

				document.getElementById('MedThumb').src = Response.SRCMed
				document.getElementById('A_MedThumb').href = Response.SRCBig
				document.getElementById('Magnifier').href = Response.SRCBig
			}
    }
  })

}// End of function DisplayMultipleProductInfo

function UpdateFabricStr(Fabric){

	 document.getElementById('Fabric').value = Fabric

}// End of function UpdateFabricStr