function process_response(prdurl)
{
 data = http_request.responseText;
   

  try{
	if (typeof(data) == 'string') eval('resp = ' + data);
    document.getElementById('items').innerHTML = resp.links;
    hideProgressAnimation();
     showConfirmDialog();
	}catch(e)
    {
        hideProgressAnimation();
	location.href=prdurl;
	}
}

 function list_cart(prdurl)
	    {

   		url = prdurl ;
//	alert("url"+url);
	showProgressAnimation();

			http_request=null;
		if (window.XMLHttpRequest)
		  {// code for Firefox, Opera, IE7, etc.
		  http_request=new XMLHttpRequest();
		  }
		else if (window.ActiveXObject)
		  {// code for IE6, IE5
		  http_request=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		if (http_request!=null)
		  {
			http_request.open( "GET", url, true);



			http_request.onreadystatechange=function()
		{
        
									if ( http_request.readyState == 4 ) {
						if ( http_request.status == 200 ) {
                        
									process_response(url);
									} else {
							alert( "There was a problem with the URL." );
							
						}

						}
		}
			http_request.send(null);

		 }
		 else
		 {
			alert("Ajax is not supported");
			document.getElementById('cart_loader').innerHTML='';
		 }

		if(document.body.style.cursor == "wait")
			document.body.style.cursor="default";

		}

function post_form()

{

showProgressAnimation();
var form = jQuery('#product_addtocart_form');
var inputs = jQuery(':input').serialize();
jQuery.post(form.get(0).action+"?isAjax=1", inputs, function (data, textStatus) {


try{
	if (typeof(data) == 'string') eval('resp = ' + data);
     document.getElementById('items').innerHTML = resp.links;
    hideProgressAnimation();
     showConfirmDialog();
	}catch(e)
    {
        hideProgressAnimation();
	form.submit();
	}






});

}
function continue_shop()
{

   document.getElementById('ajaxcartpro_confirm').style.display='none';
    document.getElementById('fade').style.display = 'none';
}
function showProgressAnimation(){
        document.getElementById('fade').style.display = 'block';
	var pW = 260;
	var pH = 50;
	p = document.getElementById('ajaxcartpro_progress');
	if(typeof p.length == 'number'){
		p = p[0]
	}
	p.style.width = pW + 'px';
	p.style.height = pH + 'px';
	p.style.position = 'fixed';
    p.style.top = (screen.height/2) - (pH) + 'px';
  
		p.style.display = 'block';


}


function showConfirmDialog(){
   document.getElementById('fade').style.display = 'block';
	var pW = 260;
	var pH = 104;
		p = document.getElementById('ajaxcartpro_confirm');
	p.style.width = pW + 'px';
	p.style.height = pH + 'px';
    p.style.position = 'fixed';
    p.style.top = (screen.height/2) - (pH) + 'px';

	p.style.display = 'block';

}

function hideProgressAnimation(){
	document.getElementById('ajaxcartpro_progress').style.display = 'none';
    document.getElementById('fade').style.display = 'none';
}
