function isEmail(elm) 
	{
	var str=elm.value
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (filter.test(str))
		testresults=true
	else
		testresults=false
	return (testresults)
	}

/*********************************************************************************************/


// return the value of the radio button that is checked
// return an empty string if none are checked, or
// there are no radio buttons

function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}


/*********************************************************************************************/

function Agree(checkObj)
	{
		if (!checkObj.checked)
		{
			//alert('Please tick the check box to continue')
			return false;
		}
			
		else
		{
			return true;
		}
	}

/*********************************************************************************************/

function popUp2(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=no,width=596,height=600,left = 312,top = 30');");
	}
	
/*********************************************************************************************/	
	
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

/*********************************************************************************************/	

function ccCardNumber(cardNumber) 
{
  var cardTotal=0;
  var dnum=0;
  var test=0;
  if (cardNumber.length < 13) { return (false); }
  else
    {
    for ( i = cardNumber.length; i >= 1 ;  i--)	{
	  test=test+1;
	  num = cardNumber.charAt(i-1);
	  if ((test % 2) != 0) cardTotal=cardTotal+parseInt(num)
	  else {
		dnum=parseInt(num)*2;
		if (dnum >= 10) cardTotal=cardTotal+1+dnum-10
		else cardTotal=cardTotal+dnum;
		}
    }
  if ((cardTotal % 10) != 0){ return (false); }else{ return(true); }
  }
}

/*********************************************************************************************/	

function IsNumeric(inputText) {
  var okChars = "0123456789.";
  var isNumber=true;
  var cChar;

  for (i = 0; i < inputText.length && isNumber == true; i++) {
    cChar = inputText.charAt(i);
    if (okChars.indexOf(cChar) == -1) {
      isNumber = false;
      }
    }
  return isNumber;
}
	
/**********************************************************************************************/
/* Functions for ste 4 of horse */

function countCheck1() 
	{
	var checkbox_choices = 0;
	
	// Loop from zero to the one minus the number of checkbox button selections
	for (counter = 0; counter < document.forms.quoteform.check1.length; counter++)
	{
	
	// If a checkbox has been selected it will return true
	// (If not it will return false)
	if (document.forms.quoteform.check1[counter].checked)
	{ checkbox_choices = checkbox_choices + 1; }
	
	}
	return checkbox_choices;	
	}
	
function countCheck2() 
	{
	var checkbox_choices = 0;
	
	// Loop from zero to the one minus the number of checkbox button selections
	for (counter = 0; counter < document.forms.quoteform.check2.length; counter++)
	{
	
	// If a checkbox has been selected it will return true
	// (If not it will return false)
	if (document.forms.quoteform.check2[counter].checked)
	{ checkbox_choices = checkbox_choices + 1; }
	
	}
	return checkbox_choices;	
	}	
	
function countCheck3() 
	{/*
	var checkbox_choices = 0;
	
	// Loop from zero to the one minus the number of checkbox button selections
	for (counter = 0; counter < document.forms.form2.check3.length; counter++)
	{
	
	// If a checkbox has been selected it will return true
	// (If not it will return false)
	if (document.forms.form2.check3[counter].checked)
	{ checkbox_choices = checkbox_choices + 1; }
	
	}
	return checkbox_choices;	
*/
	if (document.forms.quoteform.check3.checked == true)
		return 1;
	else
		return 0;
	}
	
function countCheck4() 
	{
	var checkbox_choices = 0;
	
	// Loop from zero to the one minus the number of checkbox button selections
	for (counter = 0; counter < document.forms.quoteform.check4.length; counter++)
	{
	
	// If a checkbox has been selected it will return true
	// (If not it will return false)
	if (document.forms.quoteform.check4[counter].checked)
	{ checkbox_choices = checkbox_choices + 1; }
	
	}
	return checkbox_choices;	
	}		

function validarCheck(){
   
  var i=0;var cCheck=0;
  var objInput = document.forms.quoteform.getElementsByTagName("input");
  var lObj = (objInput!=null)? objInput.length : 0;
  
 for(i=0;i<lObj;i++){    
    if ((objInput[i].type=="checkbox")&&(objInput[i].checked)) cCheck++;   
 }
 
 return (cCheck);
}

/**********************************************************************************************/

function DisableVet()
	{
	if (document.forms.quoteform.NoVet.checked) 
		{
		document.forms.quoteform.VetName.disabled = true;
		document.forms.quoteform.VetAddress.disabled = true;
		document.forms.quoteform.VetContact.disabled = true;
		document.forms.quoteform.VetName.value = "";
		document.forms.quoteform.VetAddress.value = "";
		document.forms.quoteform.VetContact.value = "";
		}
	else 
		{
		document.forms.quoteform.VetName.disabled = false;
		document.forms.quoteform.VetAddress.disabled = false;
		document.forms.quoteform.VetContact.disabled = false;
		}
	}
	
/**********************************************************************************************/	
	
	
function confirmDelete(filename,prompt)
	{
	if(confirm(prompt))
		location= filename;
	}
	
/**********************************************************************************************/	

function isIllegalwithNumsNoAlpa(field){
		var legalChars = false;
		var aIllegalChars = new Array(",",".","=","+","#","~","<",">","/","\\","{","}","[","]","%","!","£","€","^","&","(",")","-","'","$","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z")
		for (var i=0;i<aIllegalChars.length;i++){
			if (field.value.indexOf(aIllegalChars[i]) != -1){
				legalChars = false;
				break;
				}
			else legalChars = true;	
			}
	
		
	
		if (legalChars == true){
			return false;
			}
		else{
			return true;
		}
}
