/*
function checkvalid2(obj_form) {
	if(obj_form.edtName.value == "") {
		alert("Please input Name.");
		obj_form.edtName.focus();
		return false;
	}
	if(obj_form.edtPosition.value == "") {
		alert("Please input Position.");
		obj_form.edtPosition.focus();
		return false;
	}
	if(obj_form.edtCompany.value == "") {
		alert("Please input Company.");
		obj_form.edtCompany.focus();
		return false;
	}
	if(obj_form.edtAddress.value == "") {
		alert("Please input Address.");
		obj_form.edtAddress.focus();
		return false;
	}

	if(obj_form.edtState.value == "0") {
		alert("Please select Country.");
		obj_form.edtState.focus();
		return false;
	}
	if(obj_form.edtPostCode.value == "0") {
		alert("Please select Post Code.");
		obj_form.edtPostCode.focus();
		return false;
	}

	if(obj_form.edtTel1.value == "") {
		alert("Please input Telephone.");
		obj_form.edtTel1.focus();
		return false;
	}
	if(obj_form.edtTel2.value == "") {
		alert("Please input Telephone.");
		obj_form.edtTel2.focus();
		return false;
	}
	if(obj_form.edtTel3.value == "") {
		alert("Please input Telephone.");
		obj_form.edtTel3.focus();
		return false;
	}
	if(obj_form.edtFax1.value == "") {
		alert("Please input Fax.");
		obj_form.edtFax1.focus();
		return false;
	}
	if(obj_form.edtFax2.value == "") {
		alert("Please input Fax.");
		obj_form.edtFax2.focus();
		return false;
	}
	if(obj_form.edtFax3.value == "") {
		alert("Please input Fax.");
		obj_form.edtFax3.focus();
		return false;
	}

	var reg =/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/;
	if(obj_form.edtEmail.value == "") {
		alert("Please input Email");
		obj_form.edtEmail.focus();
		return false;
	}
	else if (reg.test(obj_form.edtEmail.value)==false)
	{
		alert("Email format wrong.");
		obj_form.edtEmail.focus();
		return false;
	}										
	//Q1
	var checked = 0;
	var obj = document.getElementsByName('Q1');   
	for(i=0;i<obj.length;i++)
	{   
		if(obj[i].checked)
		{   
			checked=1;  
		}   
	}   
	if(checked!=1)
	{
		alert("Please choice Q1's items.");
		return false;
	}

	//Q2
	checked = 0;
	var obj = document.getElementsByName('Q2');   
	for(i=0;i<obj.length;i++)
	{   
		if(obj[i].checked)
		{   
			checked=1;  
		}   
	}   
	if(checked!=1)
	{
		alert("Please choice Q2's items.");
		return false;
	}
	
	//Q3
	var strchoice="";
	var checkboxname = "Q3";//选项名称
	var nowCtrl = eval("obj_form." + checkboxname); 
	for(var i=0;i<nowCtrl.length;i++) 
	{ 
		if (nowCtrl[i].checked) 
		{ 
			strchoice=strchoice+nowCtrl[i].value+","; 
		} 
	}
	//截取最后的逗号 
	strchoice=strchoice.substring(0,strchoice.length-1); 	
	if(strchoice=="")
	{
		alert("Please choice Q3's items.");
		nowCtrl[0].focus();
		return false;
	}
	else
	{
		//赋值给隐藏域
		obj_form.edtQ3.value=strchoice;
		//alert(obj_form.edtQ3.value);
	}	

	//Q4
	checked = 0;
	var obj = document.getElementsByName('Q4');   
	for(i=0;i<obj.length;i++)
	{   
		if(obj[i].checked)
		{   
			checked=1;  
		}   
	}   
	if(checked!=1)
	{
		alert("Please choice Q4's items.");
		return false;
	}
	
	//[问题5]
	var strchoice="";
	var checkboxname = "Q5";//选项名称
	var nowCtrl = eval("obj_form." + checkboxname); 
	for(var i=0;i<nowCtrl.length;i++) 
	{ 
		if (nowCtrl[i].checked) 
		{ 
			strchoice=strchoice+nowCtrl[i].value+","; 
		} 
	}
	//截取最后的逗号 
	strchoice=strchoice.substring(0,strchoice.length-1); 	
	if(strchoice=="")
	{
		alert("Please choice Q5's items.");
		nowCtrl[0].focus();
		return false;
	}
	else
	{
		//赋值给隐藏域
		obj_form.edtQ5.value=strchoice;
		//alert(obj_form.edtQ3.value);
	}	
	
	//[问题6]
	var strchoice="";
	var checkboxname = "Q6";//选项名称
	var nowCtrl = eval("obj_form." + checkboxname); 
	for(var i=0;i<nowCtrl.length;i++) 
	{ 
		if (nowCtrl[i].checked) 
		{ 
			strchoice=strchoice+nowCtrl[i].value+","; 
		} 
	}
	//截取最后的逗号 
	strchoice=strchoice.substring(0,strchoice.length-1); 	
	if(strchoice=="")
	{
		alert("Please choice Q6's items.");
		nowCtrl[0].focus();
		return false;
	}
	else
	{
		//赋值给隐藏域
		obj_form.edtQ6.value=strchoice;
		//alert(obj_form.edtQ3.value);
	}

	//Q7
	checked = 0;
	var obj = document.getElementsByName('Q7');   
	for(i=0;i<obj.length;i++)
	{   
		if(obj[i].checked)
		{   
			checked=1;  
		}   
	}   
	if(checked!=1)
	{
		alert("Please choice Q7's items.");
		return false;
	}
	//Q8
	checked = 0;
	var obj = document.getElementsByName('Q8');   
	for(i=0;i<obj.length;i++)
	{   
		if(obj[i].checked)
		{   
			checked=1;  
		}   
	}   
	if(checked!=1)
	{
		alert("Please choice Q8's items.");
		return false;
	}
	//Q9
	checked = 0;
	var obj = document.getElementsByName('Q9');   
	for(i=0;i<obj.length;i++)
	{   
		if(obj[i].checked)
		{   
			checked=1;  
		}   
	}   
	if(checked!=1)
	{
		alert("Please choice Q9's items.");
		return false;
	}
	
	//Q10
	if(obj_form.Q10_Text.value == "") {
		alert("Please input Q10's item.");
		obj_form.Q10_Text.focus();
		return false;
	}	
	
	//[问题11]
	var strchoice="";
	var checkboxname = "Q11";//选项名称
	var nowCtrl = eval("obj_form." + checkboxname); 
	for(var i=0;i<nowCtrl.length;i++) 
	{ 
		if (nowCtrl[i].checked) 
		{ 
			strchoice=strchoice+nowCtrl[i].value+","; 
		} 
	}
	//截取最后的逗号 
	strchoice=strchoice.substring(0,strchoice.length-1); 	
	if(strchoice=="")
	{
		alert("Please choice Q11's items.");
		nowCtrl[0].focus();
		return false;
	}
	else
	{
		//赋值给隐藏域
		obj_form.edtQ11.value=strchoice;
		//alert(obj_form.edtQ3.value);
	}	
	
	//[问题12]
	var strchoice="";
	var checkboxname = "Q12";//选项名称
	var nowCtrl = eval("obj_form." + checkboxname); 
	for(var i=0;i<nowCtrl.length;i++) 
	{ 
		if (nowCtrl[i].checked) 
		{ 
			strchoice=strchoice+nowCtrl[i].value+","; 
		} 
	}
	//截取最后的逗号 
	strchoice=strchoice.substring(0,strchoice.length-1); 	
	if(strchoice=="")
	{
		alert("Please Q12's items.");
		nowCtrl[0].focus();
		return false;
	}
	else
	{
		//赋值给隐藏域
		obj_form.edtQ12.value=strchoice;
		//alert(obj_form.edtQ3.value);
	}
	return true;
}
function freset(obj){
  obj.reset();
}*/



