// JavaScript Document
	function dec()
	{
		var e_k = window.event.keyCode;
		if (e_k > 33 && e_k < 44 || e_k == 47 || e_k > 57 || e_k==32)
		{
			window.event.returnValue = false;
		}
		if (e_k == 46)
		{
			window.event.keyCode = 44;
			
		}
	}
	function noVacio(control) 
	{

	 	var n = control.length;
		
	    if (n==0)
		{
			alert("Si no va a cobrar por adelantado ponga un 0");
		}
	}
	function redondear(num, dec)
	{ 
    	num = parseFloat(num); 
    	dec = parseFloat(dec); 
    	dec = (!dec ? 2 : dec); 
    	return Math.round(num * Math.pow(10, dec)) / Math.pow(10, dec); 
   }
	
	function construyePrecio(valor)
	{
		var a;
		var b = redondear(valor,2); 
		var retorno;
		var a = (b.toString()).split(".");
		
		if (a.length == 1)
		{
			retorno = a[0] + ".00";
		}
		else if (a.length==2 && a[1].length == 1 )
		{
			retorno = a[0]+ "." + a[1] + "0";
		}
		else
		{
			retorno = a[0] + "." + a[1].substr(0,2);
		}

		return retorno;
	}
	function replacePuntos(entry) 
	{
		out = ".";
		add = ",";
		temp = "" + entry; // temporary holder

		while (temp.indexOf(out)>-1) 
		{
			pos= temp.indexOf(out);
			temp = "" + (temp.substring(0, pos) + add + temp.substring((pos + out.length), temp.length));
		}
		return temp;
	}
	function replaceComas(entry) 
	{
		out = ",";
		add = ".";
		temp = "" + entry; // temporary holder

		while (temp.indexOf(out)>-1) 
		{
			pos= temp.indexOf(out);
			temp = "" + (temp.substring(0, pos) + add + temp.substring((pos + out.length), temp.length));
		}
		return temp;
	}