//Vehicle Validation
function Vehicle_Validator(theForm)
	{
	//Validate Function 
	function validate(value,checkOk)
	{
	var checkStr = 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) {
		return (false);
	  }
	else { return (true); }
  }

		//Trim script
		function Trim(STRING){
		STRING = LTrim(STRING);
		return RTrim(STRING);
		}

		function RTrim(STRING){
		while(STRING.charAt((STRING.length -1))==" "){
		STRING = STRING.substring(0,STRING.length-1);
		}
		return STRING;
		}

		function LTrim(STRING){
		while(STRING.charAt(0)==" "){
		STRING = STRING.replace(STRING.charAt(0),"");
		}
		return STRING;
		}
	 // emptycheck
	 var flag=true;
	 function emptystring(value)
	 {
	   if (value=="") return (false);
	   else return(true);
	 }

	
//Vehicle Name
	theForm.vehiclename.value = LTrim(theForm.vehiclename.value);
	theForm.vehiclename.value = RTrim(theForm.vehiclename.value);
	if (!emptystring(theForm.vehiclename.value))
		 {
			alert("Please enter Vehicle name");
			theForm.vehiclename.focus();
			flag=false;
			return (false);
		}
 
	//Set this return value to true when you want to submit the form
	return (flag);
}

function Update_Vehicle(theForm)
	{
	//Validate Function 
	function validate(value,checkOk)
	{
	var checkStr = 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) {
		return (false);
	  }
	else { return (true); }
  }

		//Trim script
		function Trim(STRING){
		STRING = LTrim(STRING);
		return RTrim(STRING);
		}

		function RTrim(STRING){
		while(STRING.charAt((STRING.length -1))==" "){
		STRING = STRING.substring(0,STRING.length-1);
		}
		return STRING;
		}

		function LTrim(STRING){
		while(STRING.charAt(0)==" "){
		STRING = STRING.replace(STRING.charAt(0),"");
		}
		return STRING;
		}
	 // emptycheck
	 var flag=true;
	 function emptystring(value)
	 {
	   if (value=="") return (false);
	   else return(true);
	 }

	
//Update Vehicle Name
	theForm.vehiclename.value = LTrim(theForm.vehiclename.value);
	theForm.vehiclename.value = RTrim(theForm.vehiclename.value);
	if (!emptystring(theForm.vehiclename.value))
		 {
			alert("Please update Vehicle name");
			theForm.vehiclename.focus();
			flag=false;
			return (false);
		}
 
	//Set this return value to true when you want to submit the form
	return (flag);
}

//Brand Validation
function Add_Brand(theForm)
	{
	//Validate Function 
	function validate(value,checkOk)
	{
	var checkStr = 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) {
		return (false);
	  }
	else { return (true); }
  }

		//Trim script
		function Trim(STRING){
		STRING = LTrim(STRING);
		return RTrim(STRING);
		}

		function RTrim(STRING){
		while(STRING.charAt((STRING.length -1))==" "){
		STRING = STRING.substring(0,STRING.length-1);
		}
		return STRING;
		}

		function LTrim(STRING){
		while(STRING.charAt(0)==" "){
		STRING = STRING.replace(STRING.charAt(0),"");
		}
		return STRING;
		}
	 // emptycheck
	 var flag=true;
	 function emptystring(value)
	 {
	   if (value=="") return (false);
	   else return(true);
	 }
	 
//Select Vehicle Name
	theForm.selVehi.value = LTrim(theForm.selVehi.value);
	theForm.selVehi.value = RTrim(theForm.selVehi.value);
	if (!emptystring(theForm.selVehi.value))
		 {
			alert("Please select Vehicle name");
			theForm.selVehi.focus();
			flag=false;
			return (false);
		}

//Add Brand Name
	theForm.brandname.value = LTrim(theForm.brandname.value);
	theForm.brandname.value = RTrim(theForm.brandname.value);
	if (!emptystring(theForm.brandname.value))
		 {
			alert("Please enter Brand name");
			theForm.brandname.focus();
			flag=false;
			return (false);
		}

	//Set this return value to true when you want to submit the form
	return (flag);
}

//Update Brand Name
function Update_Brand(theForm)
	{
	//Validate Function 
	function validate(value,checkOk)
	{
	var checkStr = 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) {
		return (false);
	  }
	else { return (true); }
  }

		//Trim script
		function Trim(STRING){
		STRING = LTrim(STRING);
		return RTrim(STRING);
		}

		function RTrim(STRING){
		while(STRING.charAt((STRING.length -1))==" "){
		STRING = STRING.substring(0,STRING.length-1);
		}
		return STRING;
		}

		function LTrim(STRING){
		while(STRING.charAt(0)==" "){
		STRING = STRING.replace(STRING.charAt(0),"");
		}
		return STRING;
		}
	 // emptycheck
	 var flag=true;
	 function emptystring(value)
	 {
	   if (value=="") return (false);
	   else return(true);
	 }
	 
