

if(typeof(G_INT_NUM_START)=="undefined")
   G_INT_NUM_START = 48;
if(typeof(G_INT_NUM_END)=="undefined")
   G_INT_NUM_END = 57;
if(typeof(G_INT_APLPH_UP_START)=="undefined")
   G_INT_APLPH_UP_START = 65;
if(typeof(G_INT_APLPH_UP_END)=="undefined")
   G_INT_APLPH_UP_END = 90;
if(typeof(G_INT_APLPH_LW_START)=="undefined")
   G_INT_APLPH_LW_START = 97;
if(typeof(G_INT_APLPH_LW_END)=="undefined")
   G_INT_APLPH_LW_END = 90000;	//chinese max length 

//alert(G_INT_APLPH_LW_END)

var INT_NUM_START    = G_INT_NUM_START;   // 48
var INT_NUM_END   = G_INT_NUM_END;  // 57
var INT_APLPH_UP_START  = G_INT_APLPH_UP_START; // 65
var INT_APLPH_UP_END    = G_INT_APLPH_UP_END;   // 90
var INT_APLPH_LW_START  = G_INT_APLPH_LW_START; // 97
var INT_APLPH_LW_END    = G_INT_APLPH_LW_END;   //90000

var STR_1_SPACE = ' ';                    //01. ** Standard string constant for formvaildate.js **
var STR_MINUS = '-';                      //02.
var STR_PLUS = '+';                       //03.
var STR_DOT = '.';                        //04.
var STR_COLON = ':';                      //05.
var STR_NOTEQUAL = STR_NOTEQUAL;                   //06.
var STR_BSTARTS = '(';                    //07.
var STR_BCLOSE = ')';                     //08.
var STR_AT = '@';                         //09.
var STR_UNDERSCORE = '_';                 //11.
var STR_AND = '&';                        //12.
var STR_SBRACE_0 = '[';                   //13.
var STR_SBRACE_1 = ']';                   //14.
var STR_BRACE_0 = '{';                    //15.
var STR_BRACE_1 = '}';                    //16.
var STR_GIF_U = 'GIF';                    //17.
var STR_JPG_U = 'JPG';                    //18.
var STR_JPEG_U = 'JPEG';                  //19.
var STR_PNG_U = 'PNG';                  //19.
var STR_GIF_L = 'gif';                    //20.
var STR_JPG_L = 'jpg';                    //21.
var STR_JPEG_L = 'jpeg';                  //22.
var STR_PNG_L = 'png';                  //22.
var STR_SLACE = '/';                      //23.
var STR_DSLACE = '\\';                    //24.
var STR_WBMP_L = 'wbmp';                  //25.
var STR_WBMP_U = 'WBMP';                  //26.
var STR_QUOTES = '"';                     //27.
var STR_ZERO = '0';                       //28.

                                       // Standard integer constant for formvaildate.js //
var INT_CCODE_UP_STARTS = INT_APLPH_LW_START;         //29.    default 97
var INT_CCODE_UP_CLOSE = INT_APLPH_LW_END;            //30.    default 123
var INT_CCODE_UP_APLPH_CLOSE = 123;          //30.    default 123

var INT_CCODE_MID_STARTS = INT_APLPH_UP_START;        //31.    default 65
var INT_CCODE_MID_CLOSE = (INT_APLPH_UP_END + 1);           //32.    default 91
var INT_CCODE_LOW_STARTS = INT_NUM_START;             //33.    default 48
var INT_CCODE_LOW_CLOSE = INT_NUM_END;                //34.    default 57

// 0-47 [48-57] 58-64 [65-90] 91-96 [97-122] //

