function addtocart(product_id,base_path,theme,count) {	
	//alert (1);
	if(count!=1){
		var values = document.getElementById('qty').value;	
		
		if(values!=0)
		{
			document.getElementById('error_info').style.display= "none";
			document.getElementById('number_info').style.display= "block";
			
			var i;
			for (i = 0; i < values.length; i++)
			 {
				var c = values.charAt(i);
				 if (((c < "0") || (c > "9"))){
					 jQuery("#number_info").html("Please Enter Numbers Only");
					 return false;
				 }
				 else{
					 document.getElementById('number_info').style.display= "none";
				 }				 
			 }		
		}
		else {
					
			document.getElementById('error_info').style.display= "block";
			document.getElementById('number_info').style.display= "none";
			jQuery("#error_info").html("Please Enter Product Quantity");
		    post_file = base_path+"product/view/id/"+product_id;
		    jQuery("#qty").focus();
		    return false;
		}	
		count = values;
	}
	
	
	
	jQuery("#shoppingbag").html("<div align='center'><img src='"+base_path+"images/ajax-loader.gif'></div>");
    post_file = base_path+"product/addcart/id/"+product_id+"/count/"+count;
	alert ('Item added to cart.');
    jQuery.post(post_file, { },
        function(data)
            {
    			jQuery("#shoppingbag").html(data);
            }
        );
		//location.href= base_path+"product/cart";
}

// Quote Add
function addtoquote(product_id,base_path,theme,count) {	
	//alert (1);
	if(count!=1){
		var values = document.getElementById('qty').value;	
		
		if(values!=0)
		{
			document.getElementById('error_info').style.display= "none";
			document.getElementById('number_info').style.display= "block";
			
			var i;
			for (i = 0; i < values.length; i++)
			 {
				var c = values.charAt(i);
				 if (((c < "0") || (c > "9"))){
					 jQuery("#number_info").html("Please Enter Numbers Only");
					 return false;
				 }
				 else{
					 document.getElementById('number_info').style.display= "none";
				 }				 
			 }		
		}
		else {
					
			document.getElementById('error_info').style.display= "block";
			document.getElementById('number_info').style.display= "none";
			jQuery("#error_info").html("Please Enter Product Quantity");
		    post_file = base_path+"product/view/id/"+product_id;
		    jQuery("#qty").focus();
		    return false;
		}	
		count = values;
	}
	
	
	
	jQuery("#quotebag").html("<div align='center'><img src='"+base_path+"images/ajax-loader.gif'></div>");
    post_file = base_path+"product/addtoquote/id/"+product_id+"/count/"+count;
	alert ('Item added to Quote Cart.');
    jQuery.post(post_file, { },
        function(data)
            {
    			jQuery("#quotebag").html(data);
            }
        );
		//location.href= base_path+"product/cart";
}

function getstate(country_id,base_path) {	
	//alert (country_id);
		
	jQuery("#state_id").html("<div align='center'><img src='"+base_path+"images/ajax-loader.gif'></div>");
    post_file = base_path+"order/getstate/id/"+country_id;
    jQuery.post(post_file, { },
        function(data)
            {
    			jQuery("#state_id").html(data);
            }
        );
		//location.href= base_path+"product/cart";
}

function getstate1(country_id,base_path) {	
	//alert (country_id);
		
	jQuery("#state_id1").html("<div align='center'><img src='"+base_path+"images/ajax-loader.gif'></div>");
    post_file = base_path+"customer/getstate/id/"+country_id;
    jQuery.post(post_file, { },
        function(data)
            {
    			jQuery("#state_id1").html(data);
            }
        );
		//location.href= base_path+"product/cart";
}

function removerecent(base_path) {	
	//alert (base_path);
		
	jQuery("#recentview").html("<div align='center'><img src='"+base_path+"images/ajax-loader.gif'></div>");
    post_file = base_path+"product/removerecent";
	//alert (post_file);
    jQuery.post(post_file, { },
        function(data)
            {
    			jQuery("#recentview").html(data);
            }
        );
		//location.href= base_path+"product/cart";
}

