function populateForm()
{
	var xmlhttp;
	if (window.XMLHttpRequest)
	{
		xmlhttp=new XMLHttpRequest();
	}
	else
	{
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4)
		{
			var shirt = "";
			x=xmlhttp.responseXML.documentElement.getElementsByTagName("item");
			for (i=0;i<x.length;i++)
			{
				shirt = shirt + '<option value="';
				xx=x[i].getElementsByTagName("price");
				{
					shirt = shirt +  xx[0].firstChild.nodeValue;
				}
				shirt = shirt + '">';
				xx=x[i].getElementsByTagName("name");
				{
					shirt = shirt +  xx[0].firstChild.nodeValue;
				}
				shirt = shirt + '</option>';
			}
			document.getElementById('shirt').innerHTML=shirt;
			
			//front
			var frontColor = '';
			x=xmlhttp.responseXML.documentElement.getElementsByTagName("fcolor");
			for (i=0;i<x.length;i++)
			{
				
				frontColor = frontColor + '<option value="';
				xx=x[i].getElementsByTagName("cost");
				{
					frontColor = frontColor +  xx[0].firstChild.nodeValue;
				}
				frontColor = frontColor + '">';
				xx=x[i].getElementsByTagName("amount");
				{
					frontColor = frontColor +  xx[0].firstChild.nodeValue;
				}
				frontColor = frontColor + '</option>';
			}
			document.getElementById('frontColor').innerHTML=frontColor;
			
			
			//back
			var backColor = '<option value="0" selected="selected">0</option>';
			x=xmlhttp.responseXML.documentElement.getElementsByTagName("bcolor");
			for (i=0;i<x.length;i++)
			{
				
				backColor = backColor + '<option value="';
				xx=x[i].getElementsByTagName("cost");
				{
					backColor = backColor +  xx[0].firstChild.nodeValue;
				}
				backColor = backColor + '">';
				xx=x[i].getElementsByTagName("amount");
				{
					backColor = backColor +  xx[0].firstChild.nodeValue;
				}
				backColor = backColor + '</option>';
			}
			
			document.getElementById('backColor').innerHTML=backColor;
			
			
		}
	}
	xmlhttp.open("GET","data\/formitems.xml",true);
	xmlhttp.send();
}



function itemCalc()
{
	
		quan = parseFloat(document.getElementById('quantity').value);
		if (quan > 24 &! isNaN(document.getElementById('quantity').value))
		{
		
			//do calculation
			var pricePer = 0;
			pricePer = parseFloat(document.getElementById('frontColor').value) + parseFloat(document.getElementById('backColor').value) + parseFloat(document.getElementById('shirt').value);
			
			//discount stuff
			if (quan > 49)
			{
				if (quan < 100)
					pricePer = pricePer - 1;
				else if (quan < 200)
					pricePer = pricePer - 2;
				else if (quan < 500)
					pricePer = pricePer - 2.5;
				else
					pricePer = pricePer - 2.75;
			}
			
			totalPrice = pricePer * quan;
			document.getElementById('totalPrice').value = totalPrice.toFixed(2);
			document.getElementById('perShirt').value = pricePer.toFixed(2);
		}
		else
		{
			document.getElementById('totalPrice').value = "";
			document.getElementById('perShirt').value = "";
		}
	
}
