/**
* Format a number with thousand-seperators
*
* @param	nStr		string	Number to format
* @param	decimalSep	string	One character that specifies the decimal seperator
* @param	thousandSep	string	One character that specifies the thousand seperator
*/
function numberFormat(nStr, decimalSep, thousandSep) {
	if (typeof decimalSep == 'undefined') {
		decimalSep = ',';
	}

	if (typeof thousandSep == 'undefined') {
		thousandSep = '.';
	}

	nStr += '';
	x = nStr.split(decimalSep);
	x1 = x[0];
	x2 = x.length > 1 ? decimalSep + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + thousandSep + '$2');
	}
	return x1 + x2;
}

/**
* Set a cookie
*
* @param	c_name		string	Name of the cookie
* @param	value		string	Value of the cookie
* @param	expiredays	int		Days for the cookie to live
*/
function setCookie(c_name,value,expiredays) {
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

/**
* Get a cookie
*
* @param	c_name		string	Name of the cookie
*/
function getCookie(c_name) {
	if (document.cookie.length>0)
	  {
	  c_start=document.cookie.indexOf(c_name + "=");
	  if (c_start!=-1)
		{
		c_start=c_start + c_name.length+1;
		c_end=document.cookie.indexOf(";",c_start);
		if (c_end==-1) c_end=document.cookie.length;
		return unescape(document.cookie.substring(c_start,c_end));
		}
	  }
	return "";
}