var OBJ_KEY_ALPNUM = /[^0-9 a-zA-Z]/;                       //01. ** Standard key objects for formvaildate.js **
var OBJ_KEY_EMPTY = /[ ]/;                                  //02.
var OBJ_KEY_STAR = /[*]/;                                   //03.
var OBJ_KEY_ALPNUM_1 = /[^\/:.a-z0-9A-Z -_]/;               //04.
var OBJ_KEY_ALP = /[^a-zA-Z]/;                              //05.
var OBJ_KEY_ALPNUM_2 = /[^a-z0-9A-Z]/;                      //06.
var OBJ_KEY_ALPNUM_3 = /[^(,.,),@,&,_,#,0-9,a-z,A-Z ,-]/;   //07.
var OBJ_KEY_ALP_1 = /[^ .a-zA-Z]/;                          //08.
var OBJ_KEY_ALPNUM_4 = /[^-_.a-z0-9A-Z]/;                   //09.
var OBJ_KEY_ALPNUM_5 = /[^-_.@a-z0-9A-Z]/;                  //10.
var OBJ_KEY_AMPERSAND = /[&]/;                              //11.


// Trim function to trim the leading and trailing spaces.
function trim(l_str)
{
   var l_str_string = new String(l_str); // local variable to store the string
   var l_int_length = l_str_string . length; // local variable to store the length of string
   var l_str_temp = new String(''); // local variable to store the string
   var l_b_flag = true; // local variable to store the boolean value

   for(l_int_i = 0; l_int_i <= l_int_length - 1; ++l_int_i) // start of for loop to check for space from first
   {
      if (l_b_flag == true && l_str_string.charAt(l_int_i) == STR_1_SPACE) // checks for space
      {
         l_b_flag = true;
      } // end of check space if
      else
      {
         l_b_flag = false;
         l_str_temp = l_str_string.substring(l_int_i);
         break;
      } // end of check space else
      if (l_int_i == l_int_length - 1) // checks for length
      {
         return l_str_temp;
      } // end of length check if
   } // end of chack space from first for loop

   l_int_length = l_str_temp.length;
   l_b_flag = true;

   for(l_int_i = l_int_length - 1; l_int_i >= 0; l_int_i--) // start of for loop to check for space from the last
   {
      if (l_b_flag == true && l_str_temp.charAt(l_int_i) == STR_1_SPACE) // check for space
      {
         l_b_flag = true;
      } // end of check space if
      else
      {
         l_b_flag = false;
         l_str_string = l_str_temp.substring(0, l_int_i + 1);
         break;
      } // end of check space else
   } // end of chack space from last for loop
   return l_str_string;
} // end of trim function

// Fuction which returns false if the passed control has null value (this calls trim function internally)
function checkNotNull(l_frm_control)
{
   var l_str_string = trim(l_frm_control.value); // local variable to store the string
   l_frm_control.value = l_str_string;

   if (l_str_string.length == 0) // check for length of the string
   {
      alert(TXT_Var14006);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   } // end of check for length if
   return true;
} // end of checkNotNull function

// function returns false if the passed control have any other character other than alphabet
function checkTextOnly(l_frm_control)
{
   //alert("checkTextOnly----")
   var l_str_string = ""; // local variable to store the string
   var l_int_length = 0; // local variable to store the length of string
   l_str_string = new String(l_frm_control.value);
   l_int_length = l_str_string.length;

   for(l_int_i = 0; l_int_i < l_int_length; ++l_int_i) // start of for loop
   {
      if (!((l_str_string.charCodeAt(l_int_i) >= INT_CCODE_UP_STARTS && l_str_string.charCodeAt(l_int_i) < INT_CCODE_UP_CLOSE) ||  (l_str_string.charCodeAt(l_int_i) >= INT_CCODE_MID_STARTS && l_str_string.charCodeAt(l_int_i) < INT_CCODE_MID_CLOSE) || l_str_string.charAt(l_int_i) == STR_1_SPACE))
      { // checks for valid allowed characters
         alert(TXT_Var14007);
         l_frm_control.select();
         l_frm_control.focus();
         return false;
      } // end of valid allowed characters if
      if (l_str_string.charAt(l_int_i) == STR_1_SPACE) // checks for space
      {
         if(l_str_string.charAt(0) == STR_1_SPACE)
         {
            alert(TXT_Var14008);
            l_frm_control.select();
            l_frm_control.focus();
            return false;
         }
         else if (!(((l_str_string.charCodeAt(l_int_i + 1) >= INT_CCODE_UP_STARTS && l_str_string.charCodeAt(l_int_i + 1) < INT_CCODE_UP_CLOSE) ||  (l_str_string.charCodeAt(l_int_i + 1) >= INT_CCODE_MID_STARTS && l_str_string.charCodeAt(l_int_i + 1) < INT_CCODE_MID_CLOSE)) && ((l_str_string.charCodeAt(l_int_i - 1) >= INT_CCODE_UP_STARTS && l_str_string.charCodeAt(l_int_i - 1) < INT_CCODE_UP_CLOSE) ||  (l_str_string.charCodeAt(l_int_i - 1) >= INT_CCODE_MID_STARTS && l_str_string.charCodeAt(l_int_i - 1) <INT_CCODE_MID_CLOSE ))))
         { // checks for valid allowed consecutive character after space
            alert(TXT_Var14009);
            l_frm_control.select();
            l_frm_control.focus();
            return false;
         } // end of valid allowed consecutive charater if
      } // end of space check if
   } // end of for loop
   return true;
} // end of checkTextOnly function

//// function returns false if the passed control have any other character other than integer
function checkIntegerOnly(l_frm_control)
{
   var l_str_string = ""; // local variable to store the stringe

   if (checkNotNull(l_frm_control) == false) // check for not null function
   {
      return false;
   } // end of checknotnull if

   l_str_string = new String(l_frm_control.value);
   if (l_str_string.substring(1).indexOf(STR_MINUS) >= 0 || l_str_string.indexOf(STR_PLUS) >= 0)
   {// checks for valid allowed signs
      alert(TXT_Var14010);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   } // end of check for valid allowed sign if

   if (isNaN(l_str_string) == true) // check for not a number
   {
      alert(TXT_Var14011);
      l_frm_control.select();
      return false;
   } // end of check not a number if
   return true;
} // end of checkIntegerOnly function

//// function returns false if the passed control have any other character other than integer and dot char
function checkFloatOnly(l_frm_control)
{
   var l_str_string = ""; // local variable to store the string
   var l_str_temp_before = ""; // local variable to store the string
   var l_str_temp_after = ""; // local variable to store the string
   var l_int_check = -1; // local variable to store the index of dot
   var l_int_length = -1; // local variable to store the length of string


   if (checkNotNull(l_frm_control) == false) // check for not null function
   {
      return false;
   } // end of checknotnull if

   l_str_string = new String(l_frm_control.value);
   l_int_length = l_str_string.length;

   if (l_str_string.indexOf(STR_PLUS) >= 0 || l_str_string.substring(1).indexOf(STR_MINUS) >= 0)
   { // check for allowed sign
      alert(TXT_Var14010);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   } // end of check allowed sign if

   if (l_str_string.charAt(l_int_length - 1) == STR_DOT) // check for dot operator in the last position
   {
      alert(TXT_Var14013);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   } // end of check dot operator in the last position if

   l_int_check = l_str_string.indexOf(STR_DOT);
   if (!(l_int_check == -1)) // checks for index position of dot operator
   {
      if (!(l_str_string.substring(l_int_check + 1).indexOf(STR_DOT) == -1)) // checks for the next dot operator
      {
         alert(TXT_Var14014);
         l_frm_control.select();
         l_frm_control.focus();
         return false;
      } // end of next dot operator if
      l_str_temp_before = l_str_string.substring(0, l_int_check);
      l_str_temp_after = l_str_string.substring(l_int_check + 1);

      if (l_str_temp_before == STR_MINUS) // checks for negative sign if
      {
         l_str_temp_before = '-0';
      } // end of negative sign if
      if ((isNaN (l_str_temp_before) == true) || (isNaN (l_str_temp_after) == true))
      { // checks for not a number
         alert(TXT_Var14015);
         l_frm_control.select();
         l_frm_control.focus();
         return false;
      } // end of not a number if
   } // end of index position of dot operator if
   else
   {
      if (isNaN (l_str_string) == true) // checks for not a number
      {
         alert(TXT_Var14015);
         l_frm_control.select();
         l_frm_control.focus();
         return false;
      } // end of not a number if
   } // end of index position of dot operator else

   return true;
} // end of checkFloatOnly function

//// function returns false if the passed control have any other character other than alphabet and integer
function checkAlphaNumericOnly(l_frm_control)
{
   var l_str_string = ""; // local variable to store the string
   var l_int_length = -1;// local variable to store the length of string

   if (checkNotNull(l_frm_control) == false) // check for not null function
   {
      return false
   } // end of checknotnull if

   l_str_string = new String(l_frm_control.value);
   l_int_length = l_str_string.length;

   for(l_int_i = 0; l_int_i < l_int_length; ++l_int_i) // start of for loop
   {
      if (!((l_str_string.charCodeAt(l_int_i) >= INT_CCODE_UP_STARTS && l_str_string.charCodeAt(l_int_i) < INT_CCODE_UP_CLOSE) ||  (l_str_string.charCodeAt(l_int_i) >= INT_CCODE_MID_STARTS && l_str_string.charCodeAt(l_int_i) <INT_CCODE_MID_CLOSE ) || (l_str_string.charCodeAt(l_int_i) >= INT_CCODE_LOW_STARTS && l_str_string.charCodeAt(l_int_i) <= INT_CCODE_LOW_CLOSE)))
      { // checks for alphanumeric value
         alert(TXT_Var14017);
         l_frm_control.select();
         l_frm_control.focus();
         return false;
      } // end of alphanumeric value check if
   } // end of for loop

   return true;
} // end of checkAlphaNumericOnly function

// function returns true/false
function checkFieldName(l_frm_control)
{
   var l_str_string = ""; // local variable to store the string

   if (checkNotNull(l_frm_control) == false) // check for not null function
   {
      return false;
   } // end of checknotnull if

   l_str_string=l_frm_control.value;
    
   if (!((l_str_string.charCodeAt(0) >= INT_CCODE_UP_STARTS && l_str_string.charCodeAt(0) < INT_CCODE_UP_CLOSE) ||  (l_str_string.charCodeAt(0) >= INT_CCODE_MID_STARTS && l_str_string.charCodeAt(0) < INT_CCODE_MID_CLOSE) || (l_str_string.charCodeAt(0) >= INT_CCODE_LOW_STARTS && l_str_string.charCodeAt(0) <=INT_CCODE_LOW_CLOSE )))
   { // checks for alphanumeric value
      alert(TXT_Var14018);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   } // end of alphanumeric value check if

   return true;
} // end of checkFieldName function

// function returns true/false
function checkSubDomainName(l_frm_control)
{
   var l_str_string = ""; // local variable to store the string
   if (checkNotNull(l_frm_control) == false) // check for not null function
   {
      return false;
   } // end of checknotnull if

   l_str_string = l_frm_control.value;

   if (newcheckAlphaNumericOnlyUN(l_frm_control) == false) // checks for alphanumeric value
   {
      return false;
   } // end of alphanumeric value check if
   if((l_str_string.substring(0,1)).match(/[^a-zA-Z0-9_.-]/))   //for checking the allowed chars
   {
      alert(TXT_Var14048);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   }

   if (l_str_string.length < l_int_min_length) // check for minimum length
   {
      alert(TXT_Var14049 + l_int_min_length +  " " + TXT_Var14050);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   } // end of minimum length if


   return true;
} // end of checkSubdomainName function

// function returns true/false
function checkCode(l_frm_control,l_int_min_length)
{
   var l_str_string = ""; // local variable to store the string
   var l_int_length = -1; // local variable to store the length of string

   if (checkNotNull(l_frm_control) == false) // check for not null function
   {
      return false;
   } // end of checknotnull if

   l_str_string = l_frm_control.value;
   l_int_length = l_str_string.length;

   if (l_str_string.length < l_int_min_length) // checks for minimum length
   {
      alert(TXT_Var14019 + l_int_min_length + TXT_Var14020);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   } // end of minimum length check if

   for(l_int_i = 0; l_int_i < l_int_length; l_int_i++) // start of for loop
   {
      if (!((l_str_string.charCodeAt(l_int_i) >= INT_CCODE_UP_STARTS && l_str_string.charCodeAt(l_int_i) < INT_CCODE_UP_CLOSE) ||  (l_str_string.charCodeAt(l_int_i) >= INT_CCODE_MID_STARTS && l_str_string.charCodeAt(l_int_i) < INT_CCODE_MID_CLOSE) || (l_str_string.charCodeAt(l_int_i) >= INT_CCODE_LOW_STARTS && l_str_string.charCodeAt(l_int_i) <= INT_CCODE_LOW_CLOSE)))
      { // checks for alphanumeric value
         if (l_str_string.charAt(l_int_i) == STR_MINUS || l_str_string.charAt(l_int_i) == STR_COLON || l_str_string.charAt(l_int_i) == STR_NOTEQUAL || l_str_string.charAt(l_int_i) == STR_BSTARTS || l_str_string.charAt(l_int_i) == STR_BCLOSE || l_str_string.charAt(l_int_i) == STR_DOT || l_str_string.charAt(l_int_i) == STR_1_SPACE)
         { // checks for allowed characters
            if (!(((l_str_string.charCodeAt(l_int_i + 1) >= INT_CCODE_UP_STARTS && l_str_string.charCodeAt(l_int_i + 1) < INT_CCODE_UP_CLOSE) ||  (l_str_string.charCodeAt(l_int_i + 1) >= INT_CCODE_MID_STARTS && l_str_string.charCodeAt(l_int_i + 1) < INT_CCODE_MID_CLOSE) || (l_str_string.charCodeAt(l_int_i + 1) >= INT_CCODE_LOW_STARTS && l_str_string.charCodeAt(l_int_i + 1) <= INT_CCODE_LOW_CLOSE)) && ((l_str_string.charCodeAt(l_int_i - 1) >= INT_CCODE_UP_STARTS && l_str_string.charCodeAt(l_int_i - 1) < INT_CCODE_UP_CLOSE) ||  (l_str_string.charCodeAt(l_int_i - 1) >= INT_CCODE_MID_STARTS && l_str_string.charCodeAt(l_int_i - 1) < INT_CCODE_MID_CLOSE) || (l_str_string.charCodeAt(l_int_i - 1) >= INT_CCODE_LOW_STARTS && l_str_string.charCodeAt(l_int_i - 1) <= INT_CCODE_LOW_CLOSE))))
            { // checks for allowed consecutive characters
               alert(TXT_Var14023);
               l_frm_control.select();
               l_frm_control.focus();
               return false;
            } // end of allowed consecutive characters if
         } // end of allowed character if
         else
         {
            alert(TXT_Var14024);
            l_frm_control.select();
            l_frm_control.focus();
            return false;
         } // end of allowed character else
      } // end of alphanumeric value check if
   } // end of for loop

   return true;
} // end of checkCode function

// function returns true/false
function checkPhone(l_frm_control)
{
   var l_str_string = ""; // local variable to store the string
   var l_int_length = -1; // local variable to store the length of string

   if (checkNotNull(l_frm_control) == false) // check for not null function
   {
      return false;
   } // end of checknotnull if

   l_str_string = l_frm_control.value;
   l_int_length = l_str_string.length;
   if(isNaN(l_str_string.charAt(0)) && l_str_string.charAt(0) != STR_BSTARTS)   // check for not a number in the first position
   {
      alert(TXT_Var14025);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   } // end of not a number check if
   if(l_str_string.charAt(l_str_string.length-1) == STR_BSTARTS || l_str_string.charAt(l_str_string.length-1) == STR_MINUS || l_str_string.charAt(l_str_string.length-1) == STR_BCLOSE)   // check for not a number in the first position
   {
      alert(TXT_Var14026);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   } // end of not a number check if

   if(l_str_string.match(/[^-0-9 +()]/))
   {
      alert(TXT_Var14027);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   } // end of allowed valid character else

   for(l_int_i = 0; l_int_i < l_int_length; l_int_i++) // start of for loop
   {
      // checks for allowed valid characters

      if ((l_str_string.charAt(l_int_i) == STR_1_SPACE) || (l_str_string.charAt(l_int_i) == STR_BSTARTS) || (l_str_string.charAt(l_int_i) == STR_BCLOSE) || (l_str_string.charAt(l_int_i) == STR_MINUS))
      {
          // checks for consecutive characters
         if (isNaN(l_str_string.charAt(l_int_i + 1)) == true || (l_str_string.charAt(l_int_i + 1) == STR_1_SPACE) || isNaN(l_str_string.charAt(l_int_i - 1)) == true || (l_str_string.charAt(l_int_i - 1) == STR_1_SPACE) || (l_str_string.charAt(l_int_i - 1) == STR_BCLOSE) || (l_str_string.charAt(l_int_i + 1) == STR_BSTARTS)|| (l_str_string.charAt(l_int_i - 1) == STR_MINUS) || (l_str_string.charAt(l_int_i + 1) == STR_MINUS))
         {
            alert(TXT_Var14026);
            l_frm_control.select();
            l_frm_control.focus();
            return false;
         } // end of consecutive character if
      } // end of allowed valid character if
   } // end of for loop
return true;
} // end of checkPhone function

// function returns true/false
function checkEmail(l_frm_control)
{
   var l_str_string = ""; // local variable to store the string
   var l_int_length = -1; // local variable to store the length of string

   l_str_string = trim(l_frm_control.value);
   l_int_length = l_str_string.length;
   if (checkNotNull(l_frm_control) == false) // check for not null function
   {
      return false;
   } // end of checknotnull if

   l_str_string = l_frm_control.value;
   l_int_length = l_str_string.length;

   if (l_str_string.indexOf(STR_AT) == -1) // checks for @ character
   {
      alert(TXT_Var14030);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   } // end of STR_AT character check if
   else
   {
      if (!(l_str_string.substring(l_str_string.indexOf(STR_AT) + 1).indexOf(STR_AT) == -1))
      { // checks for the consecutive '@' character
         alert(TXT_Var14031);
         l_frm_control.select();
         l_frm_control.focus();
         return false;
      } // end of consecutive STR_AT character check if
   } // end of STR_AT character check else
   if (l_str_string.substring(l_str_string.indexOf(STR_AT) + 1).indexOf(STR_DOT) == -1)
   { // checks for dot operatore
      alert(TXT_Var14032);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   } // end of dot operator
   if(!(checkForm4UnicodeText(l_str_string,'-||_||.||@')))
   {
      alert(TXT_Var14032)
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   }
   for(l_int_i = 0; l_int_i < l_int_length; l_int_i++) // start of for loop
   {

       // checks for allowed characters
      if (l_str_string.charAt(l_int_i) == STR_AT || l_str_string.charAt(l_int_i) == STR_UNDERSCORE || l_str_string.charAt(l_int_i) == STR_MINUS ||l_str_string.charAt(l_int_i) == STR_DOT)
      {
         // checks for allowed consecutive character
         if (!(((l_str_string.charCodeAt(l_int_i + 1) >= INT_CCODE_UP_STARTS && l_str_string.charCodeAt(l_int_i + 1) < INT_CCODE_UP_CLOSE) ||  (l_str_string.charCodeAt(l_int_i + 1) >= INT_CCODE_MID_STARTS && l_str_string.charCodeAt(l_int_i + 1) < INT_CCODE_MID_CLOSE) || (l_str_string.charCodeAt(l_int_i + 1) >= INT_CCODE_LOW_STARTS && l_str_string.charCodeAt(l_int_i + 1) <= INT_CCODE_LOW_CLOSE)) && ((l_str_string.charCodeAt(l_int_i - 1) >= INT_CCODE_UP_STARTS && l_str_string.charCodeAt(l_int_i - 1) < INT_CCODE_UP_CLOSE) ||  (l_str_string.charCodeAt(l_int_i - 1) >= INT_CCODE_MID_STARTS && l_str_string.charCodeAt(l_int_i - 1) < INT_CCODE_MID_CLOSE) || (l_str_string.charCodeAt(l_int_i - 1) >= INT_CCODE_LOW_STARTS && l_str_string.charCodeAt(l_int_i - 1) <= INT_CCODE_LOW_CLOSE))))
         {
            alert(TXT_Var14032);
            l_frm_control.select();
            l_frm_control.focus();
            return false;
         } // end of allowed conscutive character if
      } // end of allowed character if
   } // end of for loop

return true;
} // end of checkEmail function

// function returns true/false
// function returns true/false
function checkAddress(l_frm_control, l_int_max_length)
{
   var l_str_string = ""; // local variable to store the string
   var l_int_length = -1; // local variable to store the length of string

   l_str_string = l_frm_control.value;
   l_int_length = l_str_string.length;
   if (l_int_length > l_int_max_length) // checks for maximum length
   {
      alert(TXT_Var14034 + l_int_max_length + ' TXT_Var14035');
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   } // end of maximum length if

   for(l_int_i = 0; l_int_i < l_int_length; l_int_i++) // start of for loop
   {
      if ((l_str_string.charCodeAt(l_int_i) >= INT_CCODE_UP_STARTS && l_str_string.charCodeAt(l_int_i) < INT_CCODE_UP_CLOSE) ||  (l_str_string.charCodeAt(l_int_i) >= INT_CCODE_MID_STARTS && l_str_string.charCodeAt(l_int_i) < INT_CCODE_MID_CLOSE) || (l_str_string.charCodeAt(l_int_i) >= INT_CCODE_LOW_STARTS && l_str_string.charCodeAt(l_int_i) <= INT_CCODE_LOW_CLOSE))
      { // checks for atleast one alphanumeric character
         return true;
      } // end of alphanumeric character check if
   } // end of for loop
   alert(TXT_Var14036);
   l_frm_control.select();
   l_frm_control.focus();
   return false;
} // end of checkAddress function

// function returns true/false
function checkName(l_frm_control)
{
   var l_str_string = "" ; // local variable to store the string
   var l_int_length = -1; // local variable to store the length of string


   if (checkNotNull(l_frm_control) == false) // check for not null function
   {
      return false;
   } // end of checknotnull if

   l_str_string = l_frm_control.value;
   l_int_length = l_str_string.length;

   //if(l_str_string.match(/[^ .a-zA-Z]/))   //for checking the allowed chars
   if(!(checkForm3UnicodeText(l_str_string,' ||.')))   //for checking the allowed chars
   {
      alert(TXT_Var14037);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   }


   for(l_int_i = 0; l_int_i < l_int_length; l_int_i++) // start of for loop
   {
      // checks for allowed special character if
      if (l_str_string.charAt(l_int_i) == STR_1_SPACE || l_str_string.charAt(l_int_i) == STR_DOT)
      {
         // checks for allowed consecutive characters
         if (!(((l_str_string.charCodeAt(l_int_i + 1) >= INT_CCODE_UP_STARTS && l_str_string.charCodeAt(l_int_i + 1) < INT_CCODE_UP_CLOSE) ||  (l_str_string.charCodeAt(l_int_i + 1) >= INT_CCODE_MID_STARTS && l_str_string.charCodeAt(l_int_i + 1) < INT_CCODE_MID_CLOSE)) && ((l_str_string.charCodeAt(l_int_i - 1) >= INT_CCODE_UP_STARTS && l_str_string.charCodeAt(l_int_i - 1) < INT_CCODE_UP_CLOSE) ||  (l_str_string.charCodeAt(l_int_i - 1) >= INT_CCODE_MID_STARTS && l_str_string.charCodeAt(l_int_i - 1) < INT_CCODE_MID_CLOSE))))
         {
            alert(TXT_Var14038);
            l_frm_control.select();
            l_frm_control.focus();
            return false;
         } // end of allowed consecutive charater if
      } // end of allowed special charater if

   } // end of for loop

   return true;
} // end of checkName function

// function returns true/false
function checkPageName(l_frm_control)
{
   var l_str_string = ""; // local variable to store the string
   var l_int_length = -1; // local variable to store the length of string


   if (checkNotNull(l_frm_control) == false) // check for not null function
   {
      return false;
   } // end of checknotnull if

   l_str_string = l_frm_control.value;
   l_int_length = l_str_string.length;

   for(l_int_i = 0; l_int_i < l_int_length; l_int_i++) // start of for loop
   {
      // checks for alphanumeric value
      if (!((l_str_string.charCodeAt(l_int_i) >= INT_CCODE_UP_STARTS && l_str_string.charCodeAt(l_int_i) < INT_CCODE_UP_CLOSE) ||  (l_str_string.charCodeAt(l_int_i) >= INT_CCODE_MID_STARTS && l_str_string.charCodeAt(l_int_i) < INT_CCODE_MID_CLOSE) || (l_str_string.charCodeAt(l_int_i) >= INT_CCODE_LOW_STARTS && l_str_string.charCodeAt(l_int_i) <= INT_CCODE_LOW_CLOSE)))
      {
         // checks for allowed special characters if
         if (l_str_string.charAt(l_int_i) == STR_MINUS || l_str_string.charAt(l_int_i) == STR_DOT || l_str_string.charAt(l_int_i) == STR_UNDERSCORE)
         {
            // checks for allowed consecutive characters
            if (!(((l_str_string.charCodeAt(l_int_i + 1) >= INT_CCODE_UP_STARTS && l_str_string.charCodeAt(l_int_i + 1) < INT_CCODE_UP_CLOSE) ||  (l_str_string.charCodeAt(l_int_i + 1) >= INT_CCODE_MID_STARTS && l_str_string.charCodeAt(l_int_i + 1) < INT_CCODE_MID_CLOSE) || (l_str_string.charCodeAt(l_int_i + 1) >= INT_CCODE_LOW_STARTS && l_str_string.charCodeAt(l_int_i + 1) <= INT_CCODE_LOW_CLOSE)) && ((l_str_string.charCodeAt(l_int_i - 1) >= INT_CCODE_UP_STARTS && l_str_string.charCodeAt(l_int_i - 1) < INT_CCODE_UP_CLOSE) ||  (l_str_string.charCodeAt(l_int_i - 1) >= INT_CCODE_MID_STARTS && l_str_string.charCodeAt(l_int_i - 1) < INT_CCODE_MID_CLOSE) || (l_str_string.charCodeAt(l_int_i - 1) >= INT_CCODE_LOW_STARTS && l_str_string.charCodeAt(l_int_i - 1) <= INT_CCODE_LOW_CLOSE))))
            {
               alert(TXT_Var14038);
               l_frm_control.select();
               l_frm_control.focus();
               return false;
            } // end of allowed consecutive characters if
         } // end of allowed special character if
         else if (l_str_string.charAt(l_int_i) == STR_1_SPACE)
         { // checks for space
         } // end of space check
         else
         {
            alert(TXT_Var14040);
            l_frm_control.select();
            l_frm_control.focus();
            return false;
         } // end of allowed special character else
      } // end of alphanumeric check if
   } // end of for loop

   return true;
} // end of checkPageName function

// function returns true/false
function checkTitle(l_frm_control)
{
   var l_str_string = ""; // local variable to store the string
   var l_int_length = -1; // local variable to store the length of string


   if (checkNotNull(l_frm_control) == false) // check for not null function
   {
      return false;
   } // end of checknotnull if

   l_str_string = l_frm_control.value;
   l_int_length = l_str_string.length;

   //if(l_str_string.match(/[^(,.,),@,&,_,#,0-9,a-z,A-Z ,-]/))   //if loop for checking allowed characters
   if(!(checkForm4UnicodeText(l_str_string,'(||.||)||@||&||_||#|| ||-')))   //if loop for checking allowed characters
   {
      alert(TXT_Var14041);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   }   //end of if loop
   if(l_str_string.indexOf(',') != -1)   //if loop for checking allowed characters
   {
      alert(TXT_Var14041);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   }   //end of if loop

   for(l_int_i = 0; l_int_i < l_int_length; l_int_i++) // start of for loop
   {
      // checks for allowed special character
      if (l_str_string.charAt(l_int_i) == STR_DOT || l_str_string.charAt(l_int_i) == STR_BSTARTS || l_str_string.charAt(l_int_i) == STR_BCLOSE || l_str_string.charAt(l_int_i) == STR_AT || l_str_string.charAt(l_int_i) == STR_AND || l_str_string.charAt(l_int_i) == STR_MINUS || l_str_string.charAt(l_int_i) == STR_UNDERSCORE || l_str_string.charAt(l_int_i) == STR_NOTEQUAL)
      {
         // checks for allowed special characters
         if (!(((l_str_string.charCodeAt(l_int_i + 1) >= INT_CCODE_UP_STARTS && l_str_string.charCodeAt(l_int_i + 1) < INT_CCODE_UP_CLOSE) ||  (l_str_string.charCodeAt(l_int_i + 1) >= INT_CCODE_MID_STARTS && l_str_string.charCodeAt(l_int_i + 1) < INT_CCODE_MID_CLOSE) || (l_str_string.charCodeAt(l_int_i + 1) >= INT_CCODE_LOW_STARTS && l_str_string.charCodeAt(l_int_i + 1) <= INT_CCODE_LOW_CLOSE)) && ((l_str_string.charCodeAt(l_int_i - 1) >= INT_CCODE_UP_STARTS && l_str_string.charCodeAt(l_int_i - 1) < INT_CCODE_UP_CLOSE) ||  (l_str_string.charCodeAt(l_int_i - 1) >= INT_CCODE_MID_STARTS && l_str_string.charCodeAt(l_int_i - 1) < INT_CCODE_MID_CLOSE) || (l_str_string.charCodeAt(l_int_i - 1) >= INT_CCODE_LOW_STARTS && l_str_string.charCodeAt(l_int_i - 1) <= INT_CCODE_LOW_CLOSE))))
         {
            alert(TXT_Var14043);
            l_frm_control.select();
            l_frm_control.focus();
            return false;
         } // end of allowed special characters if
      } // end of alphanumeric value check if
   } // end of for loop
return true;
}

// function returns true/false
function checkPassword(l_frm_control, l_int_min_length)
{
   var l_str_string = ""; // local variable to store the string
   l_str_string = trim(l_frm_control.value);  // local variable to store the string

   if (l_str_string.length == 0) // check for length of the string
   {
      alert(TXT_Var14044);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   } // end of check for length if

   if (l_str_string.length < l_int_min_length) // checks for minimum length
   {
      alert(TXT_Var14019 + l_int_min_length +  TXT_Var14020);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   } // end of minimum length if

/*
   //if(l_str_string.match(OBJ_KEY_ALPNUM_2))   //for checking the allowed chars
   if(!(checkForm1UnicodeText(l_str_string)))   //for checking the allowed chars
   {
      alert(TXT_Var14047);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   }
   if (checkAlphaNumericOnly(l_frm_control) == false) // check for alphanumeric value
   {
      return false;
   } // end of alphanumeric value if
*/
  /* if (!checkCommon(l_frm_control))
   {
      l_frm_control.select();
      l_frm_control.focus();
      //alert('in common');
      return false;
   }*/

   var str=l_frm_control.value;

   if(str.indexOf("\\")>=0 || str.indexOf("\"")>=0  || str.indexOf("<")>=0 || str.indexOf(">")>=0 || str.indexOf("'")>=0)
   {
            alert('The characters  \" \\ < > \' are not allowed. Please verify your input.');
            l_frm_control.select();
            l_frm_control.focus();
            return false;
   }



   return true;
} // end of checkPassword function

// function returns true/false
function checkUserName(l_frm_control, l_int_min_length)
{
   var l_str_string = ""; // local variable to store the string
   if (checkNotNull(l_frm_control) == false) // check for not null function
   {
      return false;
   } // end of checknotnull if

   l_str_string = l_frm_control.value;

   if (newcheckAlphaNumericOnlyUN(l_frm_control) == false) // checks for alphanumeric value
   {
      return false;
   } // end of alphanumeric value check if

   if((l_str_string.substring(0,1)).match(/[^a-zA-Z0-9_.-]/))   //for checking the allowed chars
   //if(!(checkForm4UnicodeText(l_str_string,'-||_||.')))   //for checking the allowed chars
   {
    //alert("18 changes");
      alert(TXT_Var14048);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   }

   if (l_str_string.length < l_int_min_length) // check for minimum length
   {
      alert(TXT_Var14049 + l_int_min_length + " " + TXT_Var14050);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   } // end of minimum length if

return true;
} // end of checkUserName function

// function returns true/false
function checkPositiveInteger(l_frm_control)
{
   var l_str_string = ""; // local variable to store the string

   if (checkNotNull(l_frm_control) == false) // check for not null function
   {
      return false;
   } // end of checknotnull if

   l_str_string = new String(l_frm_control.value);
   if (!(l_str_string.indexOf(STR_DOT) == -1)) // checks for the next dot operator
   {
      alert(TXT_Var14051);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   } // end of next dot operator if

   if (l_str_string.indexOf(STR_MINUS) >= 0 || l_str_string.indexOf(STR_PLUS) >= 1)
   { // checks for allowed sign
      alert(TXT_Var14052);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   } // end of allowed sign if

   if (isNaN(l_str_string) == true) // checks for not a number
   {
      alert(TXT_Var14051);
      l_frm_control.select();
      return false;
   } // end of not a number if
   return true;
} // end of checkPositiveInteger function

// checks for valid date
function isValidDate(l_int_day,l_int_month,l_int_year)
{
   var l_b_leap = -1; // boolean variable to find the leap year
   var l_int_valid_days = -1; // variable to store the number of days in a month

   l_int_day = trim(l_int_day);

   if (l_int_day.length == 0) // checks for null value
   {
      alert(TXT_Var14054);
      return false;
   } // end of null value check if
   if (isNaN(l_int_day) == true) // checks for not a number
   {
      alert(TXT_Var14055);
      return false;
   } // end of not a number check if
   if (l_int_day > 31 || l_int_day <= 0) // checks for valid days
   {
      alert(TXT_Var14056);
      return false;
   } // end of valid days check if

   l_int_month = trim(l_int_month);

   if (l_int_month.length == 0) // checks for null value
   {
      alert(TXT_Var14057);
      return false;
   } // end of null value check if
   if (isNaN(l_int_month) == true) // checks for not a number
   {
      alert(TXT_Var14055);
      return false;
   } // end of not a number check if
   if (l_int_month > 12 || l_int_month <= 0) // checks for valid months
   {
      alert(TXT_Var14057);
      return false;
   } // end of valid months check if

   l_int_year = trim(l_int_year);

   if (l_int_year.length == 0) // checks for null value
   {
      alert(TXT_Var14060);
      return false;
   } // end of null value check if
   if (isNaN(l_int_year) == true) // checks for not a number
   {
      alert(TXT_Var14055);
      return false;
   } // end of not a number check if
   if (l_int_year <= 0) // checks for valid year
   {
      alert(TXT_Var14062);
      return false;
   } // end of valid year check if

   l_b_leap = false;

   if (l_int_year % 4 == 0) // checks for leap year
   {
      l_b_leap = true;
   } // end of leap year check if

   l_int_valid_days = 0;

   if(l_int_month == 1 || l_int_month == 3 || l_int_month == 5 || l_int_month == 7 || l_int_month == 8 || l_int_month == 10 || l_int_month == 12)
   { // checks for number of days in a month
      l_int_valid_days = 31;
   } // end of number of days in a month check if
   if(l_int_month == 4 || l_int_month == 6 || l_int_month == 9 || l_int_month == 11)
   { // checks for number of days in a month
      l_int_valid_days = 30;
   } // end of number of days in a month check if
   if(l_int_month == 2 && l_b_leap == true) // checks for number of days for the month of feburary
   {
      l_int_valid_days = 29;
   } // end of number of days in a month check if
   if(l_int_month == 2 && l_b_leap == false) // checks for number of days for the month of feburary
   {
      l_int_valid_days = 28;
   } // end of number of days in a month check if

   if(l_int_valid_days == 0) // checks for valid month
   {
      alert(TXT_Var14063);
      return false;
   } // end of valid month check if
   if(l_int_day > l_int_valid_days) // checks for valid days
   {
      alert(TXT_Var14063);
      return false;
   } // end of valid days check if

   return true;
} // end of isValidDate function

// function returns true/false
function checkFutureDate(l_int_day, l_int_month, l_int_year)
{
   if (isValidDate(l_int_day, l_int_month, l_int_year) == false) // checks for valid date
   {
      return false;
   } // end of valid date check if

   var l_obj_date = new Date(l_int_year, l_int_month - 1, l_int_day); // variable to store the date object
   var l_obj_date_cur = new Date(); // variable to store the date object

   if (l_obj_date.getYear() < l_obj_date_cur.getYear()) // checks for the year
   {
      alert(TXT_Var14065);
      return false;
   } // end of year check if
   if (l_obj_date.getYear() == l_obj_date_cur.getYear()) // checks for the year
   {
      if (l_obj_date.getMonth() < l_obj_date_cur.getMonth()) // checks for the month
      {
         alert(TXT_Var14065);
         return false;
      } // end of month check if
      if (l_obj_date.getMonth() == l_obj_date_cur.getMonth()) // checks for the month
      {
         if (l_obj_date.getDay() <= l_obj_date_cur.getDay()) // checks for the day
         {
            alert(TXT_Var14065);
            return false;
         } // end of day check if
      } // end of month check if
   } // end of year check if
   return true;
} // end checkFutureDate function

// function returns true/false
function checkPastDate(l_int_day, l_int_month, l_int_year)
{
   if (isValidDate(l_int_day, l_int_month, l_int_year) == false) // checks for valid date
   {
      return false;
   } // end of valid date check if

   var l_obj_date = new Date(l_int_year, l_int_month - 1, l_int_day); // variable to store the date object
   var l_obj_date_cur = new Date(); // variable to store the date object

   if (l_obj_date.getYear() > l_obj_date_cur.getYear()) // checks for the year
   {
      alert(TXT_Var14068);
      return false;
   } // end of year check if
   if (l_obj_date.getYear() == l_obj_date_cur.getYear()) // checks for the year
   {
      if (l_obj_date.getMonth() > l_obj_date_cur.getMonth()) // checks for the Month
      {
         alert(TXT_Var14068);
         return false;
      } // end of month check if
      if (l_obj_date.getMonth() == l_obj_date_cur.getMonth()) // checks for the Month
      {
         if (l_obj_date.getDay() >= l_obj_date_cur.getDay()) // checks for the day
         {
            alert(TXT_Var14068);
            return false;
         } // end of day check if
      } // end of month check if
   } // end of year check if
   return true;
} // end of checkPastDate function

// function returns true/false
function checkDomainName(l_frm_control)
{
    
   var l_str_string = ""; // local variable to store the string
   var l_int_length = -1; // local variable to store the length of string
   var l_int_dot = -1; // local variable to store the number of dot's
   if (checkNotNull(l_frm_control) == false) // check for not null function
   {
      
      return false;
   } // end of checknotnull if
    
   l_str_string = l_frm_control.value;
   l_int_length = l_str_string.length;
   
	if(l_str_string.match(/[^-_.:a-z0-9A-Z~!@#$%^&*()=?`+|;[]\/]/))   
   {
      alert(TXT_Var14071);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   }



   if ((l_str_string.indexOf(STR_DOT) == -1)) // checks for the dot operator
   {
      
      alert(TXT_Var14072);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   } // end of dot operator check if
    if (l_str_string.charAt(0) == STR_MINUS || l_str_string.charAt(l_int_length - 1) == STR_MINUS )
   { // checks for consecutive - operator
       
      alert(TXT_Var14071);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   } // end of consecutive - operator check if
      
   if (l_str_string.charAt(0) == STR_DOT || l_str_string.charAt(l_int_length - 1) == STR_DOT || l_str_string.indexOf(STR_DOT+STR_DOT) != -1)
   { // checks for consecutive dot operator
       
      alert(TXT_Var14071);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   } // end of consecutive dot operator check if
   
   if (l_str_string.charAt(0) == STR_SLACE || l_str_string.charAt(l_int_length - 1) == STR_SLACE)
   { // checks for consecutive dot operator
      alert(TXT_Var14071);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   } // end of consecutive dot operator check if
   else if(l_str_string.indexOf(STR_DSLACE) != -1)
   {
      alert(TXT_Var14071);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   }
  
   return true;
} // end of checkDomainName function


// function returns true/false
function checkDomainNew(l_frm_control)
{
    var l_str_string = ""; // local variable to store the string
   var l_int_length = -1; // local variable to store the length of string
   var l_int_dot = -1; // local variable to store the number of dot's

   l_str_string = l_frm_control.value;
   l_int_length = l_str_string.length;
   while( l_str_string.charAt(l_int_length-1)=='\/' || 
      l_str_string.charAt(l_int_length-1)=='\\' )
   {
      l_str_string = l_str_string.substring(0,l_int_length-1);
      l_int_length--;
   }
   l_frm_control.value = l_str_string;
   
    var obj_reg=new RegExp("[^a-z0-9A-Z~\\.-]");
   if(l_str_string.match(obj_reg))
   {
      alert(TXT_Var14071);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   }

   obj_reg=new RegExp("\\.");      
   var arr_name=l_str_string.split(obj_reg);
   
   for(i=0;i<arr_name.length;i++)
   {
        if(arr_name[i].indexOf("-")==0 || arr_name[i].lastIndexOf("-")==(arr_name[i].length-1))
        {
          alert(TXT_Var14071);
          l_frm_control.select();
          l_frm_control.focus();
          return false;
        }
   } 
   
   if ((l_str_string.indexOf(STR_DOT) == -1)) // checks for the dot operator
   {
      alert(TXT_Var14072);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   } // end of dot operator check if
   
   if(!evalFirstCharacter(l_str_string))
   { // checks for consecutive - operator
      alert(TXT_Var14071);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   } // end of consecutive - operator check if
      
   if (l_str_string.indexOf(STR_DOT+STR_DOT) != -1)
   { // checks for consecutive dot operator
      alert(TXT_Var14071);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   } // end of consecutive dot operator check if
   if (l_str_string.charAt(0) == STR_SLACE || l_str_string.charAt(l_int_length - 1) == STR_SLACE)
   { // checks for consecutive dot operator
      alert(TXT_Var14071);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   } // end of consecutive dot operator check if
   else if(l_str_string.indexOf(STR_DSLACE) != -1)
   {
      alert(TXT_Var14071);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   }
   return true;
} // end of checkDomainName function


// function returns true/false
function checkImageName(l_frm_control)
{
  
   var l_str_user_agent = navigator.userAgent;  // to store the user agent of browser

   var l_str_filename = l_frm_control.value;
   var l_str_filename = removeDoubleQuotes(l_str_filename);
   var l_int_dot_pos = l_str_filename.lastIndexOf(STR_DOT);
   var l_b_alpha; // boolean variable to check for alphanumeric value
   var l_str_ext = l_str_filename.substring(l_int_dot_pos + 1);
   //The % Symbol is not allowed in Image file name , Validation for image file name
  if(l_str_filename.match(/[%°]/))
  {
        alert(TXT_Var49123);
        l_frm_control.focus();
        l_frm_control.select();
        return false;
  }

   if ((trim(l_str_filename)).length == 0) // check for not null function
   {
      alert(TXT_Var14077);
      return false;
   } // end of checknotnull if


   if (l_int_dot_pos == -1) // checks for dot opertor
   {
      alert(TXT_Var14078);
      l_frm_control.select();
      return false;
   } // end of dot operator check if

   if(l_str_filename.match(OBJ_KEY_STAR) || l_str_filename.match(OBJ_KEY_AMPERSAND))
   {
      alert(TXT_Var14079);
      l_frm_control.select();
      return false;
   } // end of dot operator check if

   // checks for the allowed image format
   l_str_ext=l_str_ext.toLowerCase();
   
   if (!(l_str_ext == STR_GIF_L || l_str_ext == STR_JPG_L || l_str_ext == STR_JPEG_L || l_str_ext == STR_GIF_U || l_str_ext == STR_JPG_U || l_str_ext == STR_JPEG_U || l_str_ext == STR_PNG_U || l_str_ext == STR_PNG_L))
   {
      alert(TXT_Var14080);
      l_frm_control.select();
      return false;
   } // end of allowed image format check if


      var file_separator = '';
   if(l_str_filename.lastIndexOf(STR_SLACE) != -1)
   {
      file_separator = STR_SLACE;
   }
   if(l_str_filename.lastIndexOf(STR_DSLACE) != -1)
   {
         file_separator = STR_DSLACE;
   }
   if ( (l_str_filename.lastIndexOf(STR_COLON) != -1) && (l_str_user_agent.indexOf('Gecko') != -1) && (l_str_user_agent.indexOf('Mac') != -1) )
   {
      file_separator = STR_COLON;
   }
   if(file_separator.length > 0)
   {
      //-------SGV16.0 Modified Due to allow the space during file upload --------
	  /*if(l_str_filename.substring(l_str_filename.lastIndexOf(file_separator)).match(OBJ_KEY_EMPTY))
      {
         alert(TXT_Var14081);
         l_frm_control.select();
         return false;
      }*/
	  //----------------------------------------------------------------------------------------------------
   }

   return true;
} // end of checkImageName function

// function returns true/false
function checkImageNamePNG(l_frm_control)
{

   var l_str_user_agent = navigator.userAgent;  // to store the user agent of browser

   var l_str_filename = l_frm_control.value;
   var l_str_filename = removeDoubleQuotes(l_str_filename);
   var l_int_dot_pos = l_str_filename.lastIndexOf(STR_DOT);
   var l_b_alpha; // boolean variable to check for alphanumeric value
   var l_str_ext = l_str_filename.substring(l_int_dot_pos + 1);

   if ((trim(l_str_filename)).length == 0) // check for not null function
   {
      alert(TXT_Var14077);
      return false;
   } // end of checknotnull if


   if (l_int_dot_pos == -1) // checks for dot opertor
   {
      alert(TXT_Var14078);
      l_frm_control.select();
      return false;
   } // end of dot operator check if

   if(l_str_filename.match(OBJ_KEY_STAR))
   {
      alert(TXT_Var14079);
      l_frm_control.select();
      return false;
   } // end of dot operator check if

   // checks for the allowed image format
   l_str_ext =l_str_ext.toLowerCase();
   if (!(l_str_ext == STR_GIF_L || l_str_ext == STR_JPG_L || l_str_ext == STR_JPEG_L || l_str_ext == STR_GIF_U || l_str_ext == STR_JPG_U || l_str_ext == STR_JPEG_U || l_str_ext == 'png' || l_str_ext == 'PNG'))
   {
      alert(TXT_Var14093);
      l_frm_control.select();
      return false;
   } // end of allowed image format check if


      var file_separator = '';
   if(l_str_filename.lastIndexOf(STR_SLACE) != -1)
   {
      file_separator = STR_SLACE;
   }
   if(l_str_filename.lastIndexOf(STR_DSLACE) != -1)
   {
         file_separator = STR_DSLACE;
   }
   if ( (l_str_filename.lastIndexOf(STR_COLON) != -1) && (l_str_user_agent.indexOf('Gecko') != -1) && (l_str_user_agent.indexOf('Mac') != -1) )
   {
      file_separator = STR_COLON;
   }
   if(file_separator.length > 0)
   {
   //--SGV 16.0 Modified deu to allow empty space--------------------------------------
      /*if(l_str_filename.substring(l_str_filename.lastIndexOf(file_separator)).match(OBJ_KEY_EMPTY))
               {
                       alert(TXT_Var14081);
                         l_frm_control.select();
                         return false;
                 }*/
    //--------------------------------------------------------------------------------------------------		
   }

   return true;
} // end of checkImageNamePNG function

//--------------

// function returns true/false
function checkWapImageName(l_frm_control)
{
   var l_str_ext = ""; // variable to store the characters after dot position
   var l_str_filename = ""; // local variable to store the string
   var l_int_dot_pos = ""; // variable to store the postion of dot
   var l_b_alpha; // boolean variable to check for alphanumeric value

   if (checkNotNull(l_frm_control) == false) // check for not null function
   {
      return false;
   } // end of checknotnull if

   l_str_filename = l_frm_control.value;
   l_str_filename = removeDoubleQuotes(l_str_filename);
   l_frm_control.value = l_str_filename;
   l_int_dot_pos = l_str_filename.lastIndexOf(STR_DOT);

   if(l_str_filename.match(OBJ_KEY_STAR))
   {
      alert(TXT_Var14079);
      l_frm_control.select();
      return false;
   } // end of dot operator check if

   l_str_ext = l_str_filename.substring(l_int_dot_pos + 1);

   if (!(l_str_ext == STR_WBMP_L || l_str_ext == STR_WBMP_U)) // checks for the allowed image format
   {
      alert(TXT_Var14104);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   } // end of allowed image format check if

   var file_separator = '';
   if(l_str_filename.lastIndexOf(STR_SLACE) != -1)
   {
      file_separator = STR_SLACE;
   }
   if(l_str_filename.lastIndexOf(STR_DSLACE) != -1)
   {
         file_separator = STR_DSLACE;
   }
   if(file_separator.length > 0)
   {
		//--SGV 16.0 Modified deu to allow empty space--------------------------------------
      if(l_str_filename.substring(l_str_filename.lastIndexOf(file_separator)).match(OBJ_KEY_EMPTY))
      {
         alert(TXT_Var14081);
         l_frm_control.select();
         return false;
      }
   }

   return true;
} // end of checkWapImageName function

// function to remove the double quotes
function removeDoubleQuotes(l_str_string)
{
   if (l_str_string.substring(0,1) == STR_QUOTES && l_str_string.substring(l_str_string.length - 1, l_str_string.length) == STR_QUOTES)
   { // checks for double quotes
      l_str_string = l_str_string.substring(1);
      l_str_string = l_str_string.substring(0,l_str_string.length-1);
   } // end of double quotes check if
   return l_str_string;
} // end of removeDoubleQuotes function

// function returns true/false
function checkNonZeroPositiveInteger(l_frm_control)
{
   var l_str_string = ""; // local variable to store the string

   if (checkNotNull(l_frm_control) == false) // check for not null function
   {
      return false;
   } // end of checknotnull if

   l_str_string = new String(l_frm_control.value);
   if (!(l_str_string.indexOf(STR_DOT) == -1)) // checks for the next dot operator
   {
      alert(TXT_Var14051);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   } // end of next dot operator if

   if (l_str_string == STR_ZERO ) // checks for zero value
   {
      alert(TXT_Var14107);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   } // end of zero value check if

   if (l_str_string.indexOf(STR_MINUS) >= 0 || l_str_string.indexOf(STR_PLUS) >= 1)
   { // checks for allowed sign
      alert(TXT_Var14052);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   } // end of allowed sign if

   if (isNaN(l_str_string) == true) // checks for not a number
   {
      alert(TXT_Var14051);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   } // end of not a number if
return true;

} // end of checkPositiveInteger function

//function used for checking the PinCode
function checkPinCode(l_frm_control)
{
   var l_str_string = ""; // local variable to store the string

   if (checkNotNull(l_frm_control) == false) // check for not null function
   {
      return false;
   } // end of checknotnull if

   l_str_string = new String(l_frm_control.value);
   //if(l_str_string.match(/[^0-9 a-zA-Z]/))   //for checking the allowed chars
   if(!(checkForm4UnicodeText(l_str_string, ' ')))   //for checking the allowed chars
   {
      alert(TXT_Var14110);
      l_frm_control.select();
      l_frm_control.focus();
      return false;
   }
return true;

}   //end of pincode checking

function checkCommon(l_frm_control)
{
   var str = new String(l_frm_control.value);

   if(str.indexOf("\\")>=0 || str.indexOf("\"")>=0 || str.indexOf(STR_BRACE_0)>=0 || str.indexOf(STR_BRACE_1)>=0 || str.indexOf("<")>=0 || str.indexOf(">")>=0 || str.indexOf("'")>=0)
   {
         alert('The characters  \" \\ { } < > \' are not allowed. Please verify your input.');
         l_frm_control.select();
         l_frm_control.focus();
         return false;
   }
   return true;
}


/*
 The function checks with alphanumeric only
*/
function checkForm1UnicodeText(l_str_string)
{
   var l_bln_control = true;  //control
   //loop for avail chars
   for(var l_int_i=0; l_int_i < l_str_string.length; l_int_i++)
   {
      //alert(l_str_string.charCodeAt(l_int_i))
      //checks char code rang
      if (!(((l_str_string.charCodeAt(l_int_i) >= INT_APLPH_LW_START && l_str_string.charCodeAt(l_int_i) <= INT_APLPH_LW_END) ||  (l_str_string.charCodeAt(l_int_i) >= INT_APLPH_UP_START && l_str_string.charCodeAt(l_int_i) <= INT_APLPH_UP_END) || (l_str_string.charCodeAt(l_int_i) >= INT_NUM_START && l_str_string.charCodeAt(l_int_i) <= INT_NUM_END))))
         l_bln_control = false;
   }
   return l_bln_control;
}

/*
 The function checks with alpha only
*/
function checkForm2UnicodeText(l_str_string)
{
   var l_bln_control = true;  //control
   //loop for avail chars
   for(var l_int_i=0; l_int_i < l_str_string.length; l_int_i++)
   {
      //checks char code rang
      if (!(((l_str_string.charCodeAt(l_int_i) >= INT_APLPH_LW_START && l_str_string.charCodeAt(l_int_i) <= INT_APLPH_LW_END) ||  (l_str_string.charCodeAt(l_int_i) >= INT_APLPH_UP_START && l_str_string.charCodeAt(l_int_i) <= INT_APLPH_UP_END))))
         l_bln_control = false;
   }
   return l_bln_control;
}
/*
 The function checks with alpha and also supports few specified character
*/
function checkForm3UnicodeText(l_str_string,l_str_ext_chars)
{
   var l_bln_control = true;  //control
   var l_arr_ext_chars = l_str_ext_chars.split("||"); //chars set
   // loop for avail
   for(var l_int_i=0; l_int_i < l_str_string.length; l_int_i++)
   {
      var l_bln_state = false;   //internal control
      //checks rangs
      if(!(((l_str_string.charCodeAt(l_int_i) >= INT_APLPH_LW_START && l_str_string.charCodeAt(l_int_i) <= INT_APLPH_LW_END) ||  (l_str_string.charCodeAt(l_int_i) >= INT_APLPH_UP_START && l_str_string.charCodeAt(l_int_i) <= INT_APLPH_UP_END))))
      {
         //is it non empty
         if(!(l_str_ext_chars == ''))
         {
            //special chars range
            for(var l_int_j=0; l_int_j < l_arr_ext_chars.length; l_int_j++)
            {
               //compare chars
               if(l_str_string.charAt(l_int_i) == l_arr_ext_chars[l_int_j])
               {
                  l_bln_state = true;
                  break;
               }
            }
            //opposite compare
            if(l_bln_state == false)
               l_bln_control = false;
         }
      }
   }
   return l_bln_control;
}

/*
 The function checks with alphnumeri and also supports few specified character
*/
function checkForm4UnicodeText(l_str_string,l_str_ext_chars)
{
   var l_bln_control = true;  //control
   var l_arr_ext_chars = l_str_ext_chars.split("||"); //chars set
   // loop for avail
   for(var l_int_i=0; l_int_i < l_str_string.length; l_int_i++)
   {
      var l_bln_state = false;   //internal control
      //checks rangs
      if(!(((l_str_string.charCodeAt(l_int_i) >= INT_APLPH_LW_START && l_str_string.charCodeAt(l_int_i) <= INT_APLPH_LW_END) ||  (l_str_string.charCodeAt(l_int_i) >= INT_APLPH_UP_START && l_str_string.charCodeAt(l_int_i) <= INT_APLPH_UP_END) || (l_str_string.charCodeAt(l_int_i) >= INT_NUM_START && l_str_string.charCodeAt(l_int_i) <= INT_NUM_END))))
      {
         //is it non empty
         if(!(l_str_ext_chars == ''))
         {
            //special chars range
            for(var l_int_j=0; l_int_j < l_arr_ext_chars.length; l_int_j++)
            {
               //compare chars
               if(l_str_string.charAt(l_int_i) == l_arr_ext_chars[l_int_j])
               {
                  l_bln_state = true;
                  break;
               }
            }
            //opposite compare
            if(l_bln_state == false)
               l_bln_control = false;
         }
      }
   }
   return l_bln_control;
}


function newcheckAlphaNumericOnly(l_frm_control)
{
   var l_str_string = ""; // local variable to store the string
   var l_int_length = -1;// local variable to store the length of string

   if (checkNotNull(l_frm_control) == false) // check for not null function
   {
      return false
   } // end of checknotnull if

   l_str_string = new String(l_frm_control.value);
   l_int_length = l_str_string.length;

   for(l_int_i = 0; l_int_i < l_int_length; ++l_int_i) // start of for loop
   {
      if (!((l_str_string.charCodeAt(l_int_i) >= 97 && l_str_string.charCodeAt(l_int_i) < 123) ||  (l_str_string.charCodeAt(l_int_i) >= 65 && l_str_string.charCodeAt(l_int_i) <91 ) || (l_str_string.charCodeAt(l_int_i) >= 48 && l_str_string.charCodeAt(l_int_i) <= 57)))
      { // checks for alphanumeric value
         alert(TXT_Var14017);
         l_frm_control.select();
         l_frm_control.focus();
         return false;
      } // end of alphanumeric value check if
   } // end of for loop

   return true;
} // end of checkAlphaNumericOnly function

function newcheckAlphaNumericOnlyUN(l_frm_control)
{
   var l_str_string = ""; // local variable to store the string
   var l_int_length = -1;// local variable to store the length of string

   if (checkNotNull(l_frm_control) == false) // check for not null function
   {
      return false
   } // end of checknotnull if

   l_str_string = new String(l_frm_control.value);
   l_int_length = l_str_string.length;

   for(l_int_i = 0; l_int_i < l_int_length; ++l_int_i) // start of for loop
   {
      // alert("l_str_string.charAt(l_int_i)=" + l_str_string + ".charAt(" + l_int_i + ") = " + l_str_string.charAt(l_int_i));
      if ( !((l_str_string.charCodeAt(l_int_i) >= 97 && l_str_string.charCodeAt(l_int_i) < 123) ||  (l_str_string.charCodeAt(l_int_i) >= 65 && l_str_string.charCodeAt(l_int_i) <91 ) || (l_str_string.charCodeAt(l_int_i) >= 48 && l_str_string.charCodeAt(l_int_i) <= 57) || (l_str_string.charAt(l_int_i) == '-') || (l_str_string.charAt(l_int_i) == '_') || (l_str_string.charAt(l_int_i) == '.')) )
      { // checks for alphanumeric value
         alert(TXT_Var14022);
         l_frm_control.select();
         l_frm_control.focus();
         return false;
      } // end of alphanumeric value check if
   } // end of for loop

   return true;
} // end of newcheckAlphaNumericOnlyUN function

function newcheckAlphaNumeric(l_frm_control)
{
   var l_str_string = ""; // local variable to store the string
   var l_int_length = -1;// local variable to store the length of string

   if (checkNotNull(l_frm_control) == false) // check for not null function
   {
      return false
   } // end of checknotnull if

   l_str_string = new String(l_frm_control.value);
   l_int_length = l_str_string.length;

   for(l_int_i = 0; l_int_i < l_int_length; ++l_int_i) // start of for loop
   {
      //alert(l_str_string.charCodeAt(l_int_i)+"*"+"*")
      if (!((l_str_string.charCodeAt(l_int_i) >= 97 && l_str_string.charCodeAt(l_int_i) < 123) ||  (l_str_string.charCodeAt(l_int_i) >= 65 && l_str_string.charCodeAt(l_int_i) <91 ) || (l_str_string.charCodeAt(l_int_i) >= 48 && l_str_string.charCodeAt(l_int_i) <= 57) || l_str_string.charCodeAt(l_int_i) ==32 || l_str_string.charCodeAt(l_int_i) ==46))
      { // checks for alphanumeric value
         alert(TXT_Var14017);
         l_frm_control.select();
         l_frm_control.focus();
         return false;
      } // end of alphanumeric value check if
   } // end of for loop

   return true;
} // end of checkAlphaNumericOnly function

function evalFirstCharacter(domain_name)
{
    var ret_str=true;
    if(domain_name.charAt(0)==STR_DOT || domain_name.charAt(domain_name.length-1)==STR_DOT)
      {
        ret_str=false;
      }
      if(domain_name.charAt(0)==STR_MINUS || domain_name.charAt(domain_name.length-1)==STR_MINUS)
      {
         ret_str=false;
      }
      return ret_str;
}
