String.format = function( text )
{
    if ( arguments.length <= 1 )
    {
        return text;
    }

    var tokenCount = arguments.length - 1;

    for( var token = 0; token < tokenCount; token++ )
    {
        text = text.replace(new RegExp("\\{" + token + "\\}", "gi" ), arguments[ token + 1 ] );
    }

    return text;
};

function toInt(x)
{
    return parseInt(x);
}

function rand(n)
{
	return (Math.floor(Math.random() * n + 1));
}

function goToURL(url) { window.location = url; }
function goToURL2(url) { window.location = url; }
