// JavaScript Document
function ViewCountry(a)
{
	if (document.getElementById(a).style.display=='none')
	$('#'+a).fadeIn('slow');
	else $('#'+a).fadeOut('slow');
}
function AddShop(e)
{ 
 divx =document.getElementById("listCart2");
		  $.ajax({
			   type: "POST",
			   url: "/addShop.php",
			   data: "uid="+e+"&type=add&",
			   datatype:"html",
			   success: function(html){
				  divx.innerHTML=html;
			   },
			   complete: function(){
				$('#listCar').fadeIn('slow');
				$('#shop').fadeIn('slow');		
				$('#btnExplode').hide();
				$('#btnImplode').show();
				scroll(0,0);
					  divy = document.getElementById("expCount");
					  divz = document.getElementById("impCount");
			
						$.ajax({
						   type: "POST",
						   url: "/countCatalog.php",
						   success: function(html){
							divy.innerHTML=html;
							divz.innerHTML=html;
							}});
			   }
			 });
			
						$.ajax({
						   type: "POST",
						   url: "/explodeImplode.php",
						   data: "uid=0&"});
}//END AddShop

function AddShop2(e,f)
{
sw=true;
	//is_validate (e, valType, nameClass, nameClassError, isRequired, msgRequired, msgErrorType)
	sw = is_validate('quantity'+e, 'number', '', 'inputError', true, '(*) Campo requerido', '(*) Ingresar número');
	if (sw)
{
 divx =document.getElementById("listCart2");
 qty = document.getElementById("quantity"+e).value;
		 if (qty>f) f=qty;
		  $.ajax({
		   type: "POST",
		   url: "/addShop.php",
		   data: "uid="+e+"&type=add&qty="+ f +"",
		   datatype:"html",
		   success: function(html){
			  divx.innerHTML=html;
		   },
		   complete: function(){
			$('#listCar').fadeIn('slow');
			$('#shop').fadeIn('slow');		
			$('#btnExplode').hide();
			$('#btnImplode').show();
			scroll(0,0);
				  divy = document.getElementById("expCount");
				  divz = document.getElementById("impCount");
		
					$.ajax({
					   type: "POST",
					   url: "/countCatalog.php",
					   success: function(html){
						divy.innerHTML=html;
						divz.innerHTML=html;
						}});
		   }
		 });
		
					$.ajax({
					   type: "POST",
					   url: "/explodeImplode.php",
					   data: "uid=0&"});
}
}//END AddShop
function UpdateShop(e)
{
	if (e==1)
	document.frmCartShop.vOk.value='Ok';
	if (e==2)
	document.frmCartShop.vOk.value='OkC';
	if (e==3)
	document.frmCartShop.vOk.value='OkCh';
	
	document.frmCartShop.submit();
}//END UpdateShop