/*
y_danxuan_check 一组单选按钮，包括一个文本域
wenti: 单选按钮组的id
qitazhi: 单选按钮“其他”的值
wenben: 文本字段id
daan: 选择“其他”未填写文本域的提示
huida: 未选该组单选按钮的提示
*/
function y_danxuan_check(wenti,qitazhi,wenben,daan,huida)
{
	var checked = 0;
	var obj = document.getElementsByName(wenti);   
	for(i=0;i<obj.length;i++)
	{   
		if(obj[i].checked)
		{   
			checked=i+1;  
		}   
	}
	
	if(checked == 0)
	{
		alert(huida);
		obj[0].focus();
		return false;
	}
	
	if(checked == qitazhi && document.getElementById(wenben).value == '')
	{
		alert(daan);
		document.getElementById(wenben).focus();
		return false;
	}
}

function y_duoxuan_check(wenti,qitazhi,wenben,daan,huida)
{
	var checked = 0;
	var obj = document.getElementsByName(wenti);   
	for(i=0;i<obj.length;i++)
	{   
		if(obj[i].checked)
		{   
			checked=1;  
		}
	}
	
	if(checked == 0)
	{
		alert(huida);
		obj[0].focus();
		return false;
	}
	
	if(qitazhi != '')
	{
		if( obj[qitazhi-1].checked == true && document.getElementById(wenben).value == '')
		{
			alert(daan);
			document.getElementById(wenben).focus();
			return false;
		}
	}
}

