
function orderValid()
{
	found=false;
	valid=true;
	require = "";
	if(document.OrderForm.establishment.value=="" || document.OrderForm.establishment.value.length<3)
	{
		found=true;
		require += "*Establishment (size 3) ";
	}
	if(document.OrderForm.orderName.value=="" || document.OrderForm.orderName.value.length<3)
	{
		found=true;
		require += "*Person Name (size 3) ";
	}

	if(document.OrderForm.email.value=="")
	{
		found=true;
		require += "*Email ";
	}
	
	if(document.OrderForm.tel.value=="" )
	{
		found=true;
		require += "*Tel ";
	}
	
	if(document.OrderForm.tel.value!="")
	{
		valid=false;
		valid = checknumber(document.OrderForm.tel.value)
	}
	
	if(found==true)
	 alert("Please fill in "+require);
	else if(found==false && valid==true)
	{
		//alert("SENDING");
		if(CheckEmail(document.OrderForm.email.value))
		{
			document.OrderForm.submit();
		}
	}
	
}

function regValid()
{
	found=false;
	valid=true;
	require = "";
	if(document.register.establishment.value=="" || document.register.establishment.value.length<3)
	{
		found=true;
		require += "*Establishment (size 3) ";
	}
	if(document.register.name.value=="" || document.register.name.value.length<3)
	{
		found=true;
		require += "*Person Name (size 3) ";
	}
	if(document.register.province.value=="" || document.register.province.value.length<3)
	{
		found=true;
		require += "*Province (size 3) ";
	}
	
	
	if(document.register.tel.value=="" )
	{
		found=true;
		require += "*Tel ";
	}
	
	if(document.register.email.value=="" )
	{
		found=true;
		require += "*Email ";
	}
	
	if(document.register.password.value=="" )
	{
		found=true;
		require += "*Password ";
	}
	
	if(document.register.confirmPass.value=="" )
	{
		found=true;
		require += "*Password Confirmation ";
	}
	
	if(document.register.tel.value!="")
	{
		valid=false;
		valid = checknumber(document.register.tel.value)
	}
	if(document.register.email.value!="")
	{
		valid=false;
		valid = checknumber(document.register.tel.value)
	}
	
	
	if(found==true)
	 alert("Please fill in "+require);
	else if(found==false && valid==true)
	{
		//alert("SENDING");
		if(CheckEmail(document.register.email.value))
		{
			if(document.register.password.value != document.register.confirmPass.value)
			{
				alert("Password does not match the Confirmation password");
			}
			else
				document.register.submit();
		}
	
	}
	
}

function isValid()
{

	found=false;
	valid=true;
	require = "";
	if(document.submitForm.name.value=="" || document.submitForm.name.value.length<3)
	{
		found=true;
		require += "*Name (size 3) ";
	}
	if(document.submitForm.surname.value=="" || document.submitForm.surname.value.length<3)
	{
		found=true;
		require += "*Surname (size 3)";
	}
	if(document.submitForm.email.value=="")
	{
		found=true;
		require += "*Email ";
	}
	
	if(document.submitForm.password.value=="")
	{
		found=true;
		require += "*Password ";
	}
	

	
	if(document.submitForm.tel.value!="")
	{
		valid=false;
		valid = checknumber(document.submitForm.tel.value)
	}
	

	
	if(found==true)
	 alert("Please fill in "+require);
	else if(found==false && valid==true)
	{
		if(CheckEmail(document.submitForm.email.value))
		{
			
				document.submitForm.submit();
		}
	}
	
}


function isValid2()
{

	found=false;
	valid=true;
	require = "";
	if(document.submitForm.name.value=="" || document.submitForm.name.value.length<3)
	{
		found=true;
		require += "*Name (size 3) ";
	}
	if(document.submitForm.surname.value=="" || document.submitForm.surname.value.length<3)
	{
		found=true;
		require += "*Surname (size 3)";
	}
	if(document.submitForm.email.value=="")
	{
		found=true;
		require += "*Email ";
	}
	


	
	if(found==true)
	 alert("Please fill in "+require);
	else if(found==false && valid==true)
	{
		if(CheckEmail(document.submitForm.email.value))
		{
			
				document.submitForm.submit();
		}
	}
	
}

//CHECK EMAIL
function CheckEmail(val) {

email = val
AtPos = email.indexOf("@")
StopPos = email.lastIndexOf(".")

if (AtPos == -1 || StopPos == -1) {
alert("Not a valid email address");
return false;
}
else return true;

}



//CHECK NUMBER
function checknumber(ob){
//alert("Start:!"+ob)
if(ob!="")
{
	//document.myform.name.value="Bunny";
	var x=ob
	var anum=/(^\d+$)|(^\d+\.\d+$)/
	if (anum.test(x))
	testresult=true
	else{
	alert("Invalid Character found in mobile!")
	testresult=false
	}
	return (testresult)
}
}

var infoCnt=0;
function showInfo(cnt)
{
	if(cnt!=infoCnt)
	{
		$("#info"+infoCnt).toggle(500);
		infoCnt=cnt;
	}
	$("#info"+cnt).toggle(500);
}

function showReport(html)
{
	//alert(html)
	$("#report").html(html);
}

