﻿function validAll(){
	document.frm.reset();
}


function checkAll(){

	var eMsg="";
	var isOK=true;

	if(document.frm.cmbMagazine.value=="parenthood"){
		document.frm.action="http://www.parenthood.com.my/signin.php";
	}
	if(document.frm.cmbMagazine.value=="mombaby"){
		document.frm.action="http://www.todaypublishing.com.my/mombaby/signin.php";
	}
	if(document.frm.cmbMagazine.value=="mamibaby"){
		document.frm.action="http://www.mamibaby.com.my/signin.php";
	}
	
	

	if(document.frm.email.value==""){
		eMsg += "电子邮件必填项目<br>";
	}
	if(document.frm.password.value==""){
		eMsg += "密码必填项目<br>";
	}
	
	if(document.frm.cmbMagazine.value==""){
		eMsg += "杂志必选项目<br>";	
	}

	if(eMsg !=""){
		eMsg = "<b>以下项目必填</b>:<br>" + eMsg;
		//goto top
		isOK = false;


if(document.getElementById('abox')!=null){
document.getElementById('ibox').removeChild(document.getElementById('abox'));	
}

var newdiv = document.createElement('div');
  var divIdName = 'abox';
  newdiv.setAttribute('id','abox');
  newdiv.setAttribute('name','abox');	
  newdiv.setAttribute('class','alert');	
  newdiv.setAttribute('className','alert');	
  newdiv.innerHTML = eMsg;
document.getElementById('ibox').appendChild(newdiv);
document.location.href="#top";
	} else {
	isOK=true;
document.getElementById('ibox').removeChild(document.getElementById('abox'));

	}
	return isOK;

}


