

function oNumero(numero)

{

//Propiedades

this.valor = numero || 0

this.dec = -1;

//Métodos

this.formato = numFormat;

this.ponValor = ponValor;

//Definición de los métodos

function ponValor(cad)

{

if (cad =='-' || cad=='+') return

if (cad.length ==0) return

if (cad.indexOf('.') >=0)

    this.valor = parseFloat(cad);

else

    this.valor = parseInt(cad);

}

function numFormat(dec, miles)

{

var num = this.valor, signo=3, expr;

var cad = ""+this.valor;

var ceros = "", pos, pdec, i;

for (i=0; i < dec; i++)

ceros += '0';

pos = cad.indexOf('.')

if (pos < 0)

    cad = cad+"."+ceros;

else

    {

    pdec = cad.length - pos -1;

    if (pdec <= dec)

        {

        for (i=0; i< (dec-pdec); i++)

            cad += '0';

        }

    else

        {

        num = num*Math.pow(10, dec);

        num = Math.round(num);

        num = num/Math.pow(10, dec);

        cad = new String(num);

        }

    }

pos = cad.indexOf('.')

if (pos < 0) pos = cad.lentgh

if (cad.substr(0,1)=='-' || cad.substr(0,1) == '+')

       signo = 4;

if (miles && pos > signo)

    do{

        expr = /([+-]?\d)(\d{3}[\.\,]\d*)/

        cad.match(expr)

        cad=cad.replace(expr, RegExp.$1+','+RegExp.$2)

        }

while (cad.indexOf(',') > signo)

    if (dec<0) cad = cad.replace(/\./,'')



  cad = cad.replace(/\./,',');

  

  return cad;

}

}//Fin del objeto oNumero:



// JavaScript Document



window.onload = init;

var d=document;

function init() {

	

	so_checkCanCreate();

}



function so_checkCanCreate() {



	// make sure the browser has images turned on. If they are, so_createCustomCheckBoxes will

	// fire when this small test image loads. otherwise, the user will get the hard-coded checkboxes

	testImage = d.body.appendChild(d.createElement("img"));



	// MSIE will cache the test image, causing it to not fire the onload event the next time the

	// page is hit. The parameter on the end will prevent this.

	testImage.src = "../__images/blank_carrito.gif?" + new Date().valueOf();

	testImage.id = "so_testImage";

	testImage.onload = so_createCustomCheckBoxes;

}



function so_createCustomCheckBoxes() {

	// bail out is this is an older browser

	if(!d.getElementById)return;

	// remove our test image from the DOM

	d.body.removeChild(d.getElementById("so_testImage"));

	// an array of applicable events that we'll need to carry over to our custom checkbox

	events = new Array("onfocus", "onblur", "onselect", "onchange", "onclick", "ondblclick", "onmousedown", "onmouseup", "onmouseover", "onmousemove", "onmouseout", "onkeypress", "onkeydown", "onkeyup");

	// a reference var to all the forms in the document



	frm = d.getElementsByTagName("form");

	// loop over the length of the forms in the document

	for(i=0;i<frm.length;i++) {

		// reference to the elements of the form

		c = frm[i].elements;

		// loop over the length of those elements

		for(j=0;j<c.length;j++) {

			// if this element is a checkbox, do our thing



			if(c[j].getAttribute("type") == "checkbox") {

				// hide the original checkbox

				c[j].style.position = "absolute";

				c[j].style.left = "-9000px";

				// create the replacement image

				n = d.createElement("img");

				n.setAttribute("class","chk");

				// check if the corresponding checkbox is checked or not. set the

				// status of the image accordingly

				if(c[j].checked == false) {

					n.setAttribute("src","../__images/chk_off.gif");

					n.setAttribute("title","click here to select this option.");

					n.setAttribute("alt","click here to select this option.");

				} else {

					n.setAttribute("src","../__images/chk_on.gif");

					n.setAttribute("title","click here to deselect this option.");

					n.setAttribute("alt","click here to deselect this option.");

				}

				// there are several pieces of data we'll need to know later.

				// assign them as attributes of the image we've created

				// first - the name of the corresponding checkbox

				n.xid = c[j].getAttribute("name");

				// next, the index of the FORM element so we'll know which form object to access later



				n.frmIndex = i;

				// assign the onclick event to the image

				n.onclick = function() { so_toggleCheckBox(this,0);return false; }

				// insert the image into the DOM

				c[j].parentNode.insertBefore(n,c[j].nextSibling)

				// this attribute is a bit of a hack - we need to know in the event of a label click (for browsers that support it)

				// which image we need turn on or off. So, we set the image as an attribute!

				c[j].objRef = n;

				// assign the checkbox objects event handlers to its replacement image

				for(e=0;e<events.length;e++) if(eval('c[j].' +events[e])) eval('n.' + events[e] + '= c[j].' + events[e]);

				// append our onchange event handler to any existing ones.

				fn = c[j].onchange;

				if(typeof(fn) == "function") {

					c[j].onchange = function() { fn(); so_toggleCheckBox(this.objRef,1); return false; }

				} else {

					c[j].onchange = function() {  so_toggleCheckBox(this.objRef,1); return false; }

				}

			}

		}

	}

}



