function aj_addCart(id,qty,feature,set)
{
    if (qty=='' || typeof(qty)=='undefined')
      qty=1;
    if (typeof(feature)=='undefined')
      feature='';
    if (typeof(set)=='undefined')
      set='n';
    querypage='/devlive/scadd.php?id='+id+'&qty='+qty+'&feature='+feature+'&set='+set;
    var ajaxRequest;  // The variable that makes Ajax possible!
    if(window.ActiveXObject)
       ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
    else
      if(window.XMLHttpRequest)
        ajaxRequest = new XMLHttpRequest();
      else
        return false;
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
          try
            {
               var xmlDoc=document.implementation.createDocument("","",null);
               parser=new DOMParser();
               if (ajaxRequest.responseText.length >0)
               {
                 xmlDoc=parser.parseFromString(ajaxRequest.responseText,"text/xml");
                 car = xmlDoc.getElementsByTagName('product');
                 if (car[0].getAttribute('id')=='200')
                 {
		     scnt=car[0].getAttribute('scnt')*1.0;
		     if (document.getElementById('scnt'))
		       document.getElementById('scnt').innerHTML=scnt;
		     alert('Added to cart successfully');					 
		     document.getElementById('carttext').style.display='block';
		     document.getElementById('cartwrapper').style.display='block';				   
                 }
                 else
                 {
                    if (car[0].hasChildNodes())
		       alert(car[0].firstChild.nodeValue);
                 }
     	      }
            }
            catch (e)
            {
              try
              {
                var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
                xmlDoc.async=false;
                if (ajaxRequest.responseText.length >0)
                {
                  xmlDoc.loadXML(ajaxRequest.responseText);
                 car = xmlDoc.getElementsByTagName('product');
                 if (car[0].getAttribute('id')=='200')
                 {
		     scn=car[0].getAttribute('scnt')*1.0;
		     if (document.getElementById('scnt'))		     
  		       document.getElementById('scnt').innerHTML=scn;
		     alert('Added to cart successfully');					 
		     document.getElementById('carttext').style.display='block';
		     document.getElementById('cartwrapper').style.display='block';				   
                 }
	         else
                 {
                    if (car[0].hasChildNodes())
		       alert(car[0].firstChild.nodeValue);
                 }
                }
              }
              catch (e)
              {
              }
            }
         }
	}
	ajaxRequest.open("GET", querypage, true);
	ajaxRequest.send(null);
}

function aj_getDiscount(code)
{
    querypage='/devlive/getdiscount.php?code='+code;
    var ajaxRequest;  // The variable that makes Ajax possible!
    if(window.ActiveXObject)
       ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
    else
      if(window.XMLHttpRequest)
        ajaxRequest = new XMLHttpRequest();
      else
        return false;
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
          try
            {
               var xmlDoc=document.implementation.createDocument("","",null);
               parser=new DOMParser();
               if (ajaxRequest.responseText.length >0)
               {
                 xmlDoc=parser.parseFromString(ajaxRequest.responseText,"text/xml");
                 car = xmlDoc.getElementsByTagName('discount');
                 if (car)
                 {
                     dpercent=car[0].getAttribute('dpercent');
                     if (dpercent!='' && dpercent>0)
                     {
                       stotal=document.getElementById('ttotal').value*1.0;
                       discount=Math.round(dpercent*stotal)/100;
		       document.getElementById('dscnt').innerHTML='Discount:';                       
                       document.getElementById('discount_total').innerHTML='$'+discount;                       
                       stotal=stotal-discount;                                              
                       stotal=(Math.round(stotal*100))/100;
                       document.getElementById('subtotal').innerHTML=stotal;
                       
                     }
                     else
                     {
                       stotal=document.getElementById('ttotal').value*1.0;
                       discount=car[0].getAttribute('ddollars');
		       document.getElementById('dscnt').innerHTML='Discount:';
                       document.getElementById('discount_total').innerHTML='$'+discount;                       
                       stotal=stotal-discount;                                              
                       stotal=(Math.round(stotal*100))/100;
                       document.getElementById('subtotal').innerHTML=stotal;                       
                     }
                 }
               }
            }
            catch (e)
            {
              try
              {
                var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
                xmlDoc.async=false;
                if (ajaxRequest.responseText.length >0)
                {
                  xmlDoc.loadXML(ajaxRequest.responseText);
                 car = xmlDoc.getElementsByTagName('discount');
                 if (car)
                 {
                     dpercent=car[0].getAttribute('dpercent');
                     if (dpercent!='' && dpercent>0)
                     {
                       stotal=document.getElementById('ttotal').value*1.0;
                       dscount=(dpercent*stotal)/100;
		       document.getElementById('dscnt').innerHTML='Discount:';                       
                       document.getElementById('discount_total').innerHTML='$'+dscount;                       
                       stotal=stotal-dscount;                                              
                       stotal=(Math.round(stotal*100))/100;
                       document.getElementById('subtotal').innerHTML=stotal;
                       
                     }
                     else
                     {
                       stotal=document.getElementById('ttotal').value*1.0;
                       dscount=car[0].getAttribute('ddollars');
		       document.getElementById('dscnt').innerHTML='Discount:';                       
                       document.getElementById('discount_total').innerHTML='$'+dscount;                       
                       stotal=stotal-dscount;                                              
                       stotal=(Math.round(stotal*100))/100;
                       document.getElementById('subtotal').innerHTML=stotal;                       
                     }
                 }
                }
              }
              catch (e)
              {
              }
            }
         }
	}
	ajaxRequest.open("GET", querypage, true);
	ajaxRequest.send(null);
}

