// naExtendedJS v0.0.3
// by Newton Applications - http://www.newtonapplications.com
// Create : 2008-06-05
// Last Change : 2009-01-02
// For more information on this script, visit: http://www.newtonapplications.com/
// Requirements : prototype.js (1.6.0)
// Optional : najsAlert (v0.0.1)
// UTF-8 >> éèà

function simpleAlert(myText,myComment) {
	try {new najsAlert('direct', myText,{comment:myComment});}
	catch(e) { alert(myText); }
}

function simpleWindow(pageUrl, windowName, classic) {
	var h=screen.height-100;
	var w=(screen.width)/1.5;
	var pH=30;
	var pW=(screen.width-w)/2;
	if (windowName==undefined) windowName='';
	if (classic==undefined) classic=false;
	if (classic==true) { var myWindow = window.open(pageUrl); }
	else { var myWindow = window.open(pageUrl, windowName, 'top='+pH+',left='+pW+',toolbar=no,menubar=no,location=no,directories=no,status=no,resizable=no,width='+w+',height='+h);}
	if (myWindow!=undefined) { myWindow.focus(); return true; }
	else { return false; }
}

function numberToCurrency(num, intoCurrency) {
	if (intoCurrency==undefined) intoCurrency='us';
	if (isNaN(num)) num=0;
	if (intoCurrency=='fr') {
		return num.toFixed(2).replace('.', ',')+' €';
	} else {
		return '$'+num.toFixed(2);
	}
}

function currencyToNumber(str) {return stringToNumber(str);}

function stringToNumber(str) {
	str=str.match(/([0-9,\.])/g,'').join('');
	str=str.replace(',','.');
	return parseFloat(str);
}
