
function checkEnter(e,idf){ 
//e is event object passed from function invocation
var characterCode; //literal character code will be stored in this variable

if(e && e.which){ //if which property of event object is supported (NN4)
e = e;
characterCode = e.which; //character code is contained in NN4's which property
}
else{
e = event;
characterCode = e.keyCode; //character code is contained in IE's keyCode property
}

if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
alert(idf);
}
}

	 String.prototype.Trim = function(){
      return this.replace(/\s+$|^\s+/g,""); 
  }
  
	function price_vali(precio){
	/*precio = precio.replace('$','');*/
	precio = precio.Trim();

	if (!/^([0-9,.])*$/.test(precio)){
	return "0.00"; 
		}
	else{
	return precio;
		}
	}
	
function alecar(idt){
	 var req = new Request({
              method: 'post',
              url: '../classes/db_cart/db_cart_continue.php',
              data: $(idt),
			  onRequest: function() { $('carajax').set('html','<img src="../images/blueload.gif">'); },
              onComplete: function(response) { 	carajax();  }
          }).send();

}

function carajax(){
 var req = new Request({
              method: 'get',
              url: '../carajax.php',
              //data: { 'do' : '1' },
              //onRequest: function() { alert('The request has been made, please wait until it has finished.'); },
			  onRequest: function() { $('carajax').set('html','<img src="../images/blueload.gif">'); },
              onComplete: function(response) { $('carajax').set('html',response); }
			  //update: $('carajax');
          }).send();
}

function vaciarcarro(){
	
		 var req = new Request({
              method: 'get',
              url: '../classes/db_cart/db_cart_checkout_example.php',
              data: { 'action' : 'cancel' },
              onRequest: function() { $('carajax').set('html','<img src="../images/blueload.gif">'); },
              onComplete: function(response) { carajax(); }
			  //update: $('carajax');
          }).send();
}

function confirmate(){
	 var req = new Request({
              method: 'get',
              url: '../sesmail.php',
              //data: { 'action' : 'cancel' },
              //onRequest: function() { $('carajax').set('html','<img src="../images/blueload.gif">'); },
              onComplete: function(response) { var valmail = response; 
	
//var valmail = '<? if (isset($_SESSION['email'])){echo $_SESSION['email'];} ?>';
if (valmail != 'n'){
window.location="http://ediar.com.ar/classes/db_cart/db_cart_checkout_example.php?valmail="+valmail;
//var win = new Window('ventanacheck', {className: "alphacube", title: "Contenido del Carrito", top:110, left:100, width:700, height:450, resizable: false, draggable: false, url: "http://scottilibros.com.ar/classes/db_cart/db_cart_checkout_example.php?valmail="+valmail, showEffectOptions: {duration:2}}); 
//win.setDestroyOnClose();
//win.show();
//myObserver = { onDestroy: function(eventName, win){
	//						window.location.reload();
							//win = null; 
		//					Windows.removeObserver(this);
									
									//}
	
//}
			//Windows.addObserver(myObserver);
}
else{
var valmail = prompt('Ingrese su correo electronico','');
//var valmail = $('correo').value;
var filter=/^[A-Za-z][A-Za-z0-9_]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/;
if (valmail.length == 0 ) return true;
if (filter.test(valmail)){
//var win = new Window('ventanacheck', {className: "alphacube", title: "Contenido del Carrito", top:110, left:100, width:700, height:450, resizable: false, draggable: false, url: "http://scottilibros.com.ar/classes/db_cart/db_cart_checkout_example.php?valmail="+valmail, showEffectOptions: {duration:2}}); 
/*win.setDestroyOnClose();
win.show();
myObserver = { onDestroy: function(eventName, win){
							window.location.reload();
							//win = null; 
							Windows.removeObserver(this);
									
									}
	
			}
			Windows.addObserver(myObserver);*/
window.location='http://ediar.com.ar/classes/db_cart/db_cart_checkout_example.php?valmail='+valmail;

}else{
alert("Ingrese una dirección de correo válida");
}
}

}
			  //update: $('carajax');
          }).send();
}