
/*function MyValidation(myForm)
{
	this.myObj = document.forms[myForm];*/
	//this.myObj=TextBoxValidate(MyText);*/
/*	this.myObj.onsubmit = AfterSubmit;
	
}

function AfterSubmit()
{
alert("hello");
var getvalu;
	if (this.txtFname.value=="" || this.txtEmail.value=="" || this.txtLastN.value=="" || this.txtCmpy.value=="" || this.txtLoginName.value=="" || this.txtPwd.value=="")
	{  
    alert("All Fields must be Entered");
    return false;
	 }
 
   if( /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(  this.txtEmail.value )) 
	{
           
           return true; 
	}
 else
 {alert("Enter a Valid Email-Id");
 return false;
	 }
 return true;
   }*/
   
   
   
   //----------------------------------------------------------------------
   
   
   
// function to validate a Person Name
// allows alphabets, Space, '.' only


function ValidatePersonName(input,control,compulsory)
{
	var Cont_Value = input;
	var Cont_Name =control;
	var Cont_Validate=compulsory;
	
	//alert(Cont_Value);
	//alert("Email Enter")
	if ((Cont_Validate=="Y") && (Cont_Value.length==0))
	{
			alert (Cont_Name + " is left blank. You have to fill-in this field.");
			return false;
	}
	else if ((Cont_Validate=="Y") &&(Cont_Value.charAt(0)==" "))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
		return false;
	}
	else if ((Cont_Value.charAt(0)==" "))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
		return false;
	}
	else if((Cont_Value.charAt(0)=="."))
	{
		alert("First character of " + Cont_Name + " cannot be a dot. Please re-enter the data.");
		return false;
	}
	else if (!isName(Cont_Value))
	{
		alert ("Only alphabets or '.' are allowed in " + Cont_Name  + ". Re-enter only these characters.");
		return false;	
	}	
	else
		return true;
}



//validation for Email

function ValidateEmailName(input,control,compulsory)
{

	var Cont_Value = input;
	var Cont_Name =control;
	var Cont_Validate=compulsory;
	//alert(Cont_Value);
	
	if ((Cont_Validate=="Y") && (Cont_Value.length==0))
	{
			alert (Cont_Name + " is left blank. You have to fill-in this field.");
			return false;
	}
	else if(Cont_Value.length!=0)
	{ if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(Cont_Value )==false) 
	{      alert("enter the correct mail Id");
		   return false; 
    }   }   
    else  
    {
    
		return true;
    }			
	
}


//Validation only for numbers
function ValidateShowRecords(input,control,compulsory)
{
		var Cont_Value = input;
	var Cont_Name =control;
	var Cont_Validate=compulsory;
	//alert(Cont_Value);
	
	if ((Cont_Validate=="Y") &&(Cont_Value.length==0))
	{
		alert (Cont_Name + " is left blank. You have to fill-in this field.")
		return false
	}	
	else if ((Cont_Validate=="Y") &&(Cont_Value.charAt(0)==" "))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
		return false
	}
	else if ((Cont_Value.charAt(0)==" "))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
		return false
	}
	else if((Cont_Value.charAt(0)=="+") || (Cont_Value.charAt(0)=="-"))
	{
		alert("Arithmetic characters are not allowed in " + Cont_Name + ". Please remove the arithmetic character and re-enter the data.")
		return false;
	} 
	else if (Cont_Value!="")
	{
		if(Cont_Value <= 0 ) 
		{
			alert("Only positive integers (eg. 777) are allowed in " + Cont_Name +". Negative integers or zero are not allowed. Please re-enter a value between 1 and 999.");
			return false;
		}

		for(i=0;i<Cont_Value.length;i++)
		{
			var str=Cont_Value.charAt(i)
			if (!(str >= 0 && str <=9) || str==" ")
			{	
				alert("Only positive integers (eg. 777) are allowed in " + Cont_Name +". Negative integers or zero are not allowed. Please re-enter a value between 1 and 999.");
				return false
			}
		}
	}
	else
		return true;
}




function isName(val)
{
	var re=/[^A-Za-z. ]/;
	return !re.test(val);
}





function AlphaNumeric(input,control,compulsory)
{
var Alpha_Value=input;
var Alpha_Name=control;
var Alpha_Req=compulsory;

if ((Alpha_Req=="Y") &&(Alpha_Value.length==0))
	{
		alert (Alpha_Name + " is left blank. You have to fill-in this field.")
		return false;
	}	
	else if ((Alpha_Req=="Y") &&(Alpha_Value.charAt(0)==" "))
	{
		alert (Alpha_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
		return false;
	}
	/*else if ((Alpha_Value.length < 4) || (Alpha_Value.length > 20)) 
	{
		alert ("Please enter a valid User ID in "+ Alpha_Name +  " and "  + Alpha_Name + " allows only IDS > 4 and  < 20. Please re-enter the data.")
		return false;
	}*/	
	
	}
	
function AlphaNumeric1(input,control,compulsory)
{
var Alpha_Value=input;
var Alpha_Name=control;
var Alpha_Req=compulsory;

if ((Alpha_Req=="Y") &&(Alpha_Value.length==0))
	{
		alert (Alpha_Name + " is left blank. You have to fill-in this field.")
		return false;
	}	
	else if ((Alpha_Req=="Y") &&(Alpha_Value.charAt(0)==" "))
	{
		alert (Alpha_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
		return false;
	}
	else if ((Alpha_Value.length < 4) || (Alpha_Value.length > 20)) 
	{
		alert ("Please enter a valid User ID in "+ Alpha_Name +  " and "  + Alpha_Name + " allows only IDS > 4 and  < 20. Please re-enter the data.")
		return false;
	}	
	
	}
						
	
function NumberCheck(input,control,compulsory)

{	var Alpha_Value=input;
	var Alpha_Name=control;
	var Alpha_Req=compulsory;
	if ((Alpha_Req=="Y") &&(Alpha_Value.length==0))
	{
		alert (Alpha_Name + " is left blank. You have to fill-in this field.")
		return false;
	}	
	else if ((Alpha_Req=="Y") &&(Alpha_Value.charAt(0)==" "))
	{
		alert (Alpha_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
		return false;
	}
	
	else if(!isNumeric(Alpha_Value))
	{
	alert(Alpha_Name + " Enter the Numerals " );
	return false;
	
	}
	else
	return true;
	}
	
	
	
	
	function isNumeric(val)
{

	var re=/[^0-9]/;
	
	return !re.test(val);
}
	
	
//validation for Email









/*
//function isAddress(val)
{

	var re=/([^A-Za-z0-9._\-\)\(\\,;])/;
	
	return !re.test(val);
}


function isNumeric(val)
{

	var re=/[^0-9]/;
	
	return !re.test(val);
}





function isPin(val){
	var re=/^0|[^0-9]/;
	return !re.test(val);
}


function isSSID(val){
	var re=/[^0-9]/;
	return !re.test(val);
}


	
//function to validate pincode
function ValidatePinCode(input, control, compulsory)
{
	var Cont_Value = input;
	var Cont_Name =control;
	var Cont_Validate=compulsory;
	
	if ((Cont_Value=="") && (Cont_Validate=="Y"))
	{
		alert (Cont_Name + " is left blank. You have to fill-in this field.")
		return false;
	}
	else if ((Cont_Validate=="Y") &&(Cont_Value.charAt(0)==" "))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
		return false
	}
	else if ((Cont_Value.charAt(0)==" "))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
		return false
	}
	else if(!isPin(Cont_Value))
	{
		alert("Please enter a valid 6 digit Pincode");
		return false;
	}	
	else if((Cont_Value!="") && (Cont_Value.length != 6))
	{
			alert("Please enter a valid 6 digit Pincode");
			return false;		
	}
	
	else
		return true;
}
	

// function to check house number
function ValidateHouseNumber(input,control,compulsory)
{
	
	var Cont_Value = input;
	var Cont_Name =control;
	var Cont_Validate=compulsory;
	
	if ((Cont_Value=="") && (Cont_Validate=="Y"))
	{
		alert (Cont_Name + " is left blank. You have to fill-in this field.");
		return false;
	}
	else if ((Cont_Validate=="Y") &&(Cont_Value.charAt(0)==" "))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.");
		return false;
	}
	else if ((Cont_Value.charAt(0)==" "))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
		return false
	}
	else if((Cont_Value.charAt(0)=="/") || (Cont_Value.charAt(0)=="-") || (Cont_Value.charAt(0)=="\\"))
	{
		alert ("First character of " + Cont_Name + " should be a number. Please re-enter the data.");
		return false;
	}
	else if(!isHouseNumber(Cont_Value))
	{
	
		alert("For " + Cont_Name + " the value " + Cont_Value +  " is not a valid house number. Please re-enter the date.(eg. 1-2-3/1/A)");
		return false;
	}
	else 
		return true;
}

function isHouseNumber(val){

var re=/(^[^0-9])|([^A-Za-z0-9:/-])|(:\/)|(\/:)|(-:)|(:-)|(-\/)|(\/-)|(:{2,})|(\/{2,})|(-{2,})/;
	
return !re.test(val);

}




function ValidateTextArea(input, control, compulsory,fieldlen)
{
	
	var Cont_Value = input;
	var Cont_Name =control;
	var Cont_Validate=compulsory;
	var Cont_Length=fieldlen;
	if ((Cont_Value=="") && (Cont_Validate=="Y"))
	{
		alert (Cont_Name + " is left blank. You have to fill-in this field.")
		return false;
	}
	else if ((Cont_Validate=="Y") && ((Cont_Value.charAt(0)==" ") || (Cont_Value.charCodeAt(0)=="13") || (Cont_Value.charCodeAt(0)=="32") ))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank or a new line character. Please re-enter the data.")
		return false
	}	else if ((Cont_Value.charAt(0)==" "))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
		return false
	}
	else if (Cont_Value.length > Cont_Length)
	{
		alert (Cont_Name + " Field Length Cannot be greater than " + Cont_Length + " Characters. Please enter data less than or equal to " + Cont_Length + "  characters.");
		return false;
	}
	else
		return true;	
}


//function to check SSID
function ValidateSSID(input, control, compulsory)
{
	var Cont_Value = input;
	var Cont_Name =control;
	var Cont_Validate=compulsory;
	
	if ((Cont_Value=="") && (Cont_Validate=="Y"))
	{
		alert (Cont_Name + " is left blank. You have to fill-in this field.")
		return false;
	}
	else if ((Cont_Validate=="Y") &&(Cont_Value.charAt(0)==" "))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
		return false
	}
	else if ((Cont_Value.charAt(0)==" "))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
		return false
	}
	else if(!isSSID(Cont_Value))
	{
		alert( Cont_Name + " should be a 16 digit number. Please re-enter a valid 16 digit SSID");
		return false;
	}	
	else if((Cont_Value!="") && (Cont_Value.length != 16))
	{
			alert( Cont_Name + " should be a 16 digit number. Please re-enter a valid 16 digit SSID");
			return false;			
	}
	else
		return true;
}


function ValidateAddress(input, control, compulsory)
{
	var Cont_Value = input;
	var Cont_Name =control;
	var Cont_Validate=compulsory;
	
	if ((Cont_Value=="") && (Cont_Validate=="Y"))
	{
		alert (Cont_Name + " is left blank. You have to fill-in this field.");
		return false;
	}
	else if ((Cont_Validate=="Y") &&(Cont_Value.charAt(0)==" "))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
		return false
	}
	else if ((Cont_Value.charAt(0)==" "))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
		return false
	}
	else if((Cont_Value.charAt(0)==".") ||(Cont_Value.charAt(0)=="-") || (Cont_Value.charAt(0)=="/") || (Cont_Value.charAt(0)=="(") || (Cont_Value.charAt(0)==")") || (Cont_Value.charAt(0)==",") || (Cont_Value.charAt(0)==":") || (Cont_Value.charAt(0)=="\\"))
	{
		alert("First character of " + Cont_Name + " cannot be a '.' , '-' , '/' , '(' , ')' , ',' , ':' , '\\'. Please re-enter the data.")
		return false;
	}
	else if(!isAddress(Cont_Value))
	{
		alert("Only alphabets, positive integers and special characters (. , - , ( , ) , comma , : , \\ , / )  are allowed in Address. Please enter valid data in " + Cont_Name);		
		return false;
	}
	else 
		return true;
}


// function to validate person height

function ValidatePersonHeight(input, control, compulsory)
{
	var Cont_Value = input;
	var Cont_Name =control;
	var Cont_Validate=compulsory;

	if ((Cont_Value=="") && (Cont_Validate=="Y"))
	{
		alert(Cont_Name + " is left blank. You have to fill-in this field");
		return false;
	}
	else if ((Cont_Validate=="Y") &&(Cont_Value.charAt(0)==" "))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
		return false
	}
	else if ((Cont_Value.charAt(0)==" "))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
		return false
	}
	else if(isNaN(Cont_Value))
	{
		alert("Please enter valid data in " + Cont_Name + ".");
		return false;
	}
	else if((Cont_Value.charAt(0)=="+") || (Cont_Value.charAt(0)=="-"))
	{
		alert("Arithmetic characters are not allowed in " + Cont_Name + ". Please remove the arithmetic character and re-enter the data.")
		return false;
	}
	else if ((Cont_Value < 1) && (Cont_Value!=""))
	{
		
		alert("Please enter valid data in " + Cont_Name);
		return false;
	}
	else if(validateTwoDigits(input, control, compulsory)==false)
	{
		alert(Cont_Name + " allows only 2 digits after decimal (eg. 45.45) Please re-enter correct data");
		return false;
	}	
	else if(parseInt(Cont_Value) > 250)
	{
		alert(Cont_Name + " allows only between 1 and 250. Please re-enter correct data");
		return false;
	}
	else 
		return true;
	
}


// function to validate person Weight

function ValidatePersonWeight(input, control, compulsory)
{
	var Cont_Value = input;
	var Cont_Name =control;
	var Cont_Validate=compulsory;

	if ((Cont_Value=="") && (Cont_Validate=="Y"))
	{
		alert (Cont_Name + " is left blank. You have to fill-in this field.")
		return false;
	}
	else if ((Cont_Validate=="Y") &&(Cont_Value.charAt(0)==" "))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
		return false
	}
	else if ((Cont_Value.charAt(0)==" "))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
		return false
	}
	else if(isNaN(Cont_Value))
	{
		alert("Only valid number between 1 and 1000 is allowed in " + Cont_Name + " (eg. 45.45) Please re-enter correct data");
		return false;
	}
	else if((Cont_Value.charAt(0)=="+") || (Cont_Value.charAt(0)=="-"))
	{
		alert("Arithmetic characters are not allowed in " + Cont_Name + ". Please remove the arithmetic character and re-enter the data.")
		return false;
	}
	else if ((Cont_Value<1) && (Cont_Value!=""))
	{
		alert("Only valid number between 1 and 1000 is allowed in " + Cont_Name + " (eg. 45.45) Please re-enter correct data");
		return false;
	}	
	
	else if(validateTwoDigits(input, control, compulsory)==false)
	{
		alert(Cont_Name + " allows only 2 digits after decimal (eg. 45.45) Please re-enter correct data");
		return false;
	}
	else if(parseInt(Cont_Value) > 1000)
	{
		alert("Please enter valid weight of a person (in Kilograms) in  " + Cont_Name);
		return false;
	}
	else 
		return true;	
}


function ValidateTemperature(input, control, compulsory)
{
	
	var Cont_Value = input;
	var Cont_Name =control;
	var Cont_Validate=compulsory;

	if ((Cont_Value=="") && (Cont_Validate=="Y"))
	{
		alert (Cont_Name + " is left blank. You have to fill-in this field.")
		return false;
	}
	else if ((Cont_Validate=="Y") &&(Cont_Value.charAt(0)==" "))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.");
		return false;
	}
	else if ((Cont_Value.charAt(0)==" "))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
		return false
	}
	else if(isNaN(Cont_Value))
	{
		alert("Please enter a valid temperature value in " + Cont_Name + ".");
		return false;
	}
	else if((Cont_Value.charAt(0)=="+") || (Cont_Value.charAt(0)=="-"))
	{
		alert("Arithmetic characters are not allowed in " + Cont_Name + ". Please remove the arithmetic character and re-enter the data.")
		return false;
	}
	else if(validateTwoDigits(input, control, compulsory)==false)
	{
		alert(Cont_Name + " allows only 2 digits after decimal (eg. 45.45) Please re-enter correct data");
		return false;
	}
	else 
		return true;
}

function validateTwoDigits(input, control, compulsory)
{
	var Cont_Value = input;
	var Cont_Name =control;
	var Cont_Validate=compulsory;
	
	for(i=0;i<Cont_Value.length;i++)
	{
		var str=Cont_Value.charAt(i);
		if ((str=="."))
		{
			if((Cont_Value.length - (i+1)) > 2)
			{
				return false;
			}		
		}
	}
}

// function to validate integers

function ValidateIntegers(input, control, compulsory)
{
	var Cont_Value = input;
	var Cont_Name =control;
	var Cont_Validate=compulsory;
	for(i=0;i<Cont_Value.length;i++)
	{
		var str=Cont_Value.charAt(i);
		if(isNaN(str))
		{
		
			alert("Only positive integers (eg. 777) less than 65536 are allowed in " + Cont_Name + ". Negative integers or zero values are not allowed. Please re-enter correct data.");
			return false;
		}
	}
	if ((Cont_Value=="") && (Cont_Validate=="Y"))
	{
		alert (Cont_Name + " is left blank. You have to fill-in this field.")
		return false;
	}
	else if ((Cont_Validate=="Y") &&(Cont_Value.charAt(0)==" "))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.");
		return false;
	}
	else if ((Cont_Value.charAt(0)==" "))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
		return false
	}
	else if(isNumeric(Cont_Value)==false)
	{
		alert("Please enter a valid Integer value in " + Cont_Name + ".")
		return false;
	}
	else if((Cont_Value.charAt(0)=="+") || (Cont_Value.charAt(0)=="-"))
	{
		alert("Arithmetic characters are not allowed in " + Cont_Name + ". Please remove the arithmetic character and re-enter the data.")
		return false;
	}
	else if((parseInt(Cont_Value) < 0) || parseInt(Cont_Value) > 65536)
	{
		alert("Only positive integers (eg. 777) less than 65536 are allowed in " + Cont_Name + ". Negative integers or zero values are not allowed. Please re-enter correct data.");
		return false;
	}
	else
		return true;	
}




//function to validate person age less than zero

function ValidatePersonAge(input, control, compulsory)
{
	var Cont_Value = input;
	var Cont_Name =control;
	var Cont_Validate=compulsory;
	for(i=0;i<Cont_Value.length;i++)
	{
		var str=Cont_Value.charAt(i);
		if(isNaN(str))
		{
			alert("Only positive integers (eg. 44) are allowed in " + Cont_Name + ". Negative numbers or zero values are not allowed. Please re-enter correct data.");
			return false;
		}
	}
	if (((Cont_Value=="") && (Cont_Validate=="Y")))
	{
		alert (Cont_Name + " is left blank. You have to fill-in this field.")
		return false;
	}
	else if ((Cont_Validate=="Y") &&(Cont_Value.charAt(0)==" "))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.");
		return false;
	}
	else if ((Cont_Value.charAt(0)==" "))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
		return false
	}
	else if (isNumeric(Cont_Value)==false)
	{
		alert("Only positive integers between 1 and 150 are allowed in " + Cont_Name + ". Negative numbers or zero values are not allowed. Please re-enter correct data.");
		return false;
	}
	else if((Cont_Value.charAt(0)=="+") || (Cont_Value.charAt(0)=="-"))
	{
		alert("Arithmetic characters are not allowed in " + Cont_Name + ". Please remove the arithmetic character and re-enter the data.")
		return false;
	}	
	else if((Cont_Value < 1 ) || (Cont_Value > 150))
	{
		alert("Only positive integers between 1 and 150 are allowed in " + Cont_Name + ". Negative numbers or zero values are not allowed. Please re-enter correct data.");
		return false;
	}
	else
		return true;	
}



function ValidateNoNZero(input, control, compulsory)
{

	var Cont_Value = input;
	var Cont_Name =control;
	var Cont_Validate=compulsory;
	
	if ((Cont_Value=="") && (Cont_Validate=="Y"))
	{
		alert (Cont_Name + " is left blank. You have to fill-in this field.")
		return false;
	}
	else if ((Cont_Validate=="Y") &&(Cont_Value.charAt(0)==" "))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.");
		return false;
	}
	else if ((Cont_Value.charAt(0)==" "))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
		return false
	}
	else if ((Cont_Value.charAt(0)==0) && (Cont_Value!=""))
	{
		alert (Cont_Name + " does not allow a data with first character as a '0' character. Please re-enter the data.");
		return false;
	}
	else if(isPin(Cont_Value)==false)
	{
		alert (Cont_Name + " allows only digits and there cannot be any blank spaces or characters between digits. Please re-enter the data.");
		return false;
	}
	else if((Cont_Value.charAt(0)=="+") || (Cont_Value.charAt(0)=="-"))
	{
		alert("Arithmetic characters are not allowed in " + Cont_Name + ". Please remove the arithmetic character and re-enter the data.")
		return false;
	}
	else
		return true;
}

// function to validate date in "dd/mm/yyyy" format and allows year from 1900 to current running year
 
function ValidateCurrentDate(input,control,compulsory)
{
        var Cont_Value = input;
        var Cont_Name =control;
        var Cont_Validate=compulsory;
        var date = new Date();
        if ((Cont_Validate=="Y") &&(Cont_Value.length==0))
        {
                alert (Cont_Name + " is left blank. You have to fill-in this field.")
                return false
        }
        else if (Cont_Value!="")
        {
	
                var strdate=Cont_Value
                var intstart=0
                var intsep=0
                var intcount=0
                var intdate=new Array(2)
 
                while (intsep!=-1)
                {
                        intsep=strdate.indexOf("/",intstart);
                        if (intsep==-1)
                                intdate[intcount]=strdate.substr(intstart)
                        else
                                intdate[intcount]=strdate.substr(intstart,intsep-intstart)
                        intstart=intsep+1
                        intcount=intcount+1
                }
                var str = intdate[1]+"/"+intdate[0]+"/"+intdate[2];
	        var d=new Date(str)

                if ((intdate[0]!= d.getDate()) || (intdate[1]!= d.getMonth()+1) || (intdate[2]!=d.getFullYear()))
                {
                        alert("For " +  Cont_Name + " the value " + Cont_Value + " is not a valid date. Please enter a valid date in  dd/mm/yyyy (eg. 13/11/2002) format.")
                        return false
                }
	       if(intdate[0].length>2)
               {
                     alert("For " +  Cont_Name + " the value " + Cont_Value + " is not a valid date. Please enter a valid date in  dd/mm/yyyy (eg. 13/11/2002) format.")
                     return false
               }
	       if(intdate[1].length>2)
               {
                     alert("For " +  Cont_Name + " the value " + Cont_Value + " is not a valid date. Please enter a valid date in  dd/mm/yyyy (eg. 13/11/2002) format.")
                     return false
               }	
              	
              if(intdate[2].length>4 || intdate[2].length <4)
               {
                     alert("For " +  Cont_Name + " the value " + Cont_Value + " is not a valid date. Please enter a valid date in  dd/mm/yyyy (eg. 13/11/2002) format.")
                     return false
               }
	
             if((intdate[2]<1900))
                {
                alert("Only year greater than 1900 are allowed in "+ Cont_Name + " Please re-enter a valid year greater than 1900.");
                        return false;
                 }
          	
	    if(d>date)
		{
			var month = date.getMonth()+1;
			 alert(Cont_Name+ " cannot exceed current date. Please re-enter date less than or equal to " +date.getDate()+"/"+month+"/"+date.getFullYear()); 
			return false;
		}
	 
			
        }
        else
                return true
}  


// function to validate date in "dd/mm/yyyy" format and allows year from 1900 to future year also
 
function ValidateAnyDate(input,control,compulsory)
{
        var Cont_Value = input;
        var Cont_Name =control;
        var Cont_Validate=compulsory;
        var date = new Date();
        if ((Cont_Validate=="Y") &&(Cont_Value.length==0))
        {
                alert (Cont_Name + " is left blank. You have to fill-in this field.")
                return false
        }
        else if (Cont_Value!="")
        {
	
                var strdate=Cont_Value
                var intstart=0
                var intsep=0
                var intcount=0
                var intdate=new Array(2)
 
                while (intsep!=-1)
                {
                        intsep=strdate.indexOf("/",intstart);
                        if (intsep==-1)
                                intdate[intcount]=strdate.substr(intstart)
                        else
                                intdate[intcount]=strdate.substr(intstart,intsep-intstart)
                        intstart=intsep+1
                        intcount=intcount+1
                }
                var str = intdate[1]+"/"+intdate[0]+"/"+intdate[2];
	        var d=new Date(str)

                if ((intdate[0]!= d.getDate()) || (intdate[1]!= d.getMonth()+1) || (intdate[2]!=d.getFullYear()))
                {
                         alert("For " +  Cont_Name + " the value " + Cont_Value + " is not a valid date. Please enter a valid date in  dd/mm/yyyy (eg. 13/11/2002) format.")
                        return false
                }
	       if(intdate[0].length>2)
               {
                     alert("For " +  Cont_Name + " the value " + Cont_Value + " is not a valid date. Please enter a valid date in  dd/mm/yyyy (eg. 13/11/2002) format.")
                     return false
               }
	       if(intdate[1].length>2)
               {
                      alert("For " +  Cont_Name + " the value " + Cont_Value + " is not a valid date. Please enter a valid date in  dd/mm/yyyy (eg. 13/11/2002) format.")
                     return false
               }	
              	
              if(intdate[2].length>4 || intdate[2].length <4)
               {
                	alert("For " +  Cont_Name + " the value " + Cont_Value + " is not a valid date. Please enter a valid date in  dd/mm/yyyy (eg. 13/11/2002) format.")
                     return false
               }
	
             if((intdate[2]<1900))
                {
                alert("Only year greater than 1900 are allowed in "+ Cont_Name + " Please re-enter a valid year greater than 1900.");
                        return false;
	         
        	}
        
			
        }
        else
                return true
} 
                                              


// function to compare date, validate format, check for Not Null or Null for dd/mm/yyyy format
//latest code 

//function to validate the same dates entered by user 

function ValidateLeadDate(Linput,input,control,control1,compulsory)
{
	var dtmBidDate=Linput;
	var dtmLeadDate=input;
	Cont_Value=input;
	Cont_Name=control;
	Cont_Validate=compulsory;
	var ctrl	=	control1;
	
	if ((Cont_Validate=="Y") &&(Cont_Value.length==0))
	{
		alert (Cont_Name + " is left blank. You have to fill-in this field.")
		return false
	}

	else if ((dtmBidDate!="" && dtmLeadDate=="") ||(dtmBidDate=="" && dtmLeadDate!="") )
	{
		//alert ("Both" from Date and To Date should be entered or removed")
	  alert ("Both " + Cont_Name + " and " + ctrl + " should be entered or removed")

		return false			
	}
	else if (Cont_Value!="")
	{
            
           if(dtmBidDate==dtmLeadDate)
             {
                alert("Date Of Birth Should Not Be Equal To D



//function to validate Lead Date

function ValidateLeadDate(Linput,input,control,control1,compulsory)
{
	var dtmBidDate=Linput;
	var dtmLeadDate=input;
	Cont_Value=input;
	Cont_Name=control;
	Cont_Validate=compulsory;
	var ctrl	=	control1;
	
	if ((Cont_Validate=="Y") &&(Cont_Value.length==0))
	{
		alert (Cont_Name + " is left blank. You have to fill-in this field.")
		return false
	}

	else if ((dtmBidDate!="" && dtmLeadDate=="") ||(dtmBidDate=="" && dtmLeadDate!="") )
	{
		//alert ("Both" from Date and To Date should be entered or removed")
	  alert ("Both " + Cont_Name + " and " + ctrl + " should be entered or removed")

		return false			
	}
	else if (Cont_Value!="")
	{
		var Byear
		var Lyear
		var Lmon
		var Bmon
		var Lday
		var Bday
	
		var MonPosLDate = dtmLeadDate.indexOf("/",-1)
		var DayPosLDate= dtmLeadDate.lastIndexOf("/")
	
		var MonPosBDate = dtmBidDate.indexOf("/",-1)
		var DayPosBDate= dtmBidDate.lastIndexOf("/")
			
		Lyear=dtmLeadDate.substr(eval(DayPosLDate+1),4)
		Byear=dtmBidDate.substr(eval(DayPosBDate+1),4)
	
		//Lmon=dtmLeadDate.substr(0,MonPosLDate)
		//Bmon=dtmBidDate.substr(0,MonPosBDate)

		//Lday=dtmLeadDate.substr(eval(MonPosLDate+1),eval(DayPosLDate-MonPosLDate-1))
		//Bday=dtmBidDate.substr(eval(MonPosBDate+1),eval(DayPosBDate-MonPosBDate-1))
		
		 Lday=dtmLeadDate.substr(0,MonPosLDate)
                	 Bday=dtmBidDate.substr(0,MonPosBDate)
 
                	Lmon=dtmLeadDate.substr(eval(MonPosLDate+1),eval(DayPosLDate-MonPosLDate-1))
                	Bmon=dtmBidDate.substr(eval(MonPosBDate+1),eval(DayPosBDate-MonPosBDate-1))  	

		if (eval(Lyear)>eval(Byear))
		{
			return true
		}
		else if ((eval(Lyear)==eval(Byear)) && (eval(Lmon)>eval(Bmon)))
		{
			return true
		}
		else if ((eval(Lyear)==eval(Byear)) && (eval(Lmon)== eval(Bmon)) && (eval(Lday)>eval(Bday)))
		{
			return true
		}
		else if ((eval(Lyear)==eval(Byear)) && (eval(Lmon)== eval(Bmon)) && (eval(Lday)==eval(Bday)))
		{
			return false
		}
		else
		{
			alert(Cont_Name + " cannot be less than "+control1+" "+ Linput )
			return false
		}

	}
	else
		return true
}



//to check whether an item is selected in combo */

function ValidateCombo(input,control)
{
	var Cont_Value = input;
	var Cont_Name = control;
	
	if (Cont_Value.selectedIndex==0)
	{
		alert("Please select one of the options in " + Cont_Name);
		return false;		
	}
	else
		return true;
}

/*function ValidateCurrency(input,control,compulsory)
{
	var Cont_Value = input;
    var Cont_Name =control;
    var Cont_Validate=compulsory;
    
    if ((Cont_Validate=="Y") &&(Cont_Value.length==0))
	{
		alert (Cont_Name + " is left blank. You have to fill-in this field.")
		return false
	}
	else if ((Cont_Validate=="Y") &&(Cont_Value.charAt(0)==" "))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.");
		return false;
	}
	else if ((Cont_Value.charAt(0)==" "))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
		return false
	}
	
	else if(isNaN(Cont_Value))
	{
		alert(Cont_Name + " allows only numbers. Please enter a valid number in " + Cont_Name);
		return false;
	}
	else if((Cont_Value.charAt(0)=="+") || (Cont_Value.charAt(0)=="-"))
	{
		alert("Arithmetic characters are not allowed in " + Cont_Name + ". Please remove the arithmetic character and re-enter the data.")
		return false;
	}
	else if (Cont_Value<0)
	{		
		alert("Only values greater than or equal to zero are allowed in " + Cont_Name +". Please enter valid data in " + Cont_Name + ".");
		return false;
	}
	else if(validateTwoDigits(input, control, compulsory)==false)
	{
		alert(Cont_Name + " allows only 2 digits after decimal (eg. 45.45) Please re-enter correct data");
		return false;
	}
	else 
		return true;
	
}

//only Alphabets 
*/
function OnlyAlphabets(input,control,compulsory)
{
	var Cont_Value = input;
	var Cont_Name =control;
	var Cont_Validate=compulsory;
	
	if ((Cont_Validate=="Y") && (Cont_Value.length==0))
	{
		 alert (Cont_Name + " is left blank. You have to fill-in this field.")
			return false
	}
	else if ((chkBlankSpaces(Cont_Value,Cont_Name,Cont_Validate)==false))
	{
		alert (Cont_Name + " does not allow blank spaces. Please remove blank spaces and re-enter data.")
		return false;
	}
	
	else if (Cont_Value!="")
	{
		for(i=0;i<Cont_Value.length;i++)
		{
			var str=Cont_Value.charAt(i)
			if (!((str >= "A" && str <= "Z" ) || (str >= "a" && str <= "z")))
			{	
				alert ("Only alphabets are allowed in " + Cont_Name + " (eg. quality).  Please re-enter correct data.")
				return false
			}
		}
	}
	else
		return true
}


/*
//only Alphabets 

function OnlyAlphabetSpace(input,control,compulsory)
{
	var Cont_Value = input;
	var Cont_Name =control;
	var Cont_Validate=compulsory;
	
	if ((Cont_Validate=="Y") && (Cont_Value.length==0))
	{
		 alert (Cont_Name + " is left blank. You have to fill-in this field.")
			return false
	}
	else if((Cont_Validate=="Y") && (Cont_Value.charAt(0)==" "))
	{
		
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
		return false
	}
	else if ((Cont_Value.charAt(0)==" "))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
		return false
	}
	else if (Cont_Value!="")
	{
		for(i=0;i<Cont_Value.length;i++)
		{
			var str=Cont_Value.charAt(i)
			if (!((str >= "A" && str <= "Z" ) || (str >= "a" && str <= "z") || str==" "))
			{	
				alert ("Only alphabets, space are allowed in " + Cont_Name + " (eg. quality).  Please re-enter correct data.")
				return false
			}
		}
	}
	else
		return true
}




	
// function to check blank spaces
*/
function chkBlankSpaces(input,control,compulsory)
{	
	var Cont_Value=input;
	var Cont_Name=control;
	var Cont_Validate=compulsory;
	var intcheckblank=0;
		
	for(i=0;i<Cont_Value.length;i++)
	{
		var str=Cont_Value.charAt(i)
		if (str == " ")
		{	
			return false;
		}
	}
	return true;
		
	
}


// Function to check 
function checkzero(input,control,compulsory)
{
	var Cont_Value = input;
	var Cont_Name =control;
	var Cont_Validate=compulsory;

	if ((Cont_Validate=="Y") &&(Cont_Value.length==0))
	{
		alert (Cont_Name + " is left blank. You have to fill-in this field.")
		return false
	}

	else if((Cont_Value.charAt(0)=="+") || (Cont_Value.charAt(0)=="-"))
	{
		alert("Arithmetic characters are not allowed in " + Cont_Name + ". Please remove the arithmetic character and re-enter the data.")
		return false;
	} 
	 else if (Cont_Value!="")
	{
		
		if(  parseInt(Cont_Value) <=0 ) 
		{
		   	alert (" Only value greater than or equal to zero is allowed in " + Cont_Name + ". Please re-enter the data.")
			return false
		}	

		for(i=0;i<Cont_Value.length;i++)
			{
				var ch  = Cont_Value.charAt(i);
				if(ch=='.')
				  {
					alert ("Only integer values are allowed in " + Cont_Name + ". Please re-enter the data.")
					return false;
				 }
                        }
	}
	else
		return true;
}
/*
//Validation only for numbers
function checkInteger(input,control,compulsory)
{
	var Cont_Value = input;
	var Cont_Name =control;
	var Cont_Validate=compulsory;

	if ((Cont_Validate=="Y") &&(Cont_Value.length==0))
	{
		alert (Cont_Name + " is left blank. You have to fill-in this field.")
		return false
	}

	 else if((Cont_Value.charAt(0)=="+") || (Cont_Value.charAt(0)=="-"))
	{
		alert("Arithmetic characters are not allowed in " + Cont_Name + ". Please remove the arithmetic character and re-enter the data.")
		return false;
	}
	else if (Cont_Value!="")
	{
		
		if(  parseInt(Cont_Value) < 0 ) 
		{
		   	alert (" Only value greater than or equal to zero is allowed in " + Cont_Name + ". Please re-enter the data.")
			return false
		}	

		for(i=0;i<Cont_Value.length;i++)
		{
			var str=Cont_Value.charAt(i)
			if (!( (str >= 0 && str <=9)|| (str=='.') || (str==',')))
			{	
				alert ("Only integer values are allowed in " + Cont_Name + ". Please re-enter the data.")
				return false
			}
		}
	}
	else
		return true;
}


//checking for amount
function checkFloat(input,control,compulsory)
{
	
	var Cont_Name =control;
	var Cont_Validate=compulsory;
	var Cont_Value = input;
	
	if ((Cont_Validate=="Y") &&(Cont_Value.length==0))
	{
		alert (Cont_Name + " is left blank. You have to fill-in this field.")
		return false
	}
	
	else if((Cont_Value.charAt(0)=="+") || (Cont_Value.charAt(0)=="-"))
	{
		alert("Arithmetic characters are not allowed in " + Cont_Name + ". Please remove the arithmetic character and re-enter the data.")
		return false;
	}
	else if (Cont_Value!="")
		{
			if(isNaN(Cont_Value) || (Cont_Value.charAt(0)==" "))
			{
				alert(Cont_Name + " can allow only values greater than Zero. Plese re-enter the data.")
				return false
			}	
			for(i=0;i<Cont_Value.length;i++)
			{
				var ch  = Cont_Value.charAt(i);
				if(ch=='.')
				 	 {
						var substr=Cont_Value.substring(i+1,Cont_Value.length);
					
						if(substr.length > 2)
							{
								alert(Cont_Name + " Can allow Only Two digits after decimal. Please re-enter data.")
					
								return false;
							}
				 		}
              }
			if(Cont_Value<=0)
			{
				alert("Only value greater than zero is allowed in " + Cont_Name + ". Please re-enter the data.")
				return false
			}	
						
		}
		else
		return true
}

// function to check only alphabets and numbers

function AlphaNum(input,control,compulsory)
{
	var Cont_Value = input;
	var Cont_Name =control;
	var Cont_Validate=compulsory;
	
	if ((Cont_Validate=="Y") &&(Cont_Value.length==0))
	{
		alert (Cont_Name + " is left blank. You have to fill-in this field.")
		return false
	}	
	
	else if ((Cont_Validate=="Y") && (Cont_Value.length==0))
	{
		alert (Cont_Name + " is left blank. You have to fill-in this field.")
		return false
	}
	else if ((chkBlankSpaces(Cont_Value,Cont_Name,Cont_Validate)==false))
	{
			alert (Cont_Name + " does not allow spaces. Please re-enter the data.")
			return false
	}	
	else if (Cont_Value!="")
	{
		for(i=0;i<Cont_Value.length;i++)
		{
			var str=Cont_Value.charAt(i)
			if (!((str >= "A" && str <= "Z" ) || (str >= "a" && str <= "z") || (str >= 0 && str <=9)))
			{	
				alert (Cont_Name + " allows only Alphabets and Integers (eg. quantity1). Please re-enter the data." )
				return false
			}
		}
	}
	else
		return true
}

*/
function AlphaNumWithSpace(input,control,compulsory)
{
  
	var Cont_Value = input;
	var Cont_Name =control;
	var Cont_Validate=compulsory;
	
	
	if ((Cont_Validate=="Y") &&(Cont_Value.length==0))
	{
		alert (Cont_Name + " is left blank. You have to fill-in this field.")
		return false
	}	
	else if ((Cont_Validate=="Y") &&(Cont_Value.charAt(0)==" "))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
		return false
	}
	else if ((Cont_Value.charAt(0)==" "))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
		return false
	}
	else if (Cont_Value!="")
	{
		for(i=0;i<Cont_Value.length;i++)
		{
			var str=Cont_Value.charAt(i)
			if (!((str >= "A" && str <= "Z" ) || (str >= "a" && str <= "z") || (str <= " ")  || (str >= 0 && str <=9)))
			{	
				alert (Cont_Name + " allows only Alphabets, Integers and space (eg. quantity1). Please re-enter data." )
				return false
			}
		}
	}
	else
		return true
}


/*
// checking for only charcters 
function ValidAlpha(input,control,compulsory)
{
	var Cont_Value = input;
	var Cont_Name =control;
	var Cont_Validate=compulsory;
	//var flag=false;
	var spcount=0;
	
	for(i=0;i<Cont_Value.length;i++)
		{
			var str=Cont_Value.charAt(i)
			if (str==" ") spcount++;
			if (!((str >= "A" && str <= "Z" ) || (str >= "a" && str <= "z") || (str == " ") || (str == ".")))
			{	
			  alert (Cont_Name + " allows only alphabets,space and . (eg. Stage1). Please re-enter data")
			    //flag = false;                           
			}

		}
	if ((spcount==i) && (i != 0))
		//flag=false;

		return false
}

//function to check numbers


function ValidateDigits(input, control, compulsory)
{
	var Cont_Value = input;
	var Cont_Name =control;
	var Cont_Validate=compulsory;
	
	if ((Cont_Value=="") && (Cont_Validate=="Y"))
	{
		alert (Cont_Name + " is left blank. You have to fill-in this field.")
		return false;
	}
	else if ((Cont_Validate=="Y") &&(Cont_Value.charAt(0)==" "))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
		return false
	}
	else if ((Cont_Value.charAt(0)==" "))
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
		return false
	}
	else if ((Cont_Value.charAt(0)==0) && (Cont_Value!=""))
	{
		alert (Cont_Name + " does not allow a data with first character as a '0' character. Please re-enter the data.");
		return false;
	}
	else if((Cont_Value.charAt(0)=="+") || (Cont_Value.charAt(0)=="-"))
	{
		alert("Arithmetic characters are not allowed in " + Cont_Name + ". Please remove the arithmetic character and re-enter the data.")
		return false;
	}
	else if(!isPin(Cont_Value))
	{
		alert ("Please enter a valid number in "+ Cont_Name +  " NOTE: First character cannot be a zero and "  + Cont_Name + " allows only numbers greater than zero (eg. 12345). Please re-enter the data.")
		return false;
	}	
	else
		return true;
}


*/


//function alphaNumaric with some special characters
function alphanumspecial(input,control,compulsory)
{
	var Cont_Value = input;
	var Cont_Name =control;
	var Cont_Validate=compulsory;
	
	if(Cont_Name == "User Name")
	{
	if(Cont_Value.length < 6)
	{
	  alert(Cont_Name + " must be grater than 6 characters");
	  return false;
	}
	}
	
	if ((Cont_Value=="") && (Cont_Validate=="Y"))
	{
		alert (Cont_Name + " is left blank. You have to fill-in this field.");
		return false
	}
	else if (Cont_Value.charAt(0)==" ")
	{
		alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
		return false;
	}
	
	else if (Cont_Value!="")
	{
		for(i=0;i<Cont_Value.length;i++)
		{
			var str=Cont_Value.charAt(i)
			if (!((str >= "A" && str <= "Z" ) || (str >= "a" && str <= "z") || (str >= 0 && str <=9)|| (str=="_")))
			{	
				alert ("Only alphabets, integers and special characters ( _ )  are allowed in  " + Cont_Name + " Please re-enter correct data.")

				return false
			}
		}
	}
		
	else 
		return true
}


function chkPassword(input,cinput,control,compulsory)
{
	var Cont_Value = input;
	var Cont_Name =control;
	var Cont_Validate=compulsory;
	var cnfPassword=cinput;
	
	if(Cont_Value.length < 6 || cnfPassword.length < 6 )
	{
	  alert(Cont_Name + " must be grater than 6 characters");
	  return false;
	}
	
	if ((Cont_Value=="") && (Cont_Validate=="Y"))
	{
		alert (Cont_Name + " is left blank. You have to fill-in this field.")
		return false
	}
	else if ((cnfPassword=="") && (Cont_Validate=="Y"))
	{
		alert (Cont_Name + " is left blank. You have to fill-in this field.")
		return false
	}
	else if (Cont_Value != cnfPassword)
	{
		alert("Password and Confirm Password Must be Same")
		return false
	}
	else
		return true
}


/*
function logout()
{	
	document.parentWindow.parent.location="logout.asp"
		
}

*/
function chkURL(url,textfield,compulsory)
{  
 var Cont_Value = url;
	var Cont_Name =textfield;
	var Cont_Validate=compulsory;
	
	if ((Cont_Value=="") && (Cont_Validate=="Y"))
	{
		alert (Cont_Name + " is left blank. You have to fill-in this field.");
		return false
	}
	else if (Cont_Value!="")
   {
   	url = url.toLowerCase();
	   while(url.charAt(0)== " ")    
	     {
		    url = url.substring(1,url.length);
	     }
		textfield.value	=	url;
		 if (url.substring(0,7)== "http://")
	 	    {
	 		 return true;
	 	   }
		 else
		 {
		    alert("URL Should Start with http://");
			return false;
	 	}
	 	
  }

}


/*
function ValidatetwoDates(Linput,input,control,control1,compulsory)
{
	var dtmBidDate=Linput;
	var dtmLeadDate=input;
	Cont_Value=input;
	Cont_Name=control;
	Cont_Validate=compulsory;
	var ctrl	=	control1;
	
	if ((Cont_Validate=="Y") &&(Cont_Value.length==0))
	{
		alert (Cont_Name + " is left blank. You have to fill-in this field.")
		return false
	}

	
	else if (Cont_Value!="")
	{
		var Byear
		var Lyear
		var Lmon
		var Bmon
		var Lday
		var Bday
	
		var MonPosLDate = dtmLeadDate.indexOf("/",-1)
		var DayPosLDate= dtmLeadDate.lastIndexOf("/")
	
		var MonPosBDate = dtmBidDate.indexOf("/",-1)
		var DayPosBDate= dtmBidDate.lastIndexOf("/")
			
		Lyear=dtmLeadDate.substr(eval(DayPosLDate+1),4)
		Byear=dtmBidDate.substr(eval(DayPosBDate+1),4)
	
		//Lmon=dtmLeadDate.substr(0,MonPosLDate)
		//Bmon=dtmBidDate.substr(0,MonPosBDate)

		//Lday=dtmLeadDate.substr(eval(MonPosLDate+1),eval(DayPosLDate-MonPosLDate-1))
		//Bday=dtmBidDate.substr(eval(MonPosBDate+1),eval(DayPosBDate-MonPosBDate-1))
		
		 Lday=dtmLeadDate.substr(0,MonPosLDate)
                	 Bday=dtmBidDate.substr(0,MonPosBDate)
 
                	Lmon=dtmLeadDate.substr(eval(MonPosLDate+1),eval(DayPosLDate-MonPosLDate-1))
                	Bmon=dtmBidDate.substr(eval(MonPosBDate+1),eval(DayPosBDate-MonPosBDate-1))  	

		if (eval(Lyear)>eval(Byear))
		{
			return true
		}
		else if ((eval(Lyear)==eval(Byear)) && (eval(Lmon)>eval(Bmon)))
		{
			return true
		}
		else if ((eval(Lyear)==eval(Byear)) && (eval(Lmon)== eval(Bmon)) && (eval(Lday)>eval(Bday)))
		{
			return true
		}
		else if ((eval(Lyear)==eval(Byear)) && (eval(Lmon)== eval(Bmon)) && (eval(Lday)==eval(Bday)))
		{
			return true
		}
		else
		{
			alert(Cont_Name + " cannot be less than " + control1 + " "+ Linput )
			return false
		}

	}
	else
		return true
}


//restricting field length
function FieldLength(input,control,compulsory,fieldlen)
{
	
	var Cont_Value = input;
	var Cont_Name =control;
	var Cont_Validate=compulsory;
	var Cont_Length=fieldlen;
	if ((Cont_Value=="") && (Cont_Validate=="Y"))
	{
		alert(Cont_Name + " Can Not be Blank")
		return false
	}
	else if (Cont_Value.length > Cont_Length)
	{
		alert (Cont_Name + " Field Length Can Not be Greater than " + Cont_Length + " Characters")
		return false
	}

	else
		return alphanumspecial(input,control,compulsory);
		return true
}




function isNum(val){
 var re=/[^0-9]/;
 return !re.test(val);
}


//function to accept only numeric it will accept 0 as first digit also
function ValidateNumber(input, control, compulsory)
{
 var Cont_Value = input;
 var Cont_Name =control;
 var Cont_Validate=compulsory;
 
 if ((Cont_Value=="") && (Cont_Validate=="Y"))
 {
  alert (Cont_Name + " is left blank. You have to fill-in this field.")
  return false;
 }
 else if ((Cont_Validate=="Y") &&(Cont_Value.charAt(0)==" "))
 {
  alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
  return false
 }
 else if ((Cont_Value.charAt(0)==" "))
 {
  alert (Cont_Name + " does not allow a data with first character as a blank character. Please re-enter the data.")
  return false
 }
 else if((Cont_Value.charAt(0)=="+") || (Cont_Value.charAt(0)=="-"))
 {
  alert("Arithmetic characters are not allowed in " + Cont_Name + ". Please remove the arithmetic character and re-enter the data.")
  return false;
 }
 else if(!isNum(Cont_Value))
 {
  alert ("Please enter a valid number in "+ Cont_Name +  " and "  + Cont_Name + " allows only numbers greater than zero (eg. 12345). Please re-enter the data.")
  return false;
 } 
 else
  return true;
}
 
*/
function validateusrid(input, control, compulsory)
{
	var Cont_Value = input;
	var Cont_Name =control;
	var Cont_Validate=compulsory;
	alert(Count_Value.length);
	if ((Count_Value.length < 4) || (Count_Value.length > 20)) 
	{
	alert ("Please enter a valid User ID in "+ Cont_Name +  " and "  + Cont_Name + " allows only IDS > 4 and  < 20. Please re-enter the data.")
	}
	return false;
}

   
   
   
   
   
