var xmlHttp

function CompareProduct(str)
{



  xmlHttp=GetXmlHttpObject();

  if (xmlHttp==null)
  {
	alert ('Your Browser Doesn\'t Support Comparison.');
	return;
  }
  
 
  var url='readycompare.aspx';


  if(document.getElementById(str).checked == true)
  {
    url=url+'?ProductID='+str+'&Method=select&Check=Checked';
  }
  if(document.getElementById(str).checked == false)
  {
    url=url+'?ProductID='+str+'&Method=delete';
  }
  xmlHttp.onreadystatechange=function()
  {
    if (xmlHttp.readyState==4)
    { 
      if(xmlHttp.status==200)
      {
          if(xmlHttp.responseText.indexOf('FULL') > -1)
          {
              alert('You have previously selected three products to compare. Please remove one or more products from your comparison to continue.');
              document.getElementById(str).checked = false;
              var back = xmlHttp.responseText;
			  var ccid = back.substring(back.indexOf('(('),back.indexOf('))')+2);
			  var ccidmodify = ccid.replace('((','').replace('))','').replace(/,/g,'-')
			  window.location.href = "CompareProduct.aspx?CPID="+ccidmodify+"%%";
          }
      }
    }
  }

  xmlHttp.open("GET",url,true);

  xmlHttp.send(null);

}


function GetXmlHttpObject()
{
  var xmlHttp=null;
  try
  {
					
	xmlHttp=new XMLHttpRequest();
  }
  catch (e)
  {
	// Internet Explorer
	try
	{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch (e)
	{
	xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
  }
  return xmlHttp;
}


				