function Toggle(imageId, on) 
{
	var imgButton = document.getElementById(imageId);
	if (imgButton != null) 
	{
		imgButton.src = imgButton.src.replace(/_(on|off)/i, (on == true? "_on" : "_off"));
	}
}

var refTimeout = null;
function RedirectTo(strUrl) 
{
    refTimeout = setTimeout("window.location = '" + strUrl + "';", 100);
    //if (!confirm('continue?')) 
    //{
    //    clearTimeout(refTimeout);
    //    return false;
    //}
}

String.prototype.trim = function() 
{
    return this.replace(/^\s+|\s+$/g, '');
}

function VerifyEmailAddressById(strEmailAddressFieldId, strFieldPrompt) 
{
    var txtEmailAddress = document.getElementById(strEmailAddressFieldId);
    if (!txtEmailAddress) 
    {
        return false;
    }
	if (txtEmailAddress.value.trim() == '' || txtEmailAddress.value.trim() == strFieldPrompt.trim()) 
	{
		return false;
	}
	
	var reValidEmailAddress = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
    if (!reValidEmailAddress.test(txtEmailAddress.value.trim())) 
    {
        if (confirm('Please provide a valid email address to continue.')) 
        {
            txtEmailAddress.focus();
            return false;
        }
        else 
        {
            txtEmailAddress.value = strFieldPrompt;
            return false;
        }
    }
    
    return true;
}


