function getElemento(Nombre){
	return document.getElementById(Nombre);
}
var gsIdioma = new Array(
						 new Array('Falta proporcionar ','Nombre comercial','Direccion de factura','Codigo postal','Pais','Estado','Ciudad','Direccion'),
						 new Array('Failure to provide ','Trade Name','Billing Address','ZIP','Country','State','City','Address')
				);
function ValidarFacturacion(Idioma){
	Idioma = gsIdioma[0];
	if(getElemento("txtNombreComercial" ).value == ""){	alert(Idioma[0]+Idioma[1]);	return false; }
	if(getElemento("txtDireccionFactura").value == ""){	alert(Idioma[0]+Idioma[2]);	return false; }
	if(getElemento("txtCodigoPostal"	).value == ""){	alert(Idioma[0]+Idioma[3]);	return false; }
	if(getElemento("cmbPais").options[getElemento("cmbPais").selectedIndex].value == ""){	alert(Idioma[0]+Idioma[4]);	return false; }
	if(getElemento("cmbEstado").type == "text"){
		if(getElemento("cmbEstado" ).value == ""){	alert(Idioma[0]+Idioma[5]);	return false; }
		if(getElemento("cmbCiudad" ).value == ""){	alert(Idioma[0]+Idioma[6]);	return false; }
	}else{
		if(getElemento("cmbEstado").options[getElemento("cmbEstado").selectedIndex].value == ""){	alert(Idioma[0]+Idioma[5]);	return false; }
		if(getElemento("cmbCiudad").options[getElemento("cmbCiudad").selectedIndex].value == ""){	alert(Idioma[0]+Idioma[6]);	return false; }
	}
	getElemento("Frm").submit();
	return true;
}
function ValidarDirecciones(Idioma){
	Idioma = gsIdioma[0];
	if(getElemento("txtDireccion" ).value == ""){	alert(Idioma[0]+Idioma[7]);	return false; }
	if(getElemento("cmbPais").options[getElemento("cmbPais").selectedIndex].value == ""){	alert(Idioma[0]+Idioma[4]);	return false; }
	if(getElemento("cmbEstado").type == "text"){
		if(getElemento("cmbEstado" ).value == ""){	alert(Idioma[0]+Idioma[5]);	return false; }
		if(getElemento("cmbCiudad" ).value == ""){	alert(Idioma[0]+Idioma[6]);	return false; }
	}else{
		if(getElemento("cmbEstado").options[getElemento("cmbEstado").selectedIndex].value == ""){	alert(Idioma[0]+Idioma[5]);	return false; }
		if(getElemento("cmbCiudad").options[getElemento("cmbCiudad").selectedIndex].value == ""){	alert(Idioma[0]+Idioma[6]);	return false; }
	}
	getElemento("Frm").submit();
	return true;
}
function BuscarEstado(Pais,Estado,Ciudad){
	if(Pais == ""){
		document.getElementById("spnEstado").innerHTML = '<input type="text" disabled="disabled"/>';
		document.getElementById("spnCiudad").innerHTML = '<input type="text" disabled="disabled"/>';
	}else if(Pais == 134){
		var objAjax = new clsAjax("spnEstado","obtenerDatos.php");		
		objAjax.Sincronizar(true);
		objAjax.NombreFuncion("mostrarciudades('"+Ciudad+"')");
		objAjax.Ajax("psOpcion=Estados&psFiltro="+Estado+'&psNombre=cmbEstado&Complemento='+unescape("onchange='BuscarDatosCiudad(this.value,\"\")'"));
	}else{
		document.getElementById("spnEstado").innerHTML = '<input type="text" value="'+Estado+'" name="cmbEstado" id="cmbEstado"/>';
		document.getElementById("spnCiudad").innerHTML = '<input type="text" value="'+Ciudad+'" name="cmbCiudad" id="cmbCiudad"/>';
	}
}
function mostrarciudades(Ciudad){
	var estado = document.getElementById("cmbEstado");
	BuscarDatosCiudad(estado.options[estado.selectedIndex].value,Ciudad);
}
function BuscarDatosCiudad(Estado,Ciudad){
	var objAjax = new clsAjax("spnCiudad","obtenerDatos.php");
	objAjax.Ajax("psOpcion=Ciudades&psFiltro="+Estado+'&psCiudad='+Ciudad+'&psNombre=cmbCiudad');
}
function cargarpaginanew(url){
	document.Frm.action = url;	
	document.Frm.submit();
}
function regresar(){
	var Destino = document.Frm.url;
	if(Destino){
		cargarpaginanew(Destino.value);
	}else{
		cargarpaginanew("tiendavirtual.htm");
	}					
}
function Delete(Producto){
	var Frm = document.getElementById('Frm');
	Frm.action = 'idelCart.htm?key='+Producto;
	Frm.submit();
	return false;
}
function Eliminar(Producto){
	var Frm = document.getElementById('Frm');
	Frm.action = 'delCart.htm?key='+Producto;
	Frm.submit();
	return false;
}
function Asignar(Key,Control){
	Control = document.getElementById(Control);
	document.getElementById("spnShopping").innerHTML = '<input type="hidden" value="'+Key+'" name="txtarticulo" id="txtarticulo"/><input type="hidden" value="'+Control.value+'" name="txtCantidad" id="txtCantidad"/>'				
	document.getElementById("FrmProductos").submit();
	return false;
}

function update(){
	var Frm = document.getElementById('Frm');
	Frm.action = 'IupCart.htm';
	Frm.submit();	
}
function actualizar(){
	var Frm = document.getElementById('Frm');
	Frm.action = 'upCart.htm';
	Frm.submit();	
}
function register(){
	var Frm = document.getElementById('Frm');
	Frm.action = 'IshoopingAdress.htm';
	Frm.submit();
}
function registrar(){
	var Frm = document.getElementById('Frm');
	Frm.action = 'shoopingAdress.htm';
	Frm.submit();
}
function paginador(){
	document.getElementById('FrmProductos').action = '';
	document.getElementById('FrmProductos').submit();
}
function onTecla(e)	{	
	liTecla = e?e.keyCode:event.keyCode;		
	if(liTecla == 13){
		return false;
	}
} 	
document.onkeydown = onTecla;	
