//Following function does not allow any key to press 
function TextBoxKeyPressNotAllow(keycode)
{
   return false;   
}
//  Follwing function accepts A-Z, a-z, 0-9, Backspace, - ,Arrow Marks
function AlphaNumericKepPress(keycode)
{
    if (((keycode < 65) || (keycode > 90)) && ((keycode < 95) || (keycode > 122)) && ((keycode < 48) || (keycode > 57)) && (keycode != 32) && (keycode != 45)) 
        return false;
    else
        return true;
}

//  Follwing function accepts A-Z, a-z, 0-9 , ., /, (, ), {, }, [, ], Space, comma, -, _ ,&,+
function DocExtTextKeyPress(keycode)
{
    if (((keycode < 65) || (keycode > 91)) && ((keycode < 97) || (keycode > 122)) && ((keycode < 44) || (keycode > 57)) && (keycode != 32) && (keycode != 40) &&  (keycode != 41) 
        && (keycode != 95) && (keycode != 93) && (keycode != 123) && (keycode != 125) && (keycode != 38) && (keycode != 43)) 
       return false;
    else
        return true;
}
//  Follwing function accepts A-Z, a-z, 0-9,  - ,-
function LoginNameKeyPress(keycode)
{  
    if (((keycode < 65) || (keycode > 90)) && ((keycode < 97) || (keycode > 122)) && ((keycode < 48) || (keycode > 57))  && (keycode != 45)  && (keycode != 95) && (keycode != 13)) 
        return false;
    else
        return true;
}

//  Follwing function accepts A-Z, a-z, 0-9 and special character except & <
function PasswordKeyPressWithSpecialChar(keycode)
{ 
    if (keycode == 13) 
    {
        __doPostBack('imgClose','');
        return false;
    }
    else if (keycode == 38 || keycode == 60)
        return false;
    else
        return true;
}

//  Follwing function accepts A-Z, a-z, 0-9
function PasswordKeyPress(keycode)
{ 
    if (((keycode < 65) || (keycode > 90)) && ((keycode < 97) || (keycode > 122)) && ((keycode < 48) || (keycode > 57)) && (keycode != 13)) 
        return false;
    else
        return true;
}
//  Follwing function accepts A-Z, a-z, 0-9,space
function NameKeyPress(keycode)
{ 
    if (((keycode < 63) || (keycode > 93)) && ((keycode < 97) || (keycode > 126)) && ((keycode < 44) || (keycode > 57)) && (keycode != 32)
        && (keycode != 33) && (keycode != 35) && (keycode != 36) && (keycode != 37) && (keycode != 38) && (keycode != 40) && (keycode != 41) && (keycode != 42)
        && (keycode != 95) && (keycode != 58) && (keycode != 59) ) 
        return false;
    else
        return true;
}
//  Follwing function for Document Title and RefDrawing No. accepts A-Z, a-z, 0-9
function RefDrawingKeyPress(keycode)
{ 
    if (((keycode < 63) || (keycode > 93)) && ((keycode < 97) || (keycode > 126)) && ((keycode < 44) || (keycode > 57)) && (keycode != 13) && (keycode != 32)
        && (keycode != 33) && (keycode != 40) && (keycode != 41) && (keycode != 42) 
        && (keycode!=95) && (keycode != 58) && (keycode != 59)) 
        return false;
    else
        return true;
}
//  Follwing function accepts A-Z, a-z, 0-9 , ., /, (, ), {, }, [, ], Space, comma, -, _ ,&,+
function CommonTextBoxKeyPress(keycode)
{    
    if (((keycode < 63) || (keycode > 93)) && ((keycode < 97) || (keycode > 126)) && ((keycode < 44) || (keycode > 57)) && (keycode != 32) 
    && (keycode!=33) && (keycode != 35) && (keycode != 36) && (keycode != 37) && (keycode != 38) && (keycode != 40) &&  (keycode != 41) && (keycode!=42) 
    && (keycode != 43) && (keycode != 95)  && (keycode != 58) && (keycode != 59) ) 

        return false;
    else
        return true;
}
//  Follwing function accepts A-Z, a-z, 0-9 , ., /, (, ), {, }, [, ], Space, comma, -, _ ,&,+
function CommonSearchTextBoxKeyPress(keycode)
{         
    
    if (((keycode < 63) || (keycode > 93)) && ((keycode < 97) || (keycode > 126)) && ((keycode < 44) || (keycode > 57)) && (keycode != 32) && (keycode != 34)
     && (keycode!=33) && (keycode != 35) && (keycode != 36) && (keycode != 37) && (keycode != 38) && (keycode != 40) &&  (keycode != 41) && (keycode!=42) 
     && (keycode != 43) && (keycode != 95)  && (keycode != 58) && (keycode != 59)) 

        return false;
    else
        return true;
}
//  Follwing function accepts A-Z, a-z, 0-9 , Space, comma,"
function FreeTextSearchTextBoxKeyPress(keycode)
{                 
     if (((keycode < 63) || (keycode > 93)) && ((keycode < 97) || (keycode > 126)) && ((keycode < 44) || (keycode > 57)) && (keycode != 32) && (keycode != 34)
     && (keycode!=33) && (keycode != 35) && (keycode != 36) && (keycode != 37) && (keycode != 38) && (keycode != 40) &&  (keycode != 41) && (keycode!=42) 
     && (keycode != 43) && (keycode != 95)  && (keycode != 58) && (keycode != 59)) 
    {        
        return false;        
    }    
    else
    {
        return true;
    }
}

