
	/*	obj is the Object on which check is required. 
		objName is the Name of the Object to be displayed.
		The function checks the Blank value & prompts the user	*/
	
	function specialcharacter(theForm, name)
	{
	
	  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_() ";
	  var checkStr = theForm;
	  var allValid = true;
	  for (i = 0;  i < checkStr.length;  i++)
	  {
	    ch = checkStr.charAt(i);
	    for (j = 0;  j < checkOK.length;  j++)
	      if (ch == checkOK.charAt(j))
	        break;
	    if (j == checkOK.length)
	    {
	      allValid = false;
	      break;
	    }
	  }
	  if (!allValid)
	  {
	    alert("Please enter Valid characters in the " + name ); 
	    
	    return (false);
	  }
	  return (true);
}
	
	function isFirstEmpty(val,objName)
	{
	
	if (val.value.charAt(0) != " ")
		{
			return true;
		}
		else
		{
			alert("First character cannot be space in"+objName);
			return false;
		}		
		
	}

	
	
	
	function checkAlphaNumeric(obj,objName)
		{
			if ( !checkBlank(obj) )
			{
				for (i=0;i<obj.value.length;i++)
				{
					if( !( (obj.value.charAt(i) ==' ')||(obj.value.charAt(i) >='a' && obj.value.charAt(i) <= 'z')
							 ||(obj.value.charAt(i) >='A' && obj.value.charAt(i) <= 'Z') || (obj.value.charAt(i) >='0' && obj.value.charAt(i) <= '9')|| (obj.value.charAt(i) =='_')) )
					{
						alert("Only Alpha Numeric values and '_' are allowed in "+objName);
						obj.focus();
						return false;
					}//end if()
				}//end for()
			}//end if()
			return true;
		}//end checkAlphaNumeric()
	
	function checkBlankMessage(obj,objName)
	{
		if ( obj.value == "" )
		{
			alert("Please enter the "+objName);
			obj.focus();
			return false;
		}//end if()
		else
			return true;
	}//end isBlank()
	function checkDropDown(obj,objName)
		{
			if ( obj.value == "" )
			{
				alert("Please select the "+objName);
				obj.focus();
				return false;
			}//end if()
			else
				return true;
	}//end checkDropDown()
	
	/*	obj is the Object on which check is required. 
		The function only checks the Blank value without prompting the user	*/
	function checkBlank(obj)
	{
		if (obj.value == "")
			return true;
		else
			return false;
	}//end checkBlank()
	
	function doBlank(obj)
	{
		obj.value="";
	}//end checkBlank()
	
	
	/*	obj is the Object on which check is required. 
		dateChar is the Character to split Day, Month & Year.
		objName is the Name of the Object to be displayed.
		firstElement is the First portion of the Date.
		secondElement is the Second portion of the Date.
		thirdElement is the Third portion of the Date.	*/
	

	
	/*	obj is the Object on which check is required.
		len is the length of the Object that is required. 
		objName is the Name of the Object to be displayed.
		The function checks the specified length of the Object	*/
	function checkLengthGreater(obj,len,objName)
	{
		if ( (obj.value.length > len) && ( !checkBlank(obj) ) )
		{
	    		alert(objName+" length must not exceed from "+len);
			obj.focus();
			return false;
		}//end if()
		return true;
	}//end checkLengthGreater()
	
	
	function checkLengthLesser(obj,len,objName)
	{
	
		if ( (obj.value.length < len) && ( !checkBlank(obj) ) )
		{	
			alert(objName+" length must not be less than "+len);
			obj.focus();
			return false;
		}//end if()
		return true;
	}//end checkLengthLesser()
	
	
	
	
	/*	obj is the Object on which check is required.
		objName is the Name of the Object to be displayed.
		The function checks that only Integer values exists in the value of the Object.	*/
	function checkIntegerOnly(obj,objName)
	{
		if ( !checkBlank(obj) )
		{
			for (i=0;i<obj.value.length;i++)
			{
				if( !(obj.value.charAt(i) >='0' && obj.value.charAt(i) <= '9') )
				{
					alert("Only Integer values are allowed in "+objName);
					obj.focus();
					return false;
				}//end if()
			}//end for()
		}//end if()
		return true;
	}//end checkIntegerOnly()
	function pcheckIntegerOnly(val,objName)
	{
	 var checkOK = "0123456789.";
	  var checkStr = val.value;
	  var allValid = true;
	  for (i = 0;  i < checkStr.length;  i++)
	  {
	    ch = checkStr.charAt(i);
	    for (j = 0;  j < checkOK.length;  j++)
	      if (ch == checkOK.charAt(j))
	        break;
	    if (j == checkOK.length)
	    {
	      allValid = false;
	      break;
	    }
	  }
	  if (!allValid)
	  {
	    alert("Please enter only letter and digit characters in the " + objName ); 
	    
	    return (false);
	  }
  return (true);
	}//end checkIntegerOnly()
	
	function checkValidEmail(obj)
	{
		invalidChar = new String("/:,;");
		email = new String(obj.value);
		for(i=0; i<invalidChar.length; i++) //check for Invalid  Characters
		{
			if (email.indexOf(invalidChar.charAt(i), 0) >= 0)
			{
				alert("Bad Characters in Email Field");
				obj.focus();
				return false;
 			}//end if()
		}//end for()
		atPos = email.indexOf("@" ,1);			//check for @
		if(atPos == -1)
		{
			alert("Bad Format of Email Address");
			obj.focus();
			return false;
		}//end if()
		if (email.indexOf("@" , atPos +1) != -1)
		{ 	//check for only one @
			alert("Bad Format of Email Address");
			obj.focus();
			return false;
		}//end if()
		periodPos = email.indexOf("." , atPos);		// atleast one . after @
        	if (periodPos == -1)
		{
			alert("Bad Format of Email Address");
			obj.focus();
			return false
		}//end if()
		if(periodPos + 2 > email.length)
		{
			alert("Bad Format of Email Address");
			obj.focus();
			return false
		}//end if()
		return true
	}//end checkValidEmail()
	
	function checkTextOnly(obj,objName)
	{
		if ( !checkBlank(obj) )
		{
			for (i=0;i<obj.value.length;i++)
			{
				if( !( (obj.value.charAt(i) ==' ')||(obj.value.charAt(i) >='a' && obj.value.charAt(i) <= 'z')
						 ||(obj.value.charAt(i) >='A' && obj.value.charAt(i) <= 'Z') ) )
				{
					alert("Only Alphabets are allowed in "+objName);
					obj.focus();
					return false;
				}//end if()
					
			}//end for()
		}//end if()
		return true;
	}//end checkTextOnly()
	
	
	/*
	Password and RePassword Is Matched or Not
	*/
	function checkPassMatch(obj1,obj2,objName)
	{
	var pwd=obj1.value
	var repwd=obj2.value
	if (pwd!=repwd)
	{
		alert(objName+" do not match");
		obj1.focus();
		obj1.select();
		return false;
    }
    	return true;
}

	function checkCheckBoxMessage(obj,objName)
	{
		if( ! obj.checked )
		{
			alert("Please Check the "+objName);
			obj.focus();
			return false;
		}//end if()
		else
			return true;
	}//end checkCheckBox()
	
	function checkCheckBox(obj)
	{
		if ( !obj.checked )
		{
			alert("True");
			return true;
		}
		else
		{
			alert("False");
			return false;
		}
	}//end checkCheckBox()
	
	function checkRadioButton(obj,objName)
	{
		if (obj.length > 0)
		{
			for(i=0;i< obj.length;i++)
			{
				if(  obj(i).checked )
					return true;
			}
			alert("Please Select the "+objName);
		}//end if()
		else
		{
			if (  obj.checked )
				return true;
			else
				alert("Please Select the "+objName);
		}//end else()

		return false;
	}//end checkRadioButton()
	
	function copyValue(sourceObj,destinationObj)
	{
		destinationObj.value=sourceObj.value;
	}//end copyValue()
	
	function disableObj(obj,opt)
	{
		obj.disabled=opt;
	}//end enableDisable()
	