function getstatecart(country_id,base_path) {	
	//alert (idpath);
		
	jQuery("#state_id").html("<div align='center'><img src='"+base_path+"images/ajax-loader.gif'></div>");
    post_file = base_path+"product/getstate/id/"+country_id;
	//alert (post_file);
    jQuery.post(post_file, { },
        function(data)
            {
		//alert (data);
    			jQuery("#state_id").html(data);
            }
        );
	
		//location.href= base_path+"product/cart";
}
function getstatecart1(country_id,base_path) {	
	//alert (idpath);
		
	jQuery("#state_id1").html("<div align='center'><img src='"+base_path+"images/ajax-loader.gif'></div>");
    post_file = base_path+"product/getstate/id/"+country_id;
	
    jQuery.post(post_file, { },
        function(data)
            {
    			jQuery("#state_id1").html(data);
            }
        );
	
		//location.href= base_path+"product/cart";
}
function getstate1(country_id,base_path) {	
	//alert (1);
		
	jQuery("#state_id").html("<div align='center'><img src='"+base_path+"images/ajax-loader.gif'></div>");
    post_file = base_path+"order/getstate/id/"+country_id;
    jQuery.post(post_file, { },
        function(data)
            {
    			jQuery("#state_id1").html(data);
            }
        );
		//location.href= base_path+"product/cart";
}

function removecart(product_id,base_path,change) {
	//alert (change);
	if(change!=1){
	jQuery("#shoppingbag").html("<div align='center'><img src='"+base_path+"images/ajax-loader.gif'></div>");
	}
	//alert (base_path+"product/addcart/id/"+product_id+"/remove/1");
	/*if(change==1){
		//post_file = base_path+"product/addcart/id/"+product_id+"/remove/1/cart/1";
		location.href=base_path+"product/addcart/id/"+product_id+"/remove/1/cart/1";
	}*/
    post_file = base_path+"product/addcart/id/"+product_id+"/remove/1";
    jQuery.post(post_file, { },
        function(data)
            {
    			jQuery("#shoppingbag").html(data);
            }
        );
		if (change==1)
		{
			//location.href=base_path+"product/cart";
				location.href=base_path+"product/addcart/id/"+product_id+"/remove/1/cart/1";
		}
}

function removequote(product_id,base_path,change) {
	//alert (change);
	if(change!=1){
	jQuery("#quotebag").html("<div align='center'><img src='"+base_path+"images/ajax-loader.gif'></div>");
	}
	//alert (base_path+"product/addcart/id/"+product_id+"/remove/1");
	/*if(change==1){
		//post_file = base_path+"product/addcart/id/"+product_id+"/remove/1/cart/1";
		location.href=base_path+"product/addcart/id/"+product_id+"/remove/1/cart/1";
	}*/
    post_file = base_path+"product/addtoquote/id/"+product_id+"/remove/1";
    jQuery.post(post_file, { },
        function(data)
            {
    			jQuery("#quotebag").html(data);
            }
        );
		if (change==1)
		{
			//location.href=base_path+"product/cart";
				location.href=base_path+"product/addcart/id/"+product_id+"/remove/1/cart/1";
		}
}

function addtocartsimple(product_id,base_path,theme,simplecount) {
	
	
	
			var values = document.getElementById('simpleqty['+simplecount+']').value;
			if(values!=0)
			{
				document.getElementById('error_info').style.display= "none";
				document.getElementById('number_info').style.display= "block";
				
				var i;
				for (i = 0; i < values.length; i++)
				 {
					var c = values.charAt(i);
					 if (((c < "0") || (c > "9"))){
						 jQuery("#number_info").html("Please Enter Numbers Only");
						 return false;
					 }
					 else{
						 document.getElementById('number_info').style.display= "none";
					 }				 
				 }		
			}
			
			else {
				
					document.getElementById('error_info').style.display= "block";
					document.getElementById('number_info').style.display= "none";
					jQuery("#error_info").html("Please Enter Product Quantity");
				    post_file = base_path+"product/view/id/"+product_id;
				    jQuery("#simpleqty["+simplecount+"]").focus();
				    return false;
			     }				
		   
	
			count = values;
			jQuery("#shoppingbag").html("<div align='center'><img src='"+base_path+"frontend/themes/default/images/ajax-loader.gif'></div>");
		    post_file = base_path+"product/addcart/id/"+product_id+"/count/"+count;
		    jQuery.post(post_file, { },
		        function(data)
		            {
		    			jQuery("#shoppingbag").html(data);
		            }
		        );
      
		
		
}	
	
function test(id,stat){
//alert (1);
if(stat==1){
document.getElementById(id).style.display="block";
}else{
document.getElementById(id).style.display="none";
}
}

 function loadPage(str) {
 window.location =str;
}

