$(document).ready(function(){

	$(".contenedor .eliminar").click(function(){
		$(this).parents(".contenedor").animate({ opacity: 'hide' }, "slow");
	});

});


function objetoAjax(){
 var xmlhttp=false;
  try{
   xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  }catch(e){
   try {
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
   }catch(E){
    xmlhttp = false;
   }
  }
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
   xmlhttp = new XMLHttpRequest();
  }
  return xmlhttp;
}


function envio(pagina,totf){
	$("#envio").hide();
	$("#envio").slideDown();	 
     divContenido = document.getElementById('envio');
     ajax=objetoAjax();
     ajax.open("GET", "enviosup.php?arts="+pagina+"&totf="+totf);
	 //divContenido.innerHTML= '<center><img src="images/loading.gif"></center>'; 	 
     ajax.onreadystatechange=function() {
      if (ajax.readyState==4) {
           divContenido.innerHTML = ajax.responseText;
		   status();
      }	  
 }
 ajax.send(null) 
}

function envio_pago(a,b,c,d){
	$("#envio").hide();
	$("#envio").slideDown();	 
     divContenido = document.getElementById('envio');
     ajax=objetoAjax();
     ajax.open("GET", "envios_pagos.php?a="+a+"&b="+b+"&c="+c+"&d="+d);
	 //divContenido.innerHTML= '<center><img src="images/loading.gif"></center>'; 	 
     ajax.onreadystatechange=function() {
      if (ajax.readyState==4) {
           divContenido.innerHTML = ajax.responseText;
		   statuscar(3);
      }	  
 }
 ajax.send(null) 
}


function envio2(){
	$("#envio").slideUp();	
	location.href = 'carrito.php';
}


function botoncpago(){
     divContenido = document.getElementById('botoncpago');
     ajax=objetoAjax();
     ajax.open("GET", "js/botoncpago.php");
	 //divContenido.innerHTML= '<center><img src="images/loading.gif"></center>'; 	 
     ajax.onreadystatechange=function() {
      if (ajax.readyState==4) {
           divContenido.innerHTML = ajax.responseText;
		   statuscar(4);
      }	  
 }
 ajax.send(null) 
}

function statuscar(id){
     divContenido = document.getElementById('statuscart');
     ajax=objetoAjax();
     ajax.open("GET", "js/status.php?id="+id);
	// divContenido.innerHTML= '<img src="images/c1.jpg">; 	 
     ajax.onreadystatechange=function() {
      if (ajax.readyState==4) {
           divContenido.innerHTML = ajax.responseText;
      }
 }
 ajax.send(null)
}


function status(){
     divContenido = document.getElementById('statuscart');
     ajax=objetoAjax();
     ajax.open("GET", "js/status2.php");
	// divContenido.innerHTML= '<img src="images/c1.jpg">; 	 
     ajax.onreadystatechange=function() {
      if (ajax.readyState==4) {
           divContenido.innerHTML = ajax.responseText;
      }
 }
 ajax.send(null)
}


function mosesp(){
     divContenido = document.getElementById('mosesp');
     ajax=objetoAjax();
     ajax.open("GET", "mosesp.php");
	// divContenido.innerHTML= '<img src="images/c1.jpg">; 	 
     ajax.onreadystatechange=function() {
      if (ajax.readyState==4) {
           divContenido.innerHTML = ajax.responseText;
      }
 }
 ajax.send(null)
}

function categorias(id){
     divContenido = document.getElementById('divcats');
     ajax=objetoAjax();
     ajax.open("GET", "cats.php?id="+id);
	//divContenido.innerHTML= '<center><img src="images/loading.gif"></center>'; 	 
     ajax.onreadystatechange=function() {
      if (ajax.readyState==4) {
           divContenido.innerHTML = ajax.responseText;
		   //imgcatalogo(id);
      }
 }
 ajax.send(null)
}



function imgcatalogo(id){
     divContenido = document.getElementById('bannerprincipalcatalogo');
     ajax=objetoAjax();
     ajax.open("GET", "bannercatalogo.php?id="+id);
	//divContenido.innerHTML= '<center><img src="images/loading.gif"></center>'; 	 
     ajax.onreadystatechange=function() {
      if (ajax.readyState==4) {
           divContenido.innerHTML = ajax.responseText;
      }
 }
 ajax.send(null)
}

function revisaruser(us){
     divContenido = document.getElementById('revisaruser');
     ajax=objetoAjax();
     ajax.open("GET", "revisaruser.php?blogin="+us);
	 divContenido.innerHTML= '<center><img src="images/loading2.gif"></center>'; 	 	 
     ajax.onreadystatechange=function() {
      if (ajax.readyState==4) {
           divContenido.innerHTML = ajax.responseText;
      }
 }
 ajax.send(null)
}



function sclick(id){
	location.href = 'catalogo.php?catalogo='+id;
}

function verif(val){
		if(val==""){
			alert('Por favor llene el campo anterior.');
			}
			
	}
function verif2(val){
		if(val==""){
			alert('Por favor ingrese el codigo de seguridad.');
			}
			
	}	
function terminos(val){
		if(val=="off"){
			alert('Por favor acepte los Términos y Condiciones.');
			}
			
	}	
	

