﻿// jQuery no conflict mode.
var $j = jQuery.noConflict();

function clickclear(thisfield, defaulttext)
{
    if (thisfield.value == defaulttext) {
        thisfield.value = "";
    }
}

function clickrecall(thisfield, defaulttext)
{
    if (thisfield.value == "") {
        thisfield.value = defaulttext;
    }
}

/**
 * Strips illegal characters.
 *
 * @param   string  a   The string to strip.
 * @return  string     
 */
function _siteStatStrip(a)
{
    // Remvove " and '.
    a = a.replace(/\"/g, '');
    a = a.replace(/\'/g, '');
    
    // Trim leading and trailing white space.
    a = a.replace(/^\s+|\s+$/g, '');
    
    // Trim anything that's not a letter or number.
    a = a.replace(/[^a-zA-Z0-9]+/g, '-');
    
    // Lowercase the everything.
    a = a.toLowerCase();

    // Return the formatted string.
    return a;
}

function pause(numberMillis)
{
    var now = new Date();
    var exitTime = now.getTime() + numberMillis;
    while (true)
    {
        now = new Date();
        if (now.getTime() > exitTime)
            return;
    }
}
