
function getXmlHttpRequestObject() {
	if (window.XMLHttpRequest) {
		return new XMLHttpRequest();
	} else if(window.ActiveXObject) {
		return new ActiveXObject("Microsoft.XMLHTTP");
	} else {
		alert("You must upgrade your browser to use this feature.");
	}
}

var ChartReq = getXmlHttpRequestObject();


function PopulateSizeChart(PID,ChartType,Chest,Waist,Hips,Height,Weight,Cup)
	{
	if(PID == undefined) { PID = ''; }		
	if(ChartType == undefined) { ChartType = ''; }
	if(Chest == undefined) { Chest = ''; }
	if(Waist == undefined) { Waist = ''; }
	if(Hips == undefined) { Hips = ''; }
	if(Height == undefined) { Height = ''; }
	if(Weight == undefined) { Weight = ''; }
	if(Cup == undefined) { Cup = ''; }
		
	if (ChartReq.readyState == 4 || ChartReq.readyState == 0) {
		var reqstring = '/sizecharts/ajaxsizechart.php?PID=' + PID + '&ChartType=' + ChartType + '&Chest=' + Chest + '&Waist=' + Waist + '&Hips=' + Hips + '&Height=' + Height + '&Weight=' + Weight + '&Cup=' + Cup;
		ChartReq.open("GET", reqstring, true);
		ChartReq.onreadystatechange = handleList; 
		ChartReq.send(null);
//		alert(reqstring);
	}		
}

//Called when the AJAX response is returned.
function handleList() {
	if (ChartReq.readyState == 4) {
		var ss = document.getElementById('SizeChart');
		ss.innerHTML = ChartReq.responseText;
//		var str = ChartReq.responseText;
//		ss.innerHTML = str;
	}
}

function GetValue(ElementID) 
	{
	var thisval = document.getElementById(ElementID).value;
	return thisval;
	}
function GetValueChecked(ElementID) 
	{
	var thisval = '';
	var radios = document.getElementById (ElementID);
	if (radios)
		{
		var inputs = radios.getElementsByTagName ('input');
		if (inputs)
			{
    		for (var i = 0; i < inputs.length; ++i)
				{
      			if (inputs[i].checked)
      				{
					thisval = inputs[i].value;
      				}
    			}
  			}
		}	
	return thisval;
}	