function so_toggleCheckBox(imgObj,caller) {



	// if caller is 1, this method has been called from the onchange event of the checkbox, which means

	// the user has clicked the label element. Dont change the checked status of the checkbox in this instance

	// or we'll set it to the opposite of what the user wants. caller is 0 if coming from the onclick event of the image

	

	// reference to the form object

	formObj = d.forms[imgObj.frmIndex];

	// the name of the checkbox we're changing

	objName = imgObj.xid;

	

	// change the checked status of the checkbox if coming from the onclick of the image

	formObj.elements[objName].checked = !formObj.elements[objName].checked?true:false;

	// finally, update the image to reflect the current state of the checkbox.

	if(imgObj.src.indexOf("chk_on.gif")>-1) {

		imgObj.setAttribute("src","../__images/chk_off.gif");

		imgObj.setAttribute("title","click here to select this option.");

		imgObj.setAttribute("alt","click here to select this option.");

	} else {

		imgObj.setAttribute("src","../__images/chk_on.gif");

		imgObj.setAttribute("title","click here to deselect this option.");

		imgObj.setAttribute("alt","click here to deselect this option.");

	}

}



function checkemail(cad)

{ 

	 

	if (cad.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)

		return true;

	else

		return false;

} 



function aceptar()

{

	var result = true;

	

	var nombre = document.datos_personales.nombre;		

	

	if (document.datos_personales.nombre.value.length > 2 )

	{

			nombre.setAttribute('class','');

	}

	else

	{

			nombre.setAttribute('class','error');

			result = false;

	}	

		

	var direccion = document.datos_personales.direccion;										 	

	if (document.datos_personales.direccion.value.length > 6 )

	{

			direccion.setAttribute('class','');

	}

	else

	{ 

			direccion.setAttribute('class','error');

			result = false;

	}

		

	var cp = document.datos_personales.cp ;										 

	if (document.datos_personales.cp.value.length > 3 && document.datos_personales.cp.value.length < 10 )

	{
		  		cp.setAttribute('class','');
	}	 

	else

	{

			cp.setAttribute('class','error');

			result = false;

	}  

	

	var ciudad = document.datos_personales.ciudad;										 

	 

	if (document.datos_personales.ciudad.value.length > 3 )

	{

			ciudad.setAttribute('class','');

	}

	else

	{

			ciudad.setAttribute('class','error');

			result = false;

	}

	

	var provincia = document.datos_personales.provincia;										 

	

	if (document.datos_personales.provincia.value.length > 3 )

	{

		 provincia.setAttribute('class','');	

	}

	else

	{

		 provincia.setAttribute('class','error');

		 result = false;

	}

	

	var pais = document.datos_personales.pais ;										 

	

	if (document.datos_personales.pais.value.length > 3 )

	{

		pais.setAttribute('class','');

  }

  else

	{

		pais.setAttribute('class','error');

		result = false;

	}

	

	var telefono = document.datos_personales.telefono ;										 

	

	if (document.datos_personales.telefono.value.length > 7 )

	{

			a = 0;

	    for (i = 0; i < document.datos_personales.telefono.value.length; i++)

	    {   

	        // Check that current character is number.

				        var c = document.datos_personales.telefono.value.charAt(i);

				        if (((c < "0") || (c > "9"))) a = 1;

			}

																	

			if ( a==1 )

			{

					telefono.setAttribute('class','error');

					result = false;

			}

			else

			{

					telefono.setAttribute('class','');

			}						

	}

	else

	{

		telefono.setAttribute('class','error');

		result = false;

	}

								

	var modo_pago = document.datos_personales.modopago ;										 

																

	if (checkemail(document.datos_personales.email.value)==true)

	{

		if ( result == true )

		{

			if (modo_pago.value == "")

			{

				

				var mail = document.datos_personales.email ;										 

				mail.setAttribute('class','');

				alert("Escoja la forma de pago");

			}

			else

			{

				document.datos_personales.submit();	

			}

		}

		else

		{

			

			if (modo_pago.value == "")

			{

				modo_pago.setAttribute('class','error');

				result = false;

			}

		}

		

	}

	else

	{

			var mail = document.datos_personales.email ;										 

			mail.setAttribute('class','error');

			

	} 

	if (modo_pago.value == "")

	{

		modo_pago.setAttribute('class','error');

		result = false;

	}

			 	

		

}



