function validatepnr()
{
	pnrno1 = document.pnr_stat.lccp_pnrno1;
	pnrno2 = document.pnr_stat.lccp_pnrno2;

	var valid = "0123456789";
	var ok = "yes";
	var temp;

	for (var i=0; i<pnrno1.value.length; i++)
	{
		temp = "" + pnrno1.value.substring(i, i+1);
		if (valid.indexOf(temp) == "-1") ok = "no";
	}
	if (ok == "no")
	{
		alert("Invalid entry!  only numbers are accepted!");
		pnrno1.value="";
		pnrno2.value="";
		pnrno1.focus();

		return false;
	}
	if(pnrno1.value.length<3)
	{
		alert("Enter valid pnr number");
		pnrno1.value="";
		pnrno2.value="";
		pnrno1.focus();

		return false;
	}

	for (var i=0; i<pnrno2.value.length; i++)
	{
		temp = "" + pnrno2.value.substring(i, i+1);
		if (valid.indexOf(temp) == "-1") ok = "no";
	}
	if (ok == "no")
	{
		alert("Invalid entry!  only numbers are accepted!");
		pnrno1.value="";
		pnrno2.value="";
		pnrno1.focus();

		return false;
	}
	if(pnrno2.value.length<7)
	{
		alert("Enter valid pnr number");
		pnrno1.value="";
		pnrno2.value="";
		pnrno1.focus();

		return false;
	}

	return true;
}

var isNN = (navigator.appName.indexOf("Netscape")!=-1);

function autoTab(input,len, e)
{
	var keyCode = (isNN) ? e.which : e.keyCode;
	var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
	if(input.value.length >= len && !containsElement(filter,keyCode))
	{
		input.value = input.value.slice(0, len);
		input.form[(getIndex(input)+1) % input.form.length].focus();
	}

	function containsElement(arr, ele)
	{
		var found = false, index = 0;
		while(!found && index < arr.length)
		if(arr[index] == ele) found = true;
		else index++;

		return found;
	}

	function getIndex(input)
	{
		var index = -1, i = 0, found = false;
		while (i < input.form.length && index == -1)
		if (input.form[i] == input) index = i;
		else i++;
		return index;
	}
	return true;
}

function validate(field)
{
	var valid = "0123456789"
	var ok = "yes";
	var temp;
	for (var i=0; i<field.value.length; i++)
	{
		temp = "" + field.value.substring(i, i+1);
		if (valid.indexOf(temp) == "-1") ok = "no";
	}
	if (ok == "no")
	{
		alert("Invalid entry!  only numbers are accepted!");
		field.value="";
		field.focus();

		return false;
	}

	if(field.value.length<3)
	{
		alert("Enter valid pnr number");
		field.value="";
		document.pnr_stat.lccp_pnrno1.focus();

		return false;
	}

	return true;
}

function validate1(field)
{
	pnrno1 = document.pnr_stat.lccp_pnrno1;

	pnrno2 = document.pnr_stat.lccp_pnrno2;


	var valid = "0123456789";
	var ok = "yes";
	var temp;
	for (var i=0; i<pnrno1.value.length; i++)
	{
		temp = "" + pnrno1.value.substring(i, i+1);
		if (valid.indexOf(temp) == "-1") ok = "no";
	}
	if (ok == "no")
	{
		alert("Invalid entry!  only numbers are accepted!");
		pnrno1.value="";
		pnrno2.value="";
		pnrno1.focus();

		return false;
	}
	if(pnrno1.length<3)
	{
		alert("Enter valid pnr number");
		pnrno1.value="";
		pnrno2.value="";
		pnrno1.focus();

		return false;
	}

	for (var i=0; i<pnrno2.value.length; i++)
	{
		temp = "" + pnrno2.value.substring(i, i+1);
		if (valid.indexOf(temp) == "-1") ok = "no";
	}
	if (ok == "no")
	{
		alert("Invalid entry!  only numbers are accepted!");
		pnrno1.value="";
		pnrno2.value="";
		pnrno1.focus();

		return false;
	}
	if(pnrno2.length<7)
	{
		alert("Enter valid pnr number");
		pnrno1.value="";
		pnrno2.value="";
		pnrno1.focus();

		return false;
	}

	return true;
}
