﻿
function ValidateTextBoxNull ( textBox, controlText, maximumLength )
{
     var textBoxValue = document.getElementById ( textBox ).value;
     if( textBoxValue == "" )
     {
        alert( 'please enter '+ controlText + ' in the textBox .');
        document.getElementById ( textBox ).focus() ;
        return false ;
     }
     else if ( ValidateTextBoxTrim ( textBox, controlText, maximumLength ) == false )
        return false ;
     else
        return true ;
}

function ValidateTextBoxTrim ( textBox, controlText, maximumLength )
{
    var textBoxValue = document.getElementById ( textBox ).value ;   
    var inValidCharacter = false;
    var index = 0 ;           
    for ( var i =0; i < textBoxValue.length; i++ )
    {
        if ( textBoxValue.charAt ( i ) != ' ' )
            inValidCharacter = true;        
    }
    while ( textBoxValue.charAt ( index ) == ' ')
        index = index + 1;
    textBoxValue = textBoxValue.substring ( index, textBoxValue.length );
    index = textBoxValue.length - 1 ;     
    while ( textBoxValue.charAt ( index ) == ' ')
    {
        textBoxValue = textBoxValue.substring ( 0, index );                 
        index = index - 1;         
    } 
    if ( inValidCharacter == false ) 
    {
      alert ('please enter valid ' + controlText + ' in the textBox .'); 
      document.getElementById ( textBox ).value = textBoxValue;
      document.getElementById ( textBox ).focus();           
      return false;
    }
    else if ( textBoxValue.length > maximumLength )
    {
        alert ( 'maximum length of '+ controlText + ' is '+ maximumLength ); 
        document.getElementById ( textBox ).focus();  
        return false;
    }
    else
    {
        document.getElementById ( textBox ).value = textBoxValue;        
        return true;
    }
}

function ValidateFileUploadFileLength  ( textBox , controlText, maximumLength )
{
    var textBoxValue = document.getElementById ( textBox ).value ;
    var textValue= textBoxValue.split ("\\");
    var fileName = textValue [ textValue.length -1 ].split(".");
    if ( fileName [0].length > maximumLength )
    {
        alert ( 'maximum length of '+ controlText + ' is '+ maximumLength ); 
        document.getElementById ( textBox ).focus();
        return false;
    }
    else            
        return true;   
}

function ValidateTextBoxField ( textBox , controlText )
{
    var textBoxValue = document.getElementById ( textBox ).value;
    var inValidCharacter = false;   
    var isLowerAlphabets = "abcdefghijklmnopqrstuvwxyz ";
    var isUpperAlphabets = "ABCEDEFGHIJKLMNOPQRSTUVWXYZ";    
    for ( var j=0 ; j < textBoxValue.length; j++ )
    {
        if ( ( isLowerAlphabets.indexOf ( textBoxValue .charAt ( j ) ) == -1 ) && ( isUpperAlphabets.indexOf ( textBoxValue .charAt ( j ) ) == -1 ) )
        {
            inValidCharacter = true;  
            break;                               
        }
    }
    if ( inValidCharacter  == true )
    {
        alert ( 'please enter valid ' + controlText + ' in the textBox .');
        document.getElementById ( textBox ).focus( );
        return false;
    }
    else     
        return true;    
}

function ValidateTextBoxFieldMoney ( textBox , controlText )
{
    var textBoxValue = document.getElementById ( textBox ).value; 
    regularExpression = new RegExp("^[0-9]+(.[0-9]{2})?$");
    if ( textBoxValue.charAt ( 1 ) == ' ' )
    {
        alert ( 'please enter valid '+ controlText + ' in the textBox [ 1234.56 ] .' );
        document.getElementById ( textBox ).focus();
        return false;           
    }
    else if (( regularExpression.test ( textBoxValue ) == false ))
    {
        alert ( 'please enter valid '+ controlText + ' in the textBox [ 1234.56 ].' );
        document.getElementById ( textBox ).focus();
        return false;
    }
    else  
        return true;    
} 

function ValidateTextBoxFieldIntegers ( textBox , controlText  )
{
    var textBoxValue = document.getElementById ( textBox ).value;
    regularExpression = new RegExp ( "(^[0-9]*)$" );
    if ( regularExpression.test ( textBoxValue ) == false )
    {
        alert ( 'please enter valid '+ controlText + ' in the textBox .');
        document.getElementById ( textBox ). focus ();
        return false;
    } 
    else
        return true;     
}