function precioTotal (contador, idlibro)

{

	 

	var unidad 	= document.getElementById ("precio_" + contador);

	var fila 		= document.getElementById ("fila_carrito_" + idlibro);

	var total 	= document.getElementById ("precio_fila_" + contador);

	

	 

	

	//////////////////////////////////////////////////////////////

	

	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();

	}

	ajax = xmlhttp;

	

	

	ajax.open("GET", "ActUnidades.php?u=" + fila.value + "&i=" + idlibro,true);

   

  

	ajax.onreadystatechange=function() 

	{

		

		if (ajax.readyState==4) 

		{

			var cadena 					= ajax.responseText;

			

			var datos 					= cadena.split("|");

			var total_1 				= document.getElementById ("gasto_1");

			var supertotal 			= document.getElementById ("c_supertotal");

			var gastoEnvio_1 		= document.getElementById ("gasto_2");

			var tt = new oNumero();

	

			var  i = 0;

			for (var pos in datos)

			{

					if ( i == 0)

					{

						

						var tt = new oNumero( parseFloat(datos[pos]));

						total_1.innerHTML = "Total: " + tt.formato(2,true) + " €";

					}

				  else if( i == 1)

				  {

				  	var tt = new oNumero(parseFloat(datos[pos]));

				  	

					  supertotal.innerHTML 	= "Total: " + tt.formato(2,true) + " €";

					}

					else if ( i == 2)

					{

						//gastoEnvio_1.innerHTML = datos[pos]+ " €";

					}

					else if ( i == 3)

					{

						if (datos[pos] != "")

						{

							alert("Solo quedan disponibles " + datos[pos] +  "unidades");

							fila.value = datos[pos];

							precioTotal (contador, idlibro);

						}

						

					}

					i++;

			}

			

		}

	}

	 

	ajax.send(null)



  var tt = (fila.value * unidad.value);

  tt = parseFloat(tt);

  	 

  var numero = new oNumero(tt);

  	 

  	 

	total.innerHTML = numero.formato(2,true)+"€";

	//////////////////////////////////////////

	//Actualizo subtotal

	

	if (fila.value>= 10)

	{

		var comboDestino = document.getElementById("destino");

		var comboModo = document.getElementById("modo");

		

//		comboDestino.enabled = false;

//		comboModo.enabled = false;

	} 

	

	

}



///movimientos del área del carrito



function seguircomprando()

{

	history.back();

}





function borrarSel()

{

	//bucle recorre los checks

	var sqlQuery = "";

	var sqlQueryArr = new Array();

	var arrPos = 0;

	var checks = document.carrito.getElementsByTagName("input");

	for (var i=0; i< checks.length; i++)

	{	

		var myId = checks[i].getAttributeNode("id").value;

		

	 	if (myId=="checks")

		{ 

			if ( checks[i].checked ) //Esta seleccionado

			{

				//ajax

				var myValue = checks[i].getAttributeNode("alt").value;

				sqlQueryArr [arrPos] = myValue; 

				arrPos++;

			}

		}

	}

	 

	//fin del recorrido

	sqlQuery = sqlQueryArr.join("|");

	

	

	//si la cadena tiene querys, cargamos el objeto httpxml

	

	if (sqlQuery.length > 0)

	{

	

		//cargamos ajax

		////////////////////////////////////////////////////////////////////////

		 

		

		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();

		}

			 

		ajax = xmlhttp;

		 

		ajax.open("GET", "BorraSeleccionados.php?sel=" + sqlQuery,true);

	 

		ajax.onreadystatechange=function() 

		{

			

			if (ajax.readyState==4) 

			{

				document.carrito.innerHTML = ajax.responseText;

				init();

			}

		}

		ajax.send(null)



		

	}

}

 

 