//Select Vehicle Name
	theForm.selVehi.value = LTrim(theForm.selVehi.value);
	theForm.selVehi.value = RTrim(theForm.selVehi.value);
	if (!emptystring(theForm.selVehi.value))
		 {
			alert("Please select Vehicle name");
			theForm.selVehi.focus();
			flag=false;
			return (false);
		}

//Update Brand Name
	theForm.brandname.value = LTrim(theForm.brandname.value);
	theForm.brandname.value = RTrim(theForm.brandname.value);
	if (!emptystring(theForm.brandname.value))
		 {
			alert("Please update Brand name");
			theForm.brandname.focus();
			flag=false;
			return (false);
		}

	//Set this return value to true when you want to submit the form
	return (flag);
}


//Model Validation
function Add_Model(theForm)
	{
	//Validate Function 
	function validate(value,checkOk)
	{
	var checkStr = 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) {
		return (false);
	  }
	else { return (true); }
  }

		//Trim script
		function Trim(STRING){
		STRING = LTrim(STRING);
		return RTrim(STRING);
		}

		function RTrim(STRING){
		while(STRING.charAt((STRING.length -1))==" "){
		STRING = STRING.substring(0,STRING.length-1);
		}
		return STRING;
		}

		function LTrim(STRING){
		while(STRING.charAt(0)==" "){
		STRING = STRING.replace(STRING.charAt(0),"");
		}
		return STRING;
		}
	 // emptycheck
	 var flag=true;
	 function emptystring(value)
	 {
	   if (value=="") return (false);
	   else return(true);
	 }
	 
//Select Vehicle Name
	theForm.selVehi.value = LTrim(theForm.selVehi.value);
	theForm.selVehi.value = RTrim(theForm.selVehi.value);
	if (!emptystring(theForm.selVehi.value))
		 {
			alert("Please select Vehicle name");
			theForm.selVehi.focus();
			flag=false;
			return (false);
		}

//Select Brand Name
	theForm.selBrand.value = LTrim(theForm.selBrand.value);
	theForm.selBrand.value = RTrim(theForm.selBrand.value);
	if (!emptystring(theForm.selBrand.value))
		 {
			alert("Please select Brand name");
			theForm.selBrand.focus();
			flag=false;
			return (false);
		}

//Add Model Name
	theForm.modelname.value = LTrim(theForm.modelname.value);
	theForm.modelname.value = RTrim(theForm.modelname.value);
	if (!emptystring(theForm.modelname.value))
		 {
			alert("Please enter Model name");
			theForm.modelname.focus();
			flag=false;
			return (false);
		}

	//Set this return value to true when you want to submit the form
	return (flag);
}


//Update Model Name
function Update_Model(theForm)
	{
	//Validate Function 
	function validate(value,checkOk)
	{
	var checkStr = 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) {
		return (false);
	  }
	else { return (true); }
  }

		//Trim script
		function Trim(STRING){
		STRING = LTrim(STRING);
		return RTrim(STRING);
		}

		function RTrim(STRING){
		while(STRING.charAt((STRING.length -1))==" "){
		STRING = STRING.substring(0,STRING.length-1);
		}
		return STRING;
		}

		function LTrim(STRING){
		while(STRING.charAt(0)==" "){
		STRING = STRING.replace(STRING.charAt(0),"");
		}
		return STRING;
		}
	 // emptycheck
	 var flag=true;
	 function emptystring(value)
	 {
	   if (value=="") return (false);
	   else return(true);
	 }
	 
//Select Vehicle Name
	theForm.selVehi.value = LTrim(theForm.selVehi.value);
	theForm.selVehi.value = RTrim(theForm.selVehi.value);
	if (!emptystring(theForm.selVehi.value))
		 {
			alert("Please select Vehicle name");
			theForm.selVehi.focus();
			flag=false;
			return (false);
		}

//Select Brand Name
	theForm.selBrand.value = LTrim(theForm.selBrand.value);
	theForm.selBrand.value = RTrim(theForm.selBrand.value);
	if (!emptystring(theForm.selBrand.value))
		 {
			alert("Please select Brand name");
			theForm.selBrand.focus();
			flag=false;
			return (false);
		}

//Update Model Name
	theForm.modelname.value = LTrim(theForm.modelname.value);
	theForm.modelname.value = RTrim(theForm.modelname.value);
	if (!emptystring(theForm.modelname.value))
		 {
			alert("Please update Model name");
			theForm.modelname.focus();
			flag=false;
			return (false);
		}

	//Set this return value to true when you want to submit the form
	return (flag);
}


//Battery Validation
function Add_Battery(theForm)
	{
	//Validate Function 
	function validate(value,checkOk)
	{
	var checkStr = 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) {
		return (false);
	  }
	else { return (true); }
  }

		//Trim script
		function Trim(STRING){
		STRING = LTrim(STRING);
		return RTrim(STRING);
		}

		function RTrim(STRING){
		while(STRING.charAt((STRING.length -1))==" "){
		STRING = STRING.substring(0,STRING.length-1);
		}
		return STRING;
		}

		function LTrim(STRING){
		while(STRING.charAt(0)==" "){
		STRING = STRING.replace(STRING.charAt(0),"");
		}
		return STRING;
		}
	 // emptycheck
	 var flag=true;
	 function emptystring(value)
	 {
	   if (value=="") return (false);
	   else return(true);
	 }
	 
//Select Vehicle Name
	theForm.selVehi.value = LTrim(theForm.selVehi.value);
	theForm.selVehi.value = RTrim(theForm.selVehi.value);
	if (!emptystring(theForm.selVehi.value))
		 {
			alert("Please select Vehicle name");
			theForm.selVehi.focus();
			flag=false;
			return (false);
		}

//Select Brand Name
	theForm.selBrand.value = LTrim(theForm.selBrand.value);
	theForm.selBrand.value = RTrim(theForm.selBrand.value);
	if (!emptystring(theForm.selBrand.value))
		 {
			alert("Please select Brand name");
			theForm.selBrand.focus();
			flag=false;
			return (false);
		}

//Select Model Name
	theForm.selModel.value = LTrim(theForm.selModel.value);
	theForm.selModel.value = RTrim(theForm.selModel.value);
	if (!emptystring(theForm.selModel.value))
		 {
			alert("Please select Model name");
			theForm.selModel.focus();
			flag=false;
			return (false);
		}

//Add Battery Name
	theForm.batteryname.value = LTrim(theForm.batteryname.value);
	theForm.batteryname.value = RTrim(theForm.batteryname.value);
	if (!emptystring(theForm.batteryname.value))
		 {
			alert("Please enter Battery name");
			theForm.batteryname.focus();
			flag=false;
			return (false);
		}

	//Set this return value to true when you want to submit the form
	return (flag);
}

//Update Battery 
function Update_Battery(theForm)
	{
	//Validate Function 
	function validate(value,checkOk)
	{
	var checkStr = 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) {
		return (false);
	  }
	else { return (true); }
  }

		//Trim script
		function Trim(STRING){
		STRING = LTrim(STRING);
		return RTrim(STRING);
		}

		function RTrim(STRING){
		while(STRING.charAt((STRING.length -1))==" "){
		STRING = STRING.substring(0,STRING.length-1);
		}
		return STRING;
		}

		function LTrim(STRING){
		while(STRING.charAt(0)==" "){
		STRING = STRING.replace(STRING.charAt(0),"");
		}
		return STRING;
		}
	 // emptycheck
	 var flag=true;
	 function emptystring(value)
	 {
	   if (value=="") return (false);
	   else return(true);
	 }
	 
//Select Vehicle Name
	theForm.selVehi.value = LTrim(theForm.selVehi.value);
	theForm.selVehi.value = RTrim(theForm.selVehi.value);
	if (!emptystring(theForm.selVehi.value))
		 {
			alert("Please select Vehicle name");
			theForm.selVehi.focus();
			flag=false;
			return (false);
		}

//Select Brand Name
	theForm.selBrand.value = LTrim(theForm.selBrand.value);
	theForm.selBrand.value = RTrim(theForm.selBrand.value);
	if (!emptystring(theForm.selBrand.value))
		 {
			alert("Please select Brand name");
			theForm.selBrand.focus();
			flag=false;
			return (false);
		}

//Select Model Name
	theForm.selModel.value = LTrim(theForm.selModel.value);
	theForm.selModel.value = RTrim(theForm.selModel.value);
	if (!emptystring(theForm.selModel.value))
		 {
			alert("Please select Model name");
			theForm.selModel.focus();
			flag=false;
			return (false);
		}

//Update Brand Name
	theForm.brandname.value = LTrim(theForm.brandname.value);
	theForm.brandname.value = RTrim(theForm.brandname.value);
	if (!emptystring(theForm.brandname.value))
		 {
			alert("Please update Brand name");
			theForm.brandname.focus();
			flag=false;
			return (false);
		}

	//Set this return value to true when you want to submit the form
	return (flag);
}