function ValidateTextBoxFieldEmailId ( textBox ,controlText )
{
    var textBoxValue = document.getElementById ( textBox ).value;    
    objectRegularExpression = new RegExp ( "^[a-zA-Z0-9]([a-zA-Z0-9\_\.]*)@([a-zA-Z_\.]+)([.][a-zA-Z]{2})([.][a-zA-Z]{2})$" );
    objectRegularExpression1 = new RegExp ("^[a-zA-Z0-9]([a-zA-Z0-9\_\.]*)@([a-zA-Z_\.]+)([.][a-zA-Z]{3})$" ); 
    if ( ( objectRegularExpression.test ( textBoxValue ) == false ) && ( objectRegularExpression1.test ( textBoxValue ) == false ) )
    {        
        alert ('please enter valid '+ controlText + ' in the textBox .');
        document.getElementById ( textBox ).focus();
        return false;            
    }    
    else
          return true;    
 }

function ValidateFileUpload ( fuFileUpload, controlText, maximumLength  )
{
     var fuFileUploadValue = document.getElementById ( fuFileUpload ).value;     
     if ( fuFileUploadValue == "" )
     {
        alert ( 'please select '+ controlText +' using browse button.' );
        document.getElementById ( fuFileUpload ).focus();
        return false ;
     }
     else if ( ValidateFileUploadFileLength ( fuFileUpload , controlText , maximumLength  ) == false )
        return false;
     else
        return true ;
}

function ValidateDropDownSelect ( ddlDropDownList, controlText  )
{
    var ddlDocKetNumberValue = document.getElementById ( ddlDropDownList ).value;        
    var ddlDocKetNumberIndex = document.getElementById ( ddlDropDownList ).selectedIndex;   
    if( ddlDocKetNumberIndex == 0  )
    {        
        alert ('please select '+ controlText +' from dropdownList.' );
        document.getElementById ( ddlDropDownList ).focus() ;
        return false ;
    }
    else
        return true ;        
}

function ValidateGetDropDownSelectIndex ( ddlDropDownList )
{    
    var ddlDocKetNumberIndex = document.getElementById ( ddlDropDownList ).selectedIndex;   
    if( ddlDocKetNumberIndex == 0  )
        return true ;
    else
        return false ;        
}

function ValidatePage ( ddlDocKetNumber, postedDate, effectiveDate )
{
    if ( ValidateDropDownSelect ( ddlDocKetNumber ) == false )
        return false;
    else if ( ValidateDate ( postedDate ) == false )
        return false;
    else if ( ValidateDate ( effectiveDate ) == false )
        return false;
    else
        return true;
}

