/*---------------------------------------------------------
|  Application Name : FRAMEWORK ver beta.
|  Core Files From  : JS MODULE
|  File name        : jsfunc.js
|  Created On       : 
|  Created By       : Sandnya Team
|  Modified On      : ----
|  Modified By      : ----
|  Version          : beta
---------------------------------------------------------*/
/*************************************************************************
    Function Name   :   isEmpty
    Input           :   string
    Output          :   boolean
    purpose         :   To check the Input Field is empty or not
*************************************************************************/
function isEmpty(sValue)
{
    var sStr= sValue;
    for (var i =0;i<sStr.length;i++)
    {
        if (sStr.charCodeAt(i) != 10 && sStr.charCodeAt(i) != 13 && sStr.charAt(i) != "?@" && sStr.charCodeAt(i) != 32)
        {
            return false;
        }
    }
    return true;
}

/*************************************************************************
    Function Name   :   isAlpha
    Input           :   string
    Output          :   boolean
    purpose         :   To check, weather Input is Alphabet or not?
*************************************************************************/
function isAlpha(sValue)
{
    var sStr = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    for (i=0;i<sValue.length;i++)
    {
        if ( sStr.indexOf(sValue.charAt(i)) ==-1)
        {
            return true;
        }
    }
    return false;
}

/*************************************************************************
    Function Name   :   isNumeric
    Input           :   string
    Output          :   boolean
    purpose         :   To check, weather Input is Numeric or not?
*************************************************************************/
function isNumeric(sValue)
{
    var sStr = "0123456789";
    for (i=0;i<sValue.length;i++)
    {
        if ( sStr.indexOf(sValue.charAt(i)) ==-1)
        {
            return true;
        }
    }
    return false;
}

/*************************************************************************
    Function Name   :   isMoney
    Input           :   string
    Output          :   boolean
    purpose         :   To check, weather Input is of Money Type or not?
*************************************************************************/
function isMoney(sValue)
{
    var sStr = "0123456789";
    for (i=0;i<sValue.length;i++)
    {
        if ( sStr.indexOf(sValue.charAt(i)) ==-1)
        {
            return true;
        }
    }
    return false;
}


/*************************************************************************
    Function Name   :   isPhone
    Input           :   string
    Output          :   boolean
    purpose         :   To check, weather Input is Numeric or not?
*************************************************************************/
function isPhone(sValue)
{
    var sStr = "0123456789+-";
    for (i=0;i<sValue.length;i++)
    {
        if ( sStr.indexOf(sValue.charAt(i)) ==-1)
        {
            return true;
        }
    }
    return false;
}

/*************************************************************************
    Function Name   :   getLength
    Input           :   string
    Output          :   long
    purpose         :   To retrieve the length of String consisting 
                        Multi Byte.
*************************************************************************/
function getLength(sValue)
{
    var nLen = 0;
    for (i=0;i<sValue.length;i++)
    {
        if ( sValue.charCodeAt(i) <= 255 )
        {
            nLen += 1;
        }
        else
        {
            nLen += 2;
        }
    }
    return nLen;
}

/*************************************************************************
    Function Name   :   isEmail
    Input           :   string
    Output          :   boolean
    purpose         :   To check the format is of Email type 
*************************************************************************/
function isEmail (emailIn)
{
	var isEmailOk = false;
	var filter = /^[a-zA-Z0-9][a-zA-Z0-9._-]*\@[a-zA-Z0-9-]+(\.[a-zA-Z][a-zA-Z-]+)+$/
	if(emailIn.search(filter) != -1)
		{
			isEmailOk = true;
		/*	var arr = emailIn.split(".");
			if(arr[1]!="edu")
		    isEmailOk = false;*/
		}
	if(emailIn.indexOf("..") != -1)
		isEmailOk = false;
	if(emailIn.indexOf(".@") != -1)
		isEmailOk = false;
	return isEmailOk;
 } 

/*************************************************************************
        Error Message Array
*************************************************************************/
    var errMessage = new Array;
    errMessage[0] = "Non-Empty User Name";
    errMessage[1] = "Non-Empty Password";
    errMessage[2] = "Password should be greater than 4 characters";
    errMessage[3] = "Confirm Password should be greater than 4 charaters";
    errMessage[4] = "Passwords do not match";
    errMessage[5] = "Non-Empty First Name";
    errMessage[6] = "Non-Empty Last Name";
    errMessage[7] = "Non-Empty Address";
    errMessage[8] = "Select One Country"; //"Non-Empty Country";
    errMessage[9] = "Non-Empty State";
    errMessage[10] = "Non-Empty Zip Code";
    errMessage[11] = "Non-Empty Phone and Numeric Values Only";
    errMessage[12] = "Invalid User Name Format, use Email ID";
    errMessage[13] = "Non-Empty City";
    errMessage[14] = "Numeric Values Only";
