/**
document.pnr_form.tfPaxdepan1.focus();
function Pindah()
{
	var panjang = document.pnr_form.mysecnum.value.length;
	if(panjang == 6)
	{
		document.pnr_form.Submit.focus();
	}
	return true;
}
**/
	var splithref= location.href.split('/');
	var baseHref= splithref[0]+'//'+splithref[2]+'/';

	function Pindah(objInput,objSubmit)
	{

		cUrl = baseHref+"public/formvalidation/formvalidation.php?validationtype=ajax&val=";
		cVal = objInput.value; //get value inside of input field
		cPass = '';
		//alert(passawal);
		cRules = objInput.className.split(' '); // get all the rules from the input box classname
		cRequired = cRules[1]; // determines if field is required or not
		cTypeCheck = cRules[2]; //typecheck are additional validation rules (ie. email, phone, date)
		cIdMsg = cRules[3]; //target object element to show the messages
		cLength = cVal.length;
		
		
		if (cLength == 6) {		
			http.open("GET", cUrl + (cVal) + "&sRequired=" + (cRequired) + "&sTypeCheck=" + (cTypeCheck) + "&passawal=" + cPass, true);
  
			http.onreadystatechange = function() { 	// handle what to do with the feedback 
			
				if (http.readyState == 4) 
 				{
  					cResults = http.responseText.split(",");
			
					if ((cResults[0] != 'Terima Kasih')) {
						objInput.focus();
					}
					document.getElementById(cIdMsg).innerHTML = cResults[0];
  				}
			}
			
			http.send(null);
		} else if (cLength == 0) {
			document.getElementById(cIdMsg).innerHTML = 'Harus Diisi';
		} else {
			document.getElementById(cIdMsg).innerHTML = 'Tidak sesuai';
		}
		
		return true;
	}