function ValidateDate ( objectValue )
{
    var dateValue="";
    var iteration=0;
    var year="";
    var month="";
    var day="";
    var numberOfDays="";
    var firstSymbol="";
    var secondSymbol="";
    var thirdSymbol="";
    var monthDayValue="";    
    dateValue=document.getElementById ( objectValue ).value;            
    if ( dateValue=="" )
    {
        alert ( 'textBox cannot be Empty.' );
        document.getElementById ( objectValue ).focus();
        return false;
    }
    else if ( dateValue.length<7 || dateValue.length>10 )
    {
        alert ( 'please enter date in correct format ( MM/DD/YYYY ).' );
        document.getElementById ( objectValue ).focus();
        return false;
    }
    else
    {
        if ( dateValue.length == 8 )
        {            
            year = dateValue.substr ( 4,4 );            
            if ( dateValue.charAt ( 0 ) > 0 && dateValue.charAt ( 2 ) >0 && year > 0 )
            {
                firstSymbol=dateValue.charAt ( 1 );
                secondSymbol=dateValue.charAt( 3 );
                if ( ( firstSymbol == "-" || firstSymbol == "/") && ( secondSymbol == "-" || secondSymbol == "/" ) )
                    return true;
                else
                {
                    alert ( 'please enter date in correct format ( MM-DD-YYYY (or) MM/DD/YYYY ).' );
                    document.getElementById ( objectValue ).focus();
                    return false;
                }
            }
            else
            {
                alert ( 'Month , Day and Year should be greater than Zero' );
                document.getElementById ( objectValue ).focus();
                return false;
            }
        }
        else if ( dateValue.length == 9 )
        {
            monthDayValue=dateValue.substr ( 0,5 );
            firstSymbol=dateValue.charAt ( 1 );
            secondSymbol=dateValue.charAt ( 2 );
            thirdSymbol=dateValue.charAt ( 4 );
            if( ( firstSymbol=="-" || firstSymbol=="/" ) && ( thirdSymbol=="-" || thirdSymbol=="/" ) )
            {
                month=dateValue.substr ( 0,1 );
                day=dateValue.substr ( 2,2 );
                year=dateValue.substr ( 5,4 );                
                if( ( month > 0 && month < 13 ) && ( day > 0 && day <= GetNumberOfDays ( month, year )) && year >0 )
                    return true;
                else
                {
                    alert ( 'date you have entered was wrong. (MM/DD/YYYY).' );
                    document.getElementById ( objectValue ).focus();
                    return false;
                }
            }
            else if( ( secondSymbol=="-" || secondSymbol=="/" ) && ( thirdSymbol=="-" || thirdSymbol=="/" ) )
            {
                month=dateValue.substr ( 0, 2 );
                day=dateValue.substr ( 3, 1 );
                year=dateValue.substr ( 5, 4 );
                if( ( month > 0 && month < 13 ) && ( day > 0 && day <= GetNumberOfDays ( month, year ) ) && year > 0 )
                    return true;
                else
                {
                    alert ( 'date you have entered was wrong. (MM/DD/YYYY).' );
                    document.getElementById ( objectValue ).focus( );
                    return false;
                }                
            }
            else
            {
                alert ( 'please enter date in correct format ( MM-DD-YYYY (or) MM/DD/YYYY ).' );
                document.getElementById ( objectValue ).focus();
                return false;
            }
        }
        else if( dateValue.length == 10 )
        {
            year = dateValue.substr ( 6, 4 );
            month = dateValue.substr( 0, 2 );
            day = dateValue.substr ( 3, 2 );                     
            if( ( month > 0 && month < 13 ) && ( day > 0 && day <= GetNumberOfDays ( month, year ) ) && year >0 )
            {
                firstSymbol = dateValue.charAt ( 2 );
                secondSymbol= dateValue.charAt ( 5 );
                if( ( firstSymbol == "-" || firstSymbol == "/" ) && ( secondSymbol == "-" || secondSymbol == "/" ) )
                    return true;
                else
                {
                    alert ( 'please enter date in correct format ( MM-DD-YYYY (or) MM/DD/YYYY ).' );
                    document.getElementById ( objectValue ) .focus();
                    return false;
                }
            }   
            else
            {
                alert ( 'date you have entered was wrong. (MM/DD/YYYY)' );
                document.getElementById ( objectValue ).focus();
                return false;    
            }
        }     
    }
}

function GetNumberOfDays ( month, year )
{
    var numberOfDays = 0;
    switch ( month )
    {
        case "1":
            numberOfDays = 31;
            break;
        case "2":
            if ( ( ( year%4 ) == 0 ) && ( ( year%100 ) != 0 ) || ( ( year%400 ) == 0 ) )
                numberOfDays = 29;
            else
                numberOfDays = 28;
            break;
        case "3":
            numberOfDays = 31;
            break;
        case "4":
            numberOfDays = 30;
            break;
        case "5":
            numberOfDays = 31;
            break;
        case "6":
            numberOfDays = 30;
            break;
        case "7":
            numberOfDays = 31;
            break;
        case "8":
            numberOfDays = 31;
            break;
        case "9":
            numberOfDays = 30;
            break;
        case "01":
            numberOfDays = 31;
            break;
        case "02":
            if ( ( ( year%4 ) == 0 ) && ( ( year%100 ) != 0 ) || ( ( year%400 ) == 0 ) )
                numberOfDays = 29;
            else
                numberOfDays = 28;
            break;
        case "03":
            numberOfDays = 31;
            break;
        case "04":
            numberOfDays = 30;
            break;
        case "05":
            numberOfDays = 31;
            break;
        case "06":
            numberOfDays = 30;
            break;
        case "07":
            numberOfDays = 31;
            break;
        case "08":
            numberOfDays = 31;
            break;
        case "09":
            numberOfDays = 30;
            break;
        case "10":
            numberOfDays = 31;
            break;
         case "11":
            numberOfDays = 30;
            break;
         case "12":
            numberOfDays = 31;
            break;
    }
    return numberOfDays;
}

