
/******** Checking the availability of quantity****************/

//var url = "usernameAvailability.php?username=&tye="; // The server-side script

function IsEmpty(s) {
	return /^\s*$/.test(IsEmpty.arguments[0]);
}



function handleHttpResponse() 
 {   
   if (http.readyState == 4) 
   {
     if(http.status==200) 
	 {
       var results=http.responseText;
	   document.getElementById('availability').innerHTML = results;
	     //alert(results);

	     if( !IsEmpty(results) ){
			
				 document.getElementById("add2cart").style.display = "none";
				 document.getElementById("availability").style.display = "block";
		 } else { 
		
				 document.getElementById("add2cart").style.display = "block";
				 document.getElementById("availability").style.display = "none";
		 }



       }
 
	 }
 
 } 
  
  
 function checkAvailability(prdId,catId,cartID,cartQty) {

	 //alert(cartID);
 colorbox = document.pDeatilsFrm.pColorCmbo.value;
 sleevbox = document.pDeatilsFrm.pSLCmbo.value;
 sizebox = document.pDeatilsFrm.pSizeCmbo.value;
 qtybox = document.pDeatilsFrm.pQty.value;
 //alert(qtybox);
 http.open("GET", "quantityAvailability.php?color="+colorbox+"&sleev="+sleevbox+"&size="+sizebox+"&quantity="+qtybox+"&prd_Id="+prdId+"&cat_Id="+catId+"&cart_Id="+cartID+"&cart_qty="+cartQty, true);
  http.onreadystatechange = handleHttpResponse;
  http.send(null); 
 }
 
 function getHTTPObject() {
  var xmlhttp;

  if(window.XMLHttpRequest){
    xmlhttp = new XMLHttpRequest();
  }
  else if (window.ActiveXObject){
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    if (!xmlhttp){
        xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
   
  }
  return xmlhttp;

 
}
var http = getHTTPObject(); // We create the HTTP Object


/******************* Validating Persoandetails Form***************/


