
function checkNum(field) {
  var valid = "0123456789.*"
  var ok = "yes",TotalCost,Cost;

  for (var i=0; i<field.value.length;i++){
    temp=""+field.value.substring(i,i+1);
    if (valid.indexOf(temp) == "-1") {
        ok="no";
        break;
	}
  }
  if (ok == "no") {
	alert("Please input number");
	field.focus();
	field.select();
	return false;
  }
}
function cg(){
   document.form.Fax_1.value=form.Phone_1.value;
}

function cg1(){
   document.form.Fax_2.value=form.Phone_2.value;
}

function checkemail(){
var str=document.forms[0].email.value
var filter=/^.+@.+\..{2,3}$/
if (filter.test(str))
	testresults=true
else
	testresults=false	
return (testresults)
}

function doesExist(inputValue){
	var aCharExists=false
		if(inputValue){
		for(var i=0; i<inputValue.length; i++){
			if(inputValue.charAt(i)!=" "){
				aCharExists=true}
		}
	}
	return aCharExists
}

function CheckForm(){
        var gotchar=true
        gotchar=doesExist(document.forms[0].booth1.value)
        if(gotchar==false){
                alert("Please input Space Dimensions")
                document.forms[0].booth1.focus()
                return false
                } 
        gotchar=doesExist(document.forms[0].booth2.value)
        if(gotchar==false){
                alert("Please input Space Dimensions")
                document.forms[0].booth2.focus()
                return false
                } 
        gotchar=doesExist(document.forms[0].company.value)
        if(gotchar==false){
                alert("Please input Company")
                document.forms[0].company.focus()
                return false
                } 		
        gotchar=doesExist(document.forms[0].contact.value)
        if(gotchar==false){
                alert("Please input Contact Person")
                document.forms[0].contact.focus()
                return false
                } 
		gotchar=doesExist(document.forms[0].country.value)
        if(gotchar==false){
                alert("Please select Country/Region")
                document.forms[0].country.focus()
                return false
                } 
        gotchar=doesExist(document.forms[0].Phone_1.value)
        if(gotchar==false){
                alert("Please input Country Code")
                document.forms[0].Phone_1.focus()
                return false
                }
        gotchar=doesExist(document.forms[0].Phone_3.value)
        if(gotchar==false){
                alert("Please input Tel No")
                document.forms[0].Phone_3.focus()
                return false
                }
        gotchar=doesExist(document.forms[0].Fax_1.value)
        if(gotchar==false){
                alert("Please input Country Code")
                document.forms[0].Fax_1.focus()
                return false
                }
        gotchar=doesExist(document.forms[0].Fax_3.value)
        if(gotchar==false){
                alert("Please input Fax No")
                document.forms[0].Fax_3.focus()
                return false
                }
        gotchar=doesExist(document.forms[0].email.value)
        if(gotchar==false){
                alert("Please input E-mail")
                document.forms[0].email.focus()
                return false
                }       
        else{
		gotchar=checkemail()
		if (gotchar==false){
			alert("Please input valid E-mail")
			document.forms[0].email.focus()
			return false
		}
	}	

 	return true;
}