function ValidateCancelDropDownList ( ddlDropDownList )
{
    document.getElementById ( ddlDropDownList ).options[0].selected=true;    
    return true;
}

function ValidateCancelTextBox ( txtBox )
{
    document.getElementById ( txtBox ).value = '\0';     
    return true;   
}

function ValidateCancelFileUpload ( fuFileUpload )
{
    var fileUpload = document.getElementById ( fuFileUpload ); 
    var fileUploadEmpty = fileUpload.cloneNode ();  
    fileUpload.parentNode.replaceChild ( fileUploadEmpty, fileUpload );
    return true;
}

function ValidateHours ( txtBox , controlText )
{
    if ( document.getElementById ( txtBox ).value > 23 )
    { 
        alert( 'please enter '+ controlText + ' within 23 hours in the textBox .');
        document.getElementById ( txtBox ).focus ();
        return false;
    }
    else 
        return true;
}

function ValidateMinutes ( txtBox, controlText )
{
    var textBoxValue = document.getElementById ( txtBox ).value;
    if ( textBoxValue > 59)
    {
        alert( 'please enter '+ controlText + ' minutes less than 59 in the textBox .');
        document.getElementById ( txtBox ).focus ();
        return false;
    }
    else
        return true;    
}

function ValidateTime ( txtBoxHours , txtBoxMinutes )
{
    var txtBoxHoursValue = document.getElementById ( txtBoxHours ).value;
    var txtBoxMinutesValue = document.getElementById ( txtBoxMinutes ).value;      
    if( txtBoxMinutesValue == 0 && txtBoxHoursValue == 0 )
    {
        alert ( ' please enter minutes in the textBox. ');
        document.getElementById ( txtBoxMinutes ).focus ();      
        return false;     
    }
    else
        return true;
}

function ValidateTextBoxEmpty ( textBox, controlText, maximumLength )
{
     var textBoxValue = document.getElementById ( textBox ).value;
     if( textBoxValue == "" )
     {        
        document.getElementById ( textBox ).focus() ;
        return false ;
     }
     else if ( ValidateTextBoxTrim ( textBox, controlText, maximumLength ) == false )
        return false ;
     else
        return true ;
}

function ValidateRadioButtonList ( rblControl, controlText, controls )
{
    var count = 0;
    var iteration = 0;
    var radioButtonList = document.getElementById ( rblControl ).getElementsByTagName('input');
    for ( iteration = 0 ; iteration < radioButtonList.length ; iteration++ )
    {
        if ( radioButtonList [ iteration ].checked == false )        
            count++;
    }         
    if ( count == controls )
    {
        alert('please check '+ controlText+' from the radio buttons.');
        return false;
    }
    else
        return true;
}

function ResetRadioButtonList ( controlName )
{
    var iteration = 0 ;    
    var radioButtonList = document.getElementById ( controlName ).getElementsByTagName ( 'input' );
    for ( iteration = 0 ; iteration < radioButtonList.length ; iteration++ )
    {
        radioButtonList [ iteration ].checked = false ;
    }
    return false;
}

function ValidateTextBoxFieldPercentage ( textBox , controlText )
{
    var textBoxValue = document.getElementById ( textBox ).value; 
    regularExpression = new RegExp("^([0-9]{0,2})(.[0-9]{1,2})?$");
    if ( textBoxValue.charAt ( 1 ) == ' ' )
    {
        alert ( 'please enter valid '+ controlText + ' in the textBox [ 01.34 ].' );
        document.getElementById ( textBox ).focus();
        return false;           
    }
    else if ( ( regularExpression.test ( textBoxValue ) == false ) )
    {
        alert ( 'please enter valid '+ controlText + ' in the textBox [ 01.34 ].' );
        document.getElementById ( textBox ).focus();
        return false;
    }
    else if ( textBoxValue.length == 4 || textBoxValue.length == 5 )
    {
        if ( textBoxValue.charAt ( 2 ) != '.' )
        {
            alert ( 'please enter valid '+ controlText + ' in the textBox [ 01.34 ].' );
            document.getElementById ( textBox ).focus();
            return false;
        }
    }
    else  
        return true;    
} 