//  Follwing function accepts A-Z, a-z, 0-9 , .,  (, ), {, }, [, ], Space, comma, -, _ 
function FolderNameKeyPress(keycode)
{ 
    if (((keycode < 65) || (keycode > 91)) && ((keycode < 97) || (keycode > 122)) && ((keycode < 48) || (keycode > 57)) && (keycode != 32) && (keycode != 40) &&  (keycode != 41) && (keycode != 95) && (keycode != 93) && (keycode != 123) && (keycode != 125) &&  (keycode != 44) &&  (keycode != 45) &&  (keycode != 46)) 
        return false;
    else
        return true;
}
//  Follwing function accepts A-Z, a-z, 0-9 , .,  (, ), {, }, [, ], Space, comma, -, _ 
function PhoneNumberKeyPress(keycode)
{
    
   if (((keycode < 65) || (keycode > 91)) && ((keycode < 97) || (keycode > 122)) && ((keycode < 44) || (keycode > 57)) && (keycode != 32) && (keycode != 40) &&  (keycode != 41) && (keycode != 95) && (keycode != 93) && (keycode != 123) && (keycode != 125) ) 
        return false;
    else
        return true;
}
//  Following function accepts only 0-9 numerics
function NumberKeyPress(keycode) 
{     
    if (keycode<48 || keycode>57)
        return false;
    else
        return true;
}

//  Following function accepts only 0-9 numerics and -
function PhoneNoKeyPress(keycode) 
{     
    if ((keycode<48 || keycode>57) && keycode!= 45 && keycode!=44)
        return false;
    else
        return true;
}


//  Following function accepts only 1-9 numerics
function QuantityKeyPress(keycode) 
{     
    if (keycode<49 || keycode>57)
        return false;
    else
        return true;
}

