﻿/// Copyright (c) 2008
/// Version 1.0 (BETA)
///
/// by João Pinho (jpe.pinho@gmail.com)
///
/// Permission is hereby granted, free of charge, to any person obtaining a copy of this library and associated 
/// documentation files (the "Library"), to deal in the Library without restriction, including without limitation 
/// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the libraries, and 
/// to permit persons to whom the library is furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in all copies or substantial portions 
/// of the libraries.

/// *******************************************************************************************************************

/// SonicLib Namespace

function loading(isLoading, eName)
{
    $(eName.toString()).style.visibility = (isLoading) ? "visible" : "hidden";
}

function emailValidator(email)
{
    var emailRegex = "\\w+([-+.\']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*";
    var match = email.match(emailRegex);
    return (match != null);
}

function getQueryParams(pName)
{
    var query = window.location.search.substring(1, window.location.search.length).toLowerCase();
    if (query.length > 0)
    {
        var parameters = new Array();
        parameters = query.split("&");
        for (i = 0; i < parameters.length; i++)
        {
            if (parameters[i].indexOf(pName.toLowerCase()) >= 0)
                return parameters[i].split("=")[1];
        }
    }

    return "";
}