function checkPhone(obj,objName) {
			 if(!isValidPhone(obj.value)) {
				alert("Bad Characters in "+objName);
				obj.focus();
				obj.select();
				return false;
		}
	else return true;
}

function space(theForm, name)
{

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
  var checkStr = theForm;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only letter and digit characters in the " + name ); 
    
    return (false);
  }
  return (true);
}
function space12(theForm, name)
{

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_@.";
  var checkStr = theForm;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only letter and digit characters in the " + name ); 
    
    return (false);
  }
  return (true);
}

function isValidPhone(n)
	{
		
		var m =0;
		j = n.length;
		for (i=0;i<j;i++)
		{
			if((n.charAt(i) >='0' && n.charAt(i) <= '9') || n.charAt(i) == '-' || n.charAt(i) == '(' || n.charAt(i) == ')' || n.charAt(i) == ' ')
                 m=0 ;
			else
				m=1;
			if (m == 1)
			    return false;
		}
		return true;
}

function checkIP(obj,objName) {
			 if(!isValidPhone1(obj.value)) {
				alert("Only Integers and '.' is allowed in "+objName);
				obj.focus();
				obj.select();
				return false;
		}
	else return true;
}
function isValidPhone1(n)
	{
		var m =0;
		j = n.length;
		for (i=0;i<j;i++)
		{
			if((n.charAt(i) >='0' && n.charAt(i) <= '9') || n.charAt(i) == '.')
                 m=0 ;
			else
				m=1;
			if (m == 1)
			    return false;
		}
		return true;
}




	function goToPage(pag)
	{
		location.href=pag;
	}//end cancelFunction()
	
	function firstObj(obj)
	{
		obj.focus();
	}//end firstObj()
	



function checkBlank(obj1)

            {

                        if (obj1.value == "")

                                    return true;

                        else

                                    return false;

            }//end checkBlank()

function checkDate(obj1,obj2)
	
	{
	
	    var first=0          , second=0;
	
	    for(i=0;i<obj1.value.length;i++)
	
	    {
	
	                 if(obj1.value.charAt(i) == "/")
	
	         {
	
	              if (first == 0)
	
	                  first=i;
	
	              else
	
	              {
	
	                           if (second == 0)
	
	                   second=i;
	
	              }
	
	         }
	
	      }
	
	      
	
	      
	
	    var firsta=0          , seconda=0;
	
	    for(i=0;i<obj2.value.length;i++)
	
	    {
	
	                 if(obj2.value.charAt(i) == "/")
	
	         {
	
	              if (firsta == 0)
	
	                  firsta=i;
	
	              else
	
	              {
	
	                           if (seconda == 0)
	
	                   seconda=i;
	
	              }
	
	         }
	
	      }
	
	 
	
	 
	
	    enteredMon1=parseInt(obj1.value.substring(0,first));
	
	    enteredMon2=parseInt(obj2.value.substring(0,firsta));
	
	    enteredDay1=parseInt(obj1.value.substring(first+1,second));
	
	    enteredDay2=parseInt(obj2.value.substring(firsta+1,seconda));
	
	    enteredYear1=parseInt(obj1.value.substring(second+1,obj1.value.length));
	
	    enteredYear2=parseInt(obj2.value.substring(seconda+1,obj2.value.length));
	
	 
	
	    
	
	 
	
	 
	
	     if(enteredYear1>enteredYear2)
	
	         {
	
	          alert("From date must be less than to date");
	
	          obj1.focus();
	
	          return false;
	
	         }
	
	         else
	
	         {
	
	            if(enteredYear1==enteredYear2 && enteredMon1>enteredMon2)
	
	            {
	
	            alert("From date must be less than to date");
	
	             obj1.focus();
	
	            return false;
	
	            }
	
	            else
	
	            {
	
	            if(enteredMon1==enteredMon2 && enteredDay1>enteredDay2)
	
	            {
	
	            alert("From date must be less than to date");
	
	            obj1.focus();
	
	            return false;
	
	            }
	
	            }//end else
	
	 
	
	             }//end else
	
	         
	
	      return true;
	
	    }//end checkDate()
		
		function isFirstEmpty(val,objName)
		{
		
		if (val.value.charAt(0) != " ")
			{
				return true;
			}
			else
			{
				alert("First character cannot be space in"+objName);
				return false;
			}		
			
		}



