function pause(Amount) {
//	alert("pausing...");
	d = new Date() //today's date
	while (1) {
		mill = new Date() // Date Now
		diff = mill-d //difference in milliseconds
		if ( diff > Amount ) {break;}
	}
}


function i_want_to(what) {
	if (what == '') {
		return false;
	}
	var parts = what.split('|');
	open_main_ajax(parts[0], parts[1], parts[2]);
}


function goto_stock(symbol, what) {
	open_main_ajax('main_invest.php?what=' + what + '&buy=' + symbol);
}
function goto_stock_plain(symbol, what) {
	window.location.href = '?main=main_invest&what=' + what + '&buy=' + symbol;
}

function sell_stock(symbol, what) {
	open_main_ajax('main_portfolio.php?what=' + what + '&sell=' + symbol);
}
function sell_stock_plain(symbol, what) {
	window.location.href = '?main=main_portfolio&what=' + what + '&sell=' + symbol;
}

function view_league(league_id) {
	open_main_ajax('main_leagues.php?show_league=' + league_id);
}
function view_league_plain(league_id) {
	window.location.href = '?main=main_leagues&show_league=' + league_id;
}


function select_jump(where, plain_html, li_id, li_count) {
	if (plain_html == 1) {
		window.location.href = where;
	} else {
		open_main_ajax(where, li_id, li_count);
	}
}


function trim(str) {
	str = this != window? this : str;
	return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}


function number_format(number, zeros) {
	if (zeros == null) { zeros = 2; }
	var number_return = '';
	var len = number.toString().length;
	if (len < zeros) {
		var diff = zeros - len;
		for (var i = 0; i < diff; i++) {
			number_return = number_return + '0';
		}
	}
	number_return = number_return + number.toString();
	return number_return;
}


function rand (n) {
  return ( Math.floor ( Math.random ( ) * n + 1 ) );
}