function CargaGastos1(sel, unidades)

{

	

	var comboDestino = document.getElementById("destino");

	var miIndex = sel.selectedIndex;

  

	var miIndex2 = document.getElementById ("modo");

	var fila = document.getElementById ("gasto_1");

	var fila2 = document.getElementById ("gasto_2");

	var fila3 = document.getElementById ("c_supertotal");

	

	

	var unidad = getUnidades();

	//alert('getUnidades ' + unidad);

	if (unidad >= 10)

	{

		alert('Sus gastos de envio son gratuitos, ha superado las 10 unidades');

		

		fila3.innerHTML  = getTotalCarrito() + " €";

		fila2.innerHTML  = "0,00 €";

		

		return;

	}

	

	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();

		}

			 

		ajax = xmlhttp;

		 

		 

		ajax.open("GET", "CalcGe.php",true);

		

		ajax.onreadystatechange=function() 

		{

			

			if (ajax.readyState==4) 

			{

				 

				

				var cad 				= ajax.responseText;

				//var valores			= cad.split("|");

				var i 					= 0;

				var gasto_envio = 0;

				

				

				//alert(cad);

				//for (var pos in valores)

				{

					if ( ( miIndex == "3")  || ( ( miIndex2.value != "") && (miIndex != "")) )

					{

							miIndex2.disabled = false;

							

						if ( miIndex == "3" ) //	resto

						{

					 			miIndex2.value = "6";

							  gasto_envio= "18"; 

							  miIndex2.disabled = true;

							  miIndex2.enabled = false;

							  

							  

							  var myUrl = "ActGastosEnvio.php?id=" + "3" + "_" + "6" + "_" + "18";

								actGastos(myUrl);

							 

						}	

						else if ( miIndex == "2" ) //	europa

						{

							if (miIndex2.value == "6" )

							{

								//miIndex2.value = "6";

							  gasto_envio= "8"; 

							  

							}

							

						  else if (miIndex2.value == "10" )

						  {

						  	//miIndex2.value = "6";

							  gasto_envio= "16"; 

							  

						  }

						}

						else if ( miIndex == "1" ) //	europa

						{

							if (miIndex2.value == "6" )

							{

								//miIndex2.value = "6";

							  gasto_envio= "6"; 

							  

							}

							

						  else if (miIndex2.value == "10" )

						  {

						  	//miIndex2.value = "6";

							  gasto_envio= "13"; 

							  

						  }

						}

						

						var myUrl = "ActGastosEnvio.php?id=" + miIndex + "_" + miIndex2.value + "_" + gasto_envio;

						actGastos(myUrl);

								

				//		alert(miIndex);

						var total = eval(cad) + eval(gasto_envio);

						  

						var tt = new oNumero(total) ;

						fila3.innerHTML =  "Total: " + tt.formato(2,true) + " €";	

						

						var tt = new oNumero(parseFloat(gasto_envio));

						fila2.innerHTML = tt.formato(2,true) +" €";

							//2 valor total con nuevos gastos de envio

						

						i++;

					}

					else

					{

							fila3.innerHTML = "Sin seleccionar";

		    			fila2.innerHTML = "";

					}

					

					

				}

				

			}

		}

		ajax.send(null)

	  

}



function actGastos(myUrl)

{

	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();

		}

			 

			ajax = xmlhttp;

			

			ajax.open("GET", myUrl ,true);

	    //alert(myUrl); 

			ajax.onreadystatechange=function() 

			{

				if (ajax.readyState==4) 

		    {

		   	  cad = (ajax.responseText);

		   	  //alert("funcion -" + cad);

		   	  var fila2 = document.getElementById ("gasto_2");

		   	  var numero = new oNumero(cad);

		   	  var num = 0;

		   	  

		   	  num = getUnidades();

		   	  if (num >= 10)

		   	  {

		   	  	alert('Su envio es gratuito, al llegar a las 10 unidades');

		   		}

		   		else

		   		{

		   			fila2.innerHTML =  numero.formato(2,true)+ " €";

		   		}

		   	  

				}

			}

			ajax.send(null)

			

    

}



function enviar()

{

	document.compra.submit();

 

}



function LanzaPedido (tipo)

{

	muestraEspTxt();

	if (tipo == "tarjetadecredito")

	{

		enviar();

	}

	

	var boton = document.getElementById ("c_confirmar");

	

	boton.setAttribute ("href",null);

	

	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();

		}

			 

		ajax = xmlhttp;

		 

		 

		ajax.open("GET", "GenPed.php",true);

	 

		ajax.onreadystatechange=function() 

		{

			

			if (ajax.readyState==4) 

	    {

					var cad 	= 	ajax.responseText;    	

					

					document.location.href = "index.php?sec=finalizado";

	    }

	  }

	  ajax.send(null);

	   

}





function depuraSalidaComboPedido()

{

	var miIndex = document.getElementById ("destino");

	var miIndex2 = document.getElementById ("modo");

	var fila2 = document.getElementById ("gasto_2");

	var total = document.getElementById ("c_supertotal");

	var xmlhttp=false;

  var myUrl = "";

	var ajax = "";

	

	var num = getUnidades();

	//alert(num);

	

	if ( num >= 10)

	{

			document.location.href = "index.php?sec=datos";

			return;

	}

	

	var filt = total.innerHTML;

	

	filt = filt.replace("Total:","");

	filt = filt.replace("€","");

	filt = filt.replace(",",".");

	

	var t = eval(filt);

	

	if (t == 0)

	{

		alert('Indique las unidades que desee comprar');

		return;

	}

	

	if (  miIndex.value != "" &&  miIndex2.value != "")  

	{ 

		if ( miIndex.value == "1" ) //	españa

						{

								if (miIndex2.value == "6")

								{

							 		gasto_envio = "6";

								}

								else

								{

								 	gasto_envio = "13";

								}

						}

						if ( miIndex.value == "2" ) //	ceuta

						{

								if (miIndex2.value == "6")

									{

									 	gasto_envio = "8";

									}

									else

									{

										 gasto_envio = "16";

									}					

									

						}

						if ( miIndex.value == "3" ) //	resto

						{

							miIndex2.value = "6";

						  gasto_envio= "18"; 

						}	

	

			myUrl = "ActGastosEnvio.php?id=" + miIndex.value + "_" + miIndex2.value + "_" + gasto_envio ;

		//	alert(myUrl);

			actGastos(myUrl);

 	 	  document.location.href = "index.php?sec=datos";

	}

  else

  {

  	alert("Seleccione los datos de envio");

  }



}



function Unidades (id_libro)

{

		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();

		}

			 

		ajax = xmlhttp;

		 

		 

		ajax.open("GET", "GetUnidades.php?id=" + id_libro,true);

	 

		ajax.onreadystatechange=function() 

		{

			

			if (ajax.readyState==4) 

	    {

	    	fila = document.getElementById("fila_carrito_" + id_libro);

				fila.innerHTML	= 	ajax.responseText;    	

						

	    }

	  }

	  ajax.send(null);

}



function popGastos() {



var  myWindow = window.open("popup.htm",'JavaScriptIt','toolbar= 0,location= 0,directories= 0,status= 0,menubar= 0,scrollbars= 0,resizable= 0,copyhistory= 0,width=474,height=180'); 

myWindow.moveTo(660,246);

}





function getUnidades()

{

	

	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();

	}

		 

	ajax = xmlhttp;

	 

	 

	ajax.open("GET", "GetTodasUnidades.php",true);

	 

	  var num = 0;

	  var cad ="";

		ajax.onreadystatechange=function() 

		{
			if (ajax.readyState==4) 
	
		    {
		    		cad = ajax.responseText;    	
		    }

	  }

	  ajax.send(null);

		//alert('getunidades: ' + cad);  

	  num = parseInt(cad);

	  //alert('getunidades: toInt' + num);

	  return (num);

}



function getTotalCarrito()

{

	

	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();

		}

			 

		ajax = xmlhttp;

		 

		 

		ajax.open("GET", "CalcGe.php",true);

	 

	  var num = 0;

	  var cad ="";

		ajax.onreadystatechange=function() 

		{

			

			if (ajax.readyState==4) 

	    {

	    	

	    		cad = ajax.responseText;    	

						

	    }

	  }

	  ajax.send(null);

	  

	  total = eval(cad);

	  

	  var tt = new oNumero(total) ;

		//alert('getunidades: ' + cad);  

	  //num = parseInt(cad);

	  //alert('getunidades: toInt' + num);

	  return (tt.formato(2,true));

}
