/**
 * @author user
 */
	var xmlHttp;
	function chk_selected()
	{
		if(document.getElementById('color').value == '')
		{
			document.getElementById('stock_err').style.display = '';
			document.getElementById('stock_err').innerHTML = 'Please select any colour';
			document.getElementById('color').value = '';
			return false;
		}
		else if(document.getElementById('size').value == '')
		{
			document.getElementById('stock_err').style.display = '';
			document.getElementById('stock_err').innerHTML = 'Please select any size';
			document.getElementById('size').value = '';
			return false;			
		}
		else
		{
			document.getElementById('stock_err').style.display = 'none';
			return true;
		}
	}
	
	function chk_existed1()
	{
		xmlHttp = GetXmlHttpObject()
		if (xmlHttp == null) {
			alert('browser do not support your request.')
			return
		}
		
		var url = "ajax-php/stock_available.php?color=" + document.getElementById("color").value + "&prodid=" + document.getElementById('prodid').value + "&mode=1";
		
		xmlHttp.onreadystatechange = tango1;
		xmlHttp.open("GET", url, true);
		xmlHttp.send(null);
	}
	
	function chk_existed2()
	{
		xmlHttp = GetXmlHttpObject()
		if (xmlHttp == null) {
			alert('browser do not support your request.')
			return
		}
		
		var url = "ajax-php/stock_available.php?size=" + document.getElementById("size").value + "&prodid=" + document.getElementById('prodid').value + "&mode=2";
		
		xmlHttp.onreadystatechange = tango2;
		xmlHttp.open("GET", url, true);
		xmlHttp.send(null);
	}
	
	function tango1() 
	{ 
		if (xmlHttp.readyState==4)
		{ 
			if (xmlHttp.responseText) {
				document.getElementById("size_div").innerHTML = xmlHttp.responseText;
			}
		}
	}
	
	function tango2() 
	{ 
		if (xmlHttp.readyState==4)
		{ 
			if (xmlHttp.responseText) {
				document.getElementById("color_div").innerHTML = xmlHttp.responseText;
			}
		}
	}
	
	
	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;
	}

