﻿function isEmpty(s) 
{
    return ((s == null) || (s.length == 0));
}

function isWhitespace(s) 
{
    var i;

    // Is s empty?
    if (isEmpty(s)) return true;

    // Search through string's characters one by one
    // until we find a non-whitespace character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++) 
    {
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (c != ' ') return false;
    }

    // All characters are whitespace.
    return true;
}

function ForceEntry(val, str) 
{
    var strInput = new String(val.value);
    if (isWhitespace(strInput)) 
    {
        alert(str);
        val.focus();
        return false;
    }
    else
        return true;
}

function ValidEmail(val, str) 
{
    var strEmail = new String(val.value);
    var regExpEmail = /\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
    if (regExpEmail.test(strEmail) != true) 
    {
        alert(str);
        val.focus();
        return false;
    }
    else
        return true;
}

function ValidPhone(val, str) 
{
    var strPhone = new String(val.value);
    var regExpPhone = /^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,3})|(\(?\d{2,3}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$/;
    if (regExpPhone.test(strPhone) != true) 
    {
        alert(str);
        val.focus();
        return false;
    }
    else
        return true;
}

function ForceChoose(val, choice, str) 
{
    if (choice == 0 || choice == null)
    {
        alert(str);
        val.focus();
        return false;
    }
    else
        return true;
}
function clearQuoteForm() 
{
    window.location.href="quote.php";
}
function clearAuditForm() 
{
    window.location.href = "audit.php";
}
function moveContent()
{
  //document.getElementById('PgContent').style.marginLeft = ((screen.availWidth - document.getElementById('aTopC').width) / 2) + 'px';
  $("#PgContent").css("marginLeft", ((screen.availWidth - $("#aTopC").css("width") / 2) + 'px'));
}
function determineCareerMethod(whichBtnClick) 
{
    if (whichBtnClick == "btnFaxID") 
    {
        $("#extraContent").text("Fax #: 949-587-8436");
        $("#extraContent").css("display", "block");
    }
    else if (whichBtnClick == "btnMailID") 
    {
        $("#extraContent").html("Mail: <br />Attn: Human Resources<br />Avrio Biopharmaceuticals<br />4 Chrysler<br />Irvine, CA 92618");
        $("#extraContent").css("display", "block");
    }
}
