function PonPuntoMilesJS(cNumber)
{
	cNumber = new String(cNumber);
	var cNumberFormat ;
	var i; 
	var nPos;
	var cDigito; 
	var cLength; 

    cNumberFormat = "";
	nPos = 1;
	i = 1;
	cDigito = "";
	cLength = cNumber.length;
			
	for (i=cLength; i >= 1; i--){
		cDigito = cNumber.substring(i-1, i);
		if(nPos == 3 && i != 1){
			cDigito = "."+cDigito;
			nPos = 1;
		}else{
			nPos = nPos + 1;
		}
		cNumberFormat = cDigito + cNumberFormat;
	}
	return cNumberFormat;
}


function QuitaPuntoMilesJS(string_puntos)
{
	string_puntos = new String(string_puntos);
	var longitud = string_puntos.length;
	if ( longitud > 3)	{
		var veces = parseInt(longitud/3);
		cadena = string_puntos.split(".")
		cadena_total = ""
		for (i =0;i< veces;i++){
		cadena_total = cadena_total + cadena[i];
		}
		return Number(cadena_total);
	}
	else
	return Number(string_puntos);
}


function PrecioJs(preciopts,precioeuro,estado)
{
	var importe;
	var entero;
	var decimal;
	var estado_euro = new String();
	estado_euro = estado;
	
	if (estado_euro == "PTA-PTAEURO-PTA")
	{
		document.write (PonPuntoMilesJS(preciopts) + " Pta");
	}
	else
	{
		importe = new String(precioeuro);
		importe = importe.replace(".",",");				
		importe = importe.split(",");
		
		entero = parseInt(importe[0]);
		decimal = importe[1];
		importe = PonPuntoMilesJS(entero) + "," + decimal + " Eur";
		document.write (importe);
	}
}