function validate(first,second){
	var i,j ; 
	i=0;		
	var invalidNum = 0 ;
	var startnum=first.value;
	var endnum=second.value;
	var regexp=/\D/;
	var regexp2=/\d/;
	var regexp3=/\d\d\d\d\d\d/;
	var j= 0;
	var numpart1, numpart2, regexp2,conv_num1,conv_num2;
	numpart1=regexp3.exec(first.value);
	numpart2=regexp3.exec(second.value);
	conv_num1=parseInt(numpart1,10);
	conv_num2=parseInt(numpart2,10);
	
	if((startnum == "") && (endnum != "")){
		alert('To add a single Prize Bond Number please enter the number in the first (on the left) number field.');
		return false;
	}
	if(startnum.length < 6 || startnum.length >8){
		alert('Please enter valid Prize Bond Numbers that contain 6 numeric digits i.e. 123456, A123456 or AB123456.');
		return false;
	}
	if((endnum != "") && (startnum.length != endnum.length)){
		alert('Please enter a range of Prize Bond Numbers where both numbers have an equal number of characters.');
		return false;
	}
	if(endnum!=""){
		for(i=0;i<2;i++){
			charA = startnum.charAt(i).toUpperCase();
			charB = endnum.charAt(i).toUpperCase();		
			if(regexp.exec(charA)!=null){
				if(charA != charB){
					alert('Please enter a range of numbers that start with the same prefix.');
					return false;	
				}
			}
			else 
				break;
		}	
	
		for(;i<startnum.length;i++)
		{
			charA = startnum.charAt(i);
			charB = endnum.charAt(i);
			if((regexp2.exec(charA)==null) || (regexp2.exec(charB)==null))
			{
				alert('Please enter valid Prize Bond Numbers i.e. 123456, A123456 or AB123456, with no character spaces.');
				return false;
			}		
			j++;
		} 
		if(j!=6){
			alert('Please enter valid Prize Bond Numbers that contain 6 numeric digits i.e. 123456, A123456 or AB123456.');
			return false;
		}
		if(conv_num1 > conv_num2){
			alert('The second number must be greater in value than the first.');
			return false;
		}
	}
	else 
	{
		for(i=0;i<2;i++)
		{
			charA = startnum.charAt(i);			
			if(regexp.exec(charA)==null)									
				break;
		}	
		for(;i<startnum.length;i++)
		{
			charA = startnum.charAt(i);			
			if(regexp2.exec(charA)==null)
			{
				alert('Please enter valid Prize Bond Numbers i.e. 123456, A123456 or AB123456, with no character spaces.');
				return false;
			}
			j++;		
		} 
		if(j!=6){
			alert('Please enter valid Prize Bond Numbers that contain 6 numeric digits i.e. 123456, A123456 or AB123456.');
			return false;
		}
	}
	
	return true;
}