﻿// JScript File


//Checks is variable passed if integer or not
//****************************************
function isInteger (s)
{
    var x = s;
    var filter  = /^[0-9]+$/i;
    if (filter.test(x))
    {
        return true;
    }
    else
    {     
        return false;
    }
}
//****************************************
    
//Checks for digits
//****************************************
   function isDigit (c)
   {
      return ((c >= "0") && (c <= "9"))
   }
 //****************************************
 
 //Checks if passed variable is float or not
//**********************************************************
function isFloat (s)
{
    var x = s;
    var filter  = /^((\d+(\.\d*)?)|((\d*\.)?\d+))$/;
    if (filter.test(x))
    {
        return true;
    }
    else
    {     
        return false;
    }
}
//**********************************************************

//Checks if email is correct or not
//**********************************************************
function checkMail(s)
{   
    //var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    var filter  = /^\w+([.-]\w+)*@\w+([.-]\w+)*\.\w{2,8}$/;
    
    if (filter.test(s))
        return true;
    else
        return false;
}
//**********************************************************
//Checking no special cahracters are allowed in password field
//**********************************************************
function checkPwdSpecChar (s)
{        
    var filter  = /^[a-z0-9]+$/i;	    
    if (filter.test(s))
    {	                
        return true;
    }
    else
    {   
        return false;
    }	
}
//**********************************************************


//Checking no special cahracters are allowed in password field
//**********************************************************
function checkPhoneNo (s)
{    
    var filter = /^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,5})|(\(?\d{2,6}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$/

    if (filter.test(s))
    {	                
        return true;
    }
    else
    {   
        return false;
    }	
}
//**********************************************************
//Opens the url link as a pop up
//**********************************************************
function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}
//**********************************************************

//Check value IS Character
//*******************************************
function IsChar()

{

  var key = window.event.keyCode; 

  if ((key <65 || key >122) && key!=27 && key!=32) 
  {
alert('Only charater are allowed !');
    window.event.returnValue = false; 
}
}
//*******************************************

//Check value IS Numeric
//*******************************************
function IsNumeric()
{
  var key = window.event.keyCode; 

  if ((key <48 || key >57) && key!=27) 
  {
alert('Only numbers are allowed !');

    window.event.returnValue = false; 
}
}
//*******************************************

//Check value IS Decimal

function IsDecimal()

{
  var key = window.event.keyCode; 

  if ((key <48 || key >57 )&& key!=46 && key!=27) 
{
 alert('Only decimal/numeric  values are allowed !');

    window.event.returnValue = false; 
}
}
//****************************************
//Check For Valid Time
//****************************************
