
//fucntion selctform()
function selectform()
{
document.form.FBBrand.disabled = true;
document.form.cashmemono.disabled = true;


var a= document.form.txtFormType.value;
 var b=document.form.complaints.options [document.form.complaints.selectedIndex].value;

if (b=='Aftersales' ||  b=='Sales'   || b=='Service' ) 
{
 document.form.FBBrand.options[0].text = "Select the Brand";
document.form.FBBrand.disabled = false;
document.form.FBBrand.focus();
}
else
{
document.form.FBBrand.options[0].text = "Not Applicable";
}
if (b=='Aftersales' || b=='Service' ) 
{
document.form.cashmemono.disabled = false;
 
}

document.form.txtSubFormType.value=b

}

//fucntion selctform()
function selecttrade()
{
 var b=document.form.trade.options [document.form.trade.selectedIndex].value;
 document.form.txtSubFormType.value=b;
 }

// -->
//Form Validation 
 function Check()
 {
  var field = document.form.EMail; // email field
  var str = field.value; // email string
  var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
  var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
msg = "";
 var x;
 var y;
  x=document.form.txtFormType.value;
 if (x=='T')
{
y=document.form.trade;
if (y.selectedIndex==0)
{
  msg += "\n     - Query Type";
}
}
  x=document.form.txtFormType.value;
 if (x=='GE')
{
y=document.form.orequest;
if (y.selectedIndex==0)
{
  msg += "\n     -  Request Type";
}
}
 x=document.form.txtFormType.value;
 if (x=='S' || x=='C')
{
y=document.form.complaints;
if (y.selectedIndex==0)
{
  msg += "\n     - Type";
}
}
 x=document.form.Name.value;
 if(x.length==0)
 { y=document.form.Name;
  msg += "\n     -  Name";
 }
 x=document.form.Tel.value;
 if(x.length==0)
 { y=document.form.Tel;
msg += "\n     -  Contact Telephone";
 }
 x=document.form.EMail.value;
 if (!reg1.test(x) && reg2.test(x)) { // if syntax is valid
 } else {
  y=document.form.EMail;
	msg += "\n     -  EMail Address";
 }
 x=document.form.FBack.value;
 if(x.length==0)
 { y=document.form.FBack;
msg += "\n     -  Feedback Details";
 }

if (msg != "") 
	{
	msg ="Dear Customer,\n" +
	"You failed to correctly fill in your:\n" +
	msg + "\n_____________________________"+
	"\nPlease re-enter and submit again!";
	alert(msg);
	s=y.value;
	y.focus();
	return false;
	}
else 
{
return true;	}
}
//End of form validation