function checkvalid2(obj_form) {
	
	if(obj_form.edtName.value == "") {
		alert("Please input Name.");
		obj_form.edtName.focus();
		return false;
	}
	if(obj_form.edtPosition.value == "") {
		alert("Please choose Position.");
		obj_form.edtPosition.focus();
		return false;
	}
	if(obj_form.edtPosition.value == "") {
		alert("Please choose Position.");
		obj_form.edtPosition.focus();
		return false;
	}
	if(obj_form.edtPosition.value == "其他" && obj_form.edtPositionOther.value == '') {
		alert("Please input Position.");
		obj_form.edtPositionOther.focus();
		return false;
	}
	if(obj_form.edtDepartment.value == "") {
		alert("Please choose Department.");
		obj_form.edtDepartment.focus();
		return false;
	}
	if(obj_form.edtDepartment.value == "其他" && obj_form.edtDepartmentOther.value == '') {
		alert("Please input department.");
		obj_form.edtDepartmentOther.focus();
		return false;
	}
	if(obj_form.edtCompany.value == "") {
		alert("Please input Company Name.");
		obj_form.edtCompany.focus();
		return false;
	}
	if(obj_form.edtAddress.value == "" && obj_form.edtAddress.value == "" && obj_form.edtAddress.value == "") {
		alert("Please input Address.");
		obj_form.edtAddress.focus();
		return false;
	}

	if(obj_form.edtState.value == "0") {
		alert("Please select country.");
		obj_form.edtState.focus();
		return false;
	}
	/*if(obj_form.edtPostCode.value == "0") {
		alert("请输入邮邮编。");
		obj_form.edtPostCode.focus();
		return false;
	}*/

	if(obj_form.edtTel1.value == "") {
		alert("Please input Tel.");
		obj_form.edtTel1.focus();
		return false;
	}
	if(obj_form.edtTel2.value == "") {
		alert("Please input Tel.");
		obj_form.edtTel2.focus();
		return false;
	}
	if(obj_form.edtTel3.value == "") {
		alert("Please input Tel.");
		obj_form.edtTel3.focus();
		return false;
	}
	/*if(obj_form.edtFax1.value == "") {
		alert("请输入传真。");
		obj_form.edtFax1.focus();
		return false;
	}
	if(obj_form.edtFax2.value == "") {
		alert("请输入传真。");
		obj_form.edtFax2.focus();
		return false;
	}
	if(obj_form.edtFax3.value == "") {
		alert("请输入传真。");
		obj_form.edtFax3.focus();
		return false;
	}
*/
	var reg =/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/;
	if(obj_form.edtEmail.value == "") {
		alert("Please input Email.");
		obj_form.edtEmail.focus();
		return false;
	}
	else if (reg.test(obj_form.edtEmail.value)==false)
	{
		alert("Email format wrong.");
		obj_form.edtEmail.focus();
		return false;
	}
	
	if( y_danxuan_check('Q1','6','Q1_text','Please input Q1\'s question','Please choice Q1\'s items') == false ) { return false; }
	if( y_danxuan_check('Q2','9','Q2_text','Please input Q2\'s question','Please choice Q2\'s items') == false ) { return false; }
	if( y_danxuan_check('Q3','22','Q3_text','Please input Q3\'s question','Please choice Q3\'s items') == false ) { return false; }
	
	if( y_duoxuan_check('Q4[]','','','','Please choice Q4\'s items') == false ) { return false; }
	if( y_duoxuan_check('Q5[]','23','Q5_text','Please input Q5\'s question','Please choice Q5\'s items') == false ) { return false; }
	
	if( y_danxuan_check('Q6','7','Q6_text','Please input Q6\'s question','Please choice Q6\'s items') == false ) { return false; }
	if( y_danxuan_check('Q7','12','Q7_text','Please input Q7\'s question','Please choice Q7\'s items') == false ) { return false; }
	if( y_danxuan_check('Q8','9','Q8_text','Please input Q8\'s question','Please choice Q8\'s items') == false ) { return false; }
	if( y_danxuan_check('Q9','4','Q9_text','Please input Q9\'s question','Please choice Q9\'s items') == false ) { return false; }
	
	/*if(obj_form.Q10_text.value == '') { alert("Please input Q10\'s question"); obj_form.Q10_text.focus(); return false; }
	
	if( y_duoxuan_check('Q11[]','','','','Please choice Q11\'s items') == false ) { return false; }
	if( y_duoxuan_check('Q12[]','','','','Please choice Q12\'s items') == false ) { return false; }
	
	if(obj_form.Q13_text.value == '' && obj_form.Q14_text.value == '' && obj_form.Q15_text.value == '') 
	{ alert("Please input Q13\'s question"); obj_form.Q13_text.focus(); return false; }*/
	
	return true;

}

function freset(obj){
  obj.reset();
}
