/******************************************************************************************************************
 * Module Name         : Common
 * File Name           : Common.js
 * Created On          : 05/01/2007
 * Developed By        : Indresh B.N.
 * Version             : 1.01
 * Brief Description   : Common client side validation script used across the application.
 * Last Modified       : 21/02/2008
 * 
 ******************************************************************************************************************
 * Revision History
 *******************************************************************************************************************
 * Version      Change Id       Defect Id       Modified By         Date			Brief Description
 *--------------------------------------------------------------------------------------------------------------------------- 
 * 1.01                                         Pranesh K S         21/02/08        Added new function to check for fields in confirm password.
 ********************************************************************************************************************/

function trim(val)
{
    return val.replace(/^\s*|\s*$/g,"");
}

function validateEmail(value)
{
	var validationString = /^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/
	return validationString.test(value);
}

//Function used in change password screen
function confirmPassword()
{
    if(oldpassword.value == "")
    {
    alert("Please enter a valid old Password");
    oldpassword.focus();
    return false;
    }
    if(password1.value  == "")
    {
    alert("Please enter a valid new Password");
    password1.focus();
    return false;
    }
    if(password2.value  == "")
    {
    alert("Please enter a valid new Password");
    password2.focus();
    return false;
    }
   
    if(password1.value != password2.value)
    {
    alert("Confirm Password and New Password doesnot match");
    password1.value = "";
    password2.value= "";
    password1.focus();
    return false;
    }
   
    
    return true;
 
}