function ValidatePassportNumber( textBox , controlText )
{
    var textBoxValue = document.getElementById ( textBox ).value; 
    regularExpression = new RegExp("^[A-Z][A-Z0-9]*$");    
    if ( textBoxValue.charAt ( 1 ) == ' ' )
    {
        alert ( 'please enter valid '+ controlText + ' in the textBox.' );
        document.getElementById ( textBox ).focus();
        return false;           
    }
    else if (( regularExpression.test ( textBoxValue ) == false ) )
    {
        alert ( 'please enter valid '+ controlText + ' in the textBox.' );
        document.getElementById ( textBox ).focus();
        return false;
    }
    else  
        return true;    
} 

function ValidateTextBoxFieldCollegeName ( textBox , controlText )
{
    var textBoxValue = document.getElementById ( textBox ).value;
    var inValidCharacter = false;   
    var isLowerAlphabets = "abcdefghijklmnopqrstuvwxyz.\' ";
    var isUpperAlphabets = "ABCEDEFGHIJKLMNOPQRSTUVWXYZ";             
    for ( var j=0 ; j < textBoxValue.length; j++ )
    {
        if ( ( isLowerAlphabets.indexOf ( textBoxValue .charAt ( j ) ) == -1 ) && ( isUpperAlphabets.indexOf ( textBoxValue .charAt ( j ) ) == -1 ) )
        {
            inValidCharacter = true;  
            break;                               
        }
    }
    if ( textBoxValue.charAt (0) == '.' || textBoxValue.charAt ( textBoxValue.length-1 ) == '.' )
    {
        document.getElementById ( textBox ).focus( );
        inValidCharacter=true;       
    }
    if ( textBoxValue.charAt (0) == '\'' || textBoxValue.charAt ( textBoxValue.length-1 ) == '\'' )
    {
        document.getElementById ( textBox ).focus( );
        inValidCharacter=true;       
    }    
    if ( inValidCharacter  == true )
    {
        alert ( 'please enter valid ' + controlText + ' in the textBox .');
        document.getElementById ( textBox ).focus( );
        return false;
    }   
    else     
        return true;    
}

function ValidateUploadedFileExtensionSize ( fuFileUpload, controlText, extension, maximumLength  )
{
    var fuFileUploadValue = document.getElementById ( fuFileUpload ).value;       
    var fileExtension = fuFileUploadValue.split ( "." );
    var extensions = extension.split ( "." ) ; 
    if ( extensions[1] == null )
        extensions[1] = extensions[0];
    if ( fuFileUploadValue != "" )
    {
        if ( fileExtension[1] == extensions[0] || fileExtension[1] == extensions[1] )    
            return true;    
        else 
        {
            alert ( 'please select only .'+ extensions[0] + ' or .'+ extensions[1] +' files ');
            document.getElementById ( fuFileUpload ).focus ();
            return false;    
        }
    }
    else
        return true;
}

function ValidateDeleteSelectedCheckBoxes ( gvViewList )
{
    var gridViewControl = document.getElementById ( gvViewList );
    var inputs = gridViewControl.getElementsByTagName('input');        
    var checked = false;   
    for ( var iteration = 0; iteration < inputs.length ; iteration ++)
    {
        if ( inputs [ iteration ].type == 'checkbox' && inputs[iteration].checked )
        {
            checked = true;           
            break;
        }                
    }    
    if ( checked == true )
    {
        if ( confirm('Are you sure you want to delete the records ?' ))
            return true;  
        else 
            return false;                      
    }
    else 
    {
        alert ( 'please select a record to delete.' );
        return false;
    }
}

function SelectGridViewCheckBoxes ( gridViewControl )
{
    var iteration = 0;
    var checked = false;
    var gridViewControl = document.getElementById ( gridViewControl ).getElementsByTagName('input');
    for ( iteration = 0; iteration < gridViewControl.length ; iteration ++ )
    {
        if ( gridViewControl[ iteration ].type == 'checkbox' && gridViewControl[ iteration ].checked == false )
            gridViewControl[ iteration ].checked = true ;
    }
    return false ;
}