//  Following function accepts only 0-9 numerics &  decimal places also
function NumericKeyPress(keycode) 
{
    if ((keycode<48 || keycode>57) && keycode != 46)
        return false;
    else
        return true;
}
//  Follwing function accepts A-Z, a-z, 0-9, .(dot)
function AlphaNumericAndDotKepPress(keycode)
{
    if (((keycode < 65) || (keycode > 90)) && ((keycode < 97) || (keycode > 122)) && ((keycode < 48) || (keycode > 57))  && (keycode != 46)) 
        return false;
    else
        return true;
}
//  This function will ask for the delete confirmation 
function ConfirmDelete()
{
    return confirm('Do you really want to delete this record ?');
}
//  This function will ask for the delete All confirmation 
function ConfirmDeleteAll(intCount)
{
    if (intCount != 0)
    {
    return confirm('Do you really want to delete all records ?');
    }
    else
    {
    alert('There are no records for deletion')
    return false;
    }
}
//  This will help to open a 
function ShowExportWindow(varTitle)
{   
    varTitle = 'Title=' + varTitle;
    PageMethods.getE(varTitle, returnvalue);
    
    function returnvalue(varFilterEncrypted)
    {
        alert(varFilterEncrypted);
        return window.open('../Utility/Export.aspx' + varFilterEncrypted + '', 'winExport','width = 400, height = 30 ,top = 300, left = 160,status=1,resizable=1');
    }
}

//  This functions helps to open a export window
function ShowExportWindowWithFilter(varTitle , varFilter)
{
    if(varFilter != null && varFilter != "")
    {
        varFilter = varFilter + '&Title=' + varTitle;
        PageMethods.getE(varFilter, returnvalue);
    }
    else
    {
        varFilter = 'Title=' + varTitle;
        PageMethods.getE(varFilter, returnvalue);
    }
    
    function returnvalue(varFilterEncrypted)
    {
        //alert(varFilterEncrypted);
        return window.open('../Utility/Export.aspx' + varFilterEncrypted + '', '','width = 400, height = 30 ,top = 300, left = 160,status=1,resizable=1');
    }
}


//  This functions helps to open a report window
function ShowReportWindowWithFilter(varTitle , varFilter)
{
    //alert(varFilter);
    if(varFilter != null && varFilter != "")
    {
        varFilter = varFilter + '&Title=' + varTitle;
        PageMethods.getE(varFilter, returnvalue);
    }
    else
    {
        varFilter = 'Title=' + varTitle;
        PageMethods.getE(varFilter, returnvalue);
    }
    
    function returnvalue(varFilterEncrypted)
    {
        //alert(varFilterEncrypted);
        return window.open('../Utility/Report.aspx' + varFilterEncrypted + '');
    }
    
}

//  This will help to open a 
function ShowReportWindow(varTitle)
{
    varTitle = 'Title=' + varTitle;
    PageMethods.getE(varTitle, returnvalue);
    
    function returnvalue(varFilterEncrypted)
    {
        //alert(varFilterEncrypted);
        return window.open('../Utility/Report.aspx' + varFilterEncrypted + '');
    }
}
function ShowSummaryReportWindow(varReportName)
{
    return window.open('../SummaryReports/'+varReportName);
}

//  This functions helps to validate Freetext
function ValidateFreeText()
{
    if (document.getElementById('txtFreeText').value.length > 0 && document.getElementById('txtFreeText').value.length < 3)
    {
        alert("Freetext expects at least 3 characters.");
        return false;
    }
    else
        return true;
}

 function GoClick(e)
   {
           if(e == 13) 
            { 
               document.getElementById('ctl00$cplhInteliScanMaster$imgGo').click();
               return false;
            } 
   }
   
   function DocumentGoClick(e)
   {
           if(e == 13) 
            { 
               document.getElementById('ctl00$cplhInteliScanMaster$imgDocumentGo').click();
               return false;
            } 
   }
		   
	//This function helps to Correct Freetext Search String
function ErrorForCorrectFreetextString()
{
     alert("Search keyword must be more than 1 character");       
}

function NoLessThanChar(keycode)
{            
    if (keycode == 60) 
        return false;
    else
        return true;
}


    
function openWindowViewImage(pageName)
{
    return window.open(pageName, '','width = 400, height = 300 ,top = 300, left = 160,status=0,resizable=0');
}
function openWindowViewDoc(pageName)
{
    return window.open(pageName, '','width = 500, height = 400 ,top = 300, left = 160,status=0,resizable=1');
}

function fnCheckKey(evnt, button,textbox)
{ 
    if(evnt == 13) 
    {
       document.getElementById(textbox.id).focus();
       document.getElementById(button).click();       
       return false;
    } 
}