<!--
/**
* 
**/
function MM_openBrWindow(theURL,winName,features) 
{ //v2.0
  window.open(theURL,winName,features);
}


/**
* Get the HTTP Object
**/
function getHTTPObject()
{
	if (window.ActiveXObject) 
	{
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
	else if (window.XMLHttpRequest) 
	{
		return new XMLHttpRequest();
	}
	else
	{
		alert("Your browser does not support AJAX.");
		return null;
	}
}

function shipping_selected()
{
	toggle_frame_selection();
	update_price();
}

function frame_selected()
{
	update_price();
}

function toggle_frame_selection()
{
	if(document.getElementById)
	{
		var tmp = document.getElementsByTagName('div');
		for (var i=0; i<tmp.length; i++)
		{
			if(tmp[i].className == 'frame_selection')
			{
				if (document.milim_cart.shipping_select.value == "UK")
				{
					tmp[i].style.display = (tmp[i].style.display == 'block') ? 'block' : 'block';
				}
				else
				{
					tmp[i].style.display = (tmp[i].style.display == 'none') ? 'none' : 'none';
				}
			}
		}
	}
}

function update_price()
{
	//alert('update');
	httpObject = getHTTPObject();
	
	nocache = Math.random();
	
	if (httpObject != null)
	{
		httpObject.open("GET", "calculate.php"
		+"?PRICE="+document.milim_cart.item_price.value
		+"&SIZE="+document.milim_cart.item_size.value
		+"&SHIPPING="+document.milim_cart.shipping_select.value
		+"&FRAMING="+document.milim_cart.frames_select.value
		+'&nocache = '+nocache+'&FULL=false', true);
		httpObject.send(null);
		httpObject.onreadystatechange = setOutput;
	}
	
	document.getElementById('price').innerHTML = "<h2><em>Price</em>: Calculating new price...<h2/>";
}

/**
* 
**/
function setOutput()
{
	if(httpObject.readyState == 4)
	{
		eval("var response = ("+httpObject.responseText+")");
		
		if(!response.vat)
		{
			document.getElementById('price').innerHTML = "<h2><em>Price</em>: &pound;" + response.price + "</h2>";
		}
		else
		{
			document.getElementById('price').innerHTML = "<h2><em>Price</em>: &pound;" + response.price + "</h2>Including &pound;" + response.vat_price + " VAT";
		}
		document.getElementById('framing-price').innerHTML = "<em>Framing</em>: &pound;" + response.framing;
		document.getElementById('shipping-price').innerHTML = "<em>Shipping</em>: &pound;" + response.shipping;
	}
}
//-->