function validatefunc()
{
	myform = document.form1
	
	if (myform.name.value == "" )
	{
		alert("Please key in your name!")
		myform.name.focus();
		return false;
	}
	else if (myform.phone.value =="" )
	{
		alert("Please key in your phone!")
		myform.phone.focus();
		return false;
	} 
	else if (myform.subject.value =="" )
	{
		alert("Please key in your subject!")
		myform.subject.focus();
		return false;
	} 
	else if (myform.feedback.value =="" )
	{
		alert("Please key in your feedback!")
		myform.feedback.focus();
		return false;
	} 
	else if (myform.email.value =="" )
	{
		alert("Please key in your email address!")
		myform.email.focus();
		return false;
	}
	else if(myform.email.value!="")
	{
		email = myform.email.value;
		AtPos = email.indexOf("@")
		StopPos = email.lastIndexOf(".")
		
		if (AtPos == -1 || StopPos == -1) {
			
			alert("Please key in valid email address!")
			myform.email.focus();
			return false;
		}

		if (StopPos < AtPos) {
			alert("Please key in valid email address!")
			myform.email.focus();
			return false;
		}

		if (StopPos - AtPos == 1) {
			alert("Please key in valid email address!")
			myform.email.focus();
			return false;
		}
	}
	else
	{
		return true;
	}
	return true;
}

function OpenFlavour() {
	
	window.open("new-flavour.html",null,"height=858,width=602,status=no,toolbar=no,menubar=no,location=no"); 
}

function OpenProposalDiv(num) {
	
	for(var i=1; i<=4; i++) {
		document.getElementById("question"+i).style.display="none";
		document.getElementById("plus"+i).innerHTML="<img src='images/plus_btn.gif'>";
	}
	document.getElementById("question"+num).style.display="block";
	document.getElementById("plus"+num).innerHTML="<img src='images/minus_btn.gif'>";
	
	
}


function OpenContent(yes,no)
{
	document.getElementById(yes).style.display="block";
	document.getElementById(no).style.display="none";
}


function validatefuncFeatures()
{
	myform = document.form1
	
	if (myform.name.value == "")
	{
		alert("Please key in your name!")
		myform.name.focus();
		return false;
	}
	
	else if (myform.email.value =="" )
	{
		alert("Please key in your email address!")
		myform.email.focus();
		return false;
	}
	else if(myform.email.value!="")
	{
		email = myform.email.value;
		AtPos = email.indexOf("@")
		StopPos = email.lastIndexOf(".")
		
		if (AtPos == -1 || StopPos == -1) {
			
			alert("Please key in valid email address!")
			myform.email.focus();
			return false;
		}

		if (StopPos < AtPos) {
			alert("Please key in valid email address!")
			myform.email.focus();
			return false;
		}

		if (StopPos - AtPos == 1) {
			alert("Please key in valid email address!")
			myform.email.focus();
			return false;
		}
	}
	else
	{
		return true;
	}
	return true;
}


function validateproposal()
{
	myform = document.form1
	var myindex=myform.general_q3.selectedIndex;
	
	if (myform.name.value == "" )
	{
		alert("Please key in your name!")
		myform.name.focus();
		return false;
	}
	else if (myform.address1.value =="" )
	{
		alert("Please key in your address!")
		myform.address1.focus();
		return false;
	}
	else if (myform.company.value =="" )
	{
		alert("Please key in your company!")
		myform.company.focus();
		return false;
	}
	else if (myform.phone.value =="" )
	{
		alert("Please key in your phone!")
		myform.phone.focus();
		return false;
	}
	else if (myform.general_q1[0].checked ==false && myform.general_q1[1].checked ==false)
	{
		alert("Please select Enterprise Telephony (PABX) or Contact Centre ?")
		return false;
	}
	else if (myform.general_q2[0].checked ==false && myform.general_q2[1].checked ==false)
	{
		alert("Please select Is this a change from an existing system to a new one ?")
		return false;
	}
	else if (myindex==0)
	{
		alert("Please select Target month for the customer's purchase order ?")
		return false;
	}
	else if (myform.email.value =="" )
	{
		alert("Please key in your email address!")
		myform.email.focus();
		return false;
	}
	else if(myform.email.value!="")
	{
		email = myform.email.value;
		AtPos = email.indexOf("@")
		StopPos = email.lastIndexOf(".")
		
		if (AtPos == -1 || StopPos == -1) {
			
			alert("Please key in valid email address!")
			myform.email.focus();
			return false;
		}

		if (StopPos < AtPos) {
			alert("Please key in valid email address!")
			myform.email.focus();
			return false;
		}

		if (StopPos - AtPos == 1) {
			alert("Please key in valid email address!")
			myform.email.focus();
			return false;
		}
	}
	else
	{
		return true;
	}
	return true;
}


