var xmlHttp;
function goURL(xmlHttp,url)
{
		xmlHttp.open("get",url,true);
		xmlHttp.send();
}
function showCountryRegion(regionId)
{ 
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
	    {
		  alert ("Your browser does not support AJAX!");
		  return;
		} 
		var url="addsize.asp";
			url=url+"?Design="+regionId;
			
			xmlHttp.onreadystatechange=addState;
			goURL(xmlHttp,url);
}



function addState() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		clearState();
		var pink;
		
		pink=xmlHttp.responseText;
		
				
		if((xmlHttp.responseText != 'No Size Available'))
		{
			var contryList=pink;
		
			var country_divide=contryList.split('*');
			
			var names=country_divide[0];
			var values=country_divide[1];
			
			var spltName=names.split('|');
			var spltValue=values.split('|');
			
			var i;	
			var countryR=document.getElementById('s');
			for(i=0;i< spltName.length-1;i++)
			{
				var optR=document.createElement('option');
				
				optR.text=spltName[i];
				optR.value=spltValue[i];
			
			countryR.options[countryR.options.length]=optR;
			}
		}
		else
		{
			
			for(i=countryR.options.length-1;i>0;i--)
			{
				countryR.remove(i);
			}	
	
			var optR=document.createElement('option');
			optR.text='No Size Available';
			optR.value='-1';	
				
			countryR.options[1]=optR;
			countryR.options[1].selected=true;
		}
	}
}


function clearState()
{
		var state,k;		
		state=document.getElementById('s');
		k=state.options.length;		
		if(k > 2)
		{
			for(i=2;i<=k;i++)
			{
				state.remove(i);
			}
		}
}


function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}
