function cart_add(p_id,q)  

 {  

	
		 $.ajax({  

	         type: "GET",  

	         dataType: "text",  

	         cache: false,  

	         url: 'ajax.php?action=cart_add&p_id=' + p_id +'&q='+q,  

	         timeout: 3000,  

	         error: function (XMLHttpRequest, textStatus, errorThrown) {

				  // typically only one of textStatus or errorThrown 

				  // will have info

				 // alert(XMLHttpRequest+' '+textStatus + ' ' +errorThrown);

				  this; // the options for this ajax request

				},  

	         success: function(data) {   

	             // Clear  

				

				$("#yourcart").html(data);

				

				var new_q;

				if (q==0) q=1;

				

				var t=$("#cart_value_"+p_id).html();

				var s= t.indexOf("(")+1;

				var l= t.indexOf(")")-s;

				//alert($("#cart_value_"+p_id).html()+' '+s+' '+t.indexOf(")")+' '+l);

				new_q = t.substr(s,l);

				

				new_q = parseInt(new_q)+parseInt(q);

				

				if (new_q<10){

					new_q_text = '&nbsp;&nbsp;(';

				} else {

					if (new_q<100)

						new_q_text = '(';

					else

						new_q_text = '(';

				}

				var new_q_text = new_q_text+new_q+')';

				$("#cart_value_"+p_id).html(new_q_text);

				

				if ($("#yourcart").length==0){
					//POPUP - Added to Cart - disabled
					//$("#prods_added").css({ 'top': mouseY-90, 'left': mouseX-200});

					//$("#prods_added").fadeIn("slow");
				}
				

	            // $("#"+sale+id).html('<a class="love_this">You LOVE this</a>');  

	              

	             // Set the selected value  

	            //$("select#county").val(selected);  

	         }  

	     });  

	

 } 

 

 function get_brands(c)  

 {  

	

		 $.ajax({  

	         type: "GET",  

	         dataType: "json",  

	         cache: false,  

	         url: 'ajax.php?action=get_brands&c='+c,  

			

	         timeout: 3000,  

	         error: function (XMLHttpRequest, textStatus, errorThrown) {

				  // typically only one of textStatus or errorThrown 

				  // will have info

				  alert(XMLHttpRequest+' '+textStatus + ' ' +errorThrown);

				  this; // the options for this ajax request

				},  

	         success: function(data) {   

	             // Clear  

				//alert(data);

				$("select#brand_filter option").remove();  

	              

				 $.each(data, function(i, j){  

					if (j.value!='undefined'){

		                var row = "<option value=\"" +  j.value +  "\">" +  j.text +  "</option>";  

						

		                $(row).appendTo("select#brand_filter");  

					}

	             });  

				

				 

	         }  

	     });  

	

 } 