function DeSelectGridViewCheckBoxes ( gridViewControl )
{
    var iteration = 0;
    var checked = false;
    var gridViewControl = document.getElementById ( gridViewControl ).getElementsByTagName('input');
    for ( iteration = 0; iteration < gridViewControl.length ; iteration ++ )
    {
        if ( gridViewControl[ iteration ].type == 'checkbox' && gridViewControl[ iteration ].checked == true )
            gridViewControl[ iteration ].checked = false ;
    }
    return false ;
}

function ValidateGridViewCheckBoxes ( gridViewControl, textToDisplayInAlertMessage )
{
    var iteration = 0;
    var checked = false;  
    var gridViewControl = document.getElementById ( gridViewControl ).getElementsByTagName('input');        
    for ( iteration = 0; iteration < gridViewControl.length ; iteration ++ )
    {
        if ( gridViewControl[ iteration ].type == 'checkbox' && gridViewControl[ iteration ].checked )
        {
            checked = true;
            break;
        }                
    }    
    if ( checked == true )
    {
       return true;
    }
    else 
    {
        alert ( textToDisplayInAlertMessage );
        return false;
    }
}

function DisableControls ( ddlDropDownList, txtTextBox )
{
    document.getElementById ( ddlDropDownList ).disabled = true ;
    document.getElementById ( txtTextBox ).focus() ;
    return false;
}

function EnableControls ( ddlDropDownList, txtTextBox )
{
    var textBoxValue = document.getElementById ( txtTextBox ).value;
    if ( textBoxValue == "" )
        document.getElementById ( ddlDropDownList ).disabled = false ;
    else
        document.getElementById ( ddlDropDownList ).disabled=true ;
    return false;
}

function DisableTextbox ( txtTextbox )
{
    document.getElementById ( txtTextbox ).disabled = true ;    
    return false ;
}

function EnableTextbox ( txtTextbox )
{
    document.getElementById ( txtTextbox ).disabled = false ;    
    return false;
}

function DisplayImage (  fuProductImage, imgProductPreview )
{
    var imgPreview = document.getElementById ( imgProductPreview );
    imgPreview.style.visibility = "visible";
    var fileUploadControl = document.getElementById ( fuProductImage ).value;
    imgPreview.src = fileUploadControl;
    return true;
}

function ValidateAlphaNumericWithSpace( textBox , controlText )
{
    var textBoxValue = document.getElementById ( textBox ).value; 
    regularExpression = new RegExp("^[a-zA-Z][ A-Za-z0-9]*$");       
    if (( regularExpression.test ( textBoxValue ) == false ) )
    {
        alert ( 'please enter valid '+ controlText + ' in the textBox.' );
        document.getElementById ( textBox ).focus();
        return false;
    }
    else  
        return true;    
} 

function InVisibleControl ( imgControl )
{
    var control = document.getElementById ( imgControl ) ;
    control.style.visibility = "hidden"; 
    return false;   
}

function VisibleControl ( controlName ) 
{
    var control = document.getElementById ( controlName ) ;
    control.style.visibility = "visible"; 
    return true;   
}

function ValidatePasswordLength ( txtPassword )
{
    var password= document.getElementById ( txtPassword ).value;
    if ( password.length < 5 )
    {
        alert ( 'Password length should be greater than four ( 4 Digits ).'); 
        document.getElementById ( txtPassword ).focus();
        return false;
    }
    else
        return true;
}

function ValidateConfirmPassword ( txtPassword, txtConfirmPassword )
{
    var password= document.getElementById ( txtPassword ).value;
    var confirmPassword =  document.getElementById ( txtConfirmPassword ).value;
    if ( password != confirmPassword)
    {
        alert ( 'Password and Confirm Password does not match.'); 
        document.getElementById ( txtConfirmPassword ).focus();
        return false;
    }
    else
        return true;
}

function ValidateCheckBox ( cbCheckBox, controlText )
{
    var checkBoxValue = document.getElementById ( cbCheckBox );
    if ( checkBoxValue.checked == true )
        return true;
    else
    {
        alert ( 'Please click '+ controlText +' check box.' ); 
        document.getElementById ( cbCheckBox ).focus();
        return false;
    }
}

//function checkNum(evt) 
//{
//    var carCode = (evt.which) ? evt.which : event.keyCode
//    if (carCode > 31 && (carCode < 48) || (carCode > 57)) {
//    {
//        alert ( 'Please enter only numeric characters.' );         
//        return false;
//    }
//}
