<!--
//iframe title at left hand side 
function preview(i) {
	document.getElementById('topictitle').src = 'images/main'+i+'_16.jpg';
}


//popup a 550x540 windows
function popwin(url, theWidth, theHeight, winName) {
	var theTop=(screen.height/2)-(theHeight/2);
	var theLeft=(screen.width/2)-(theWidth/2);
	popWin = window.open(url,winName,"width="+theWidth+",height="+theHeight+",top="+theTop+",left="+theLeft+",toolbar=no,directories=no,location=no,scrollbars=no,status=no,resizable=no,resize=yes,menubar=no");
	popWin.focus();
//popwinAskEmail 450x300
}


//popup a 550x340 windows
function popwin2(url) {
	Window2 = window.open(url,"termsWindow","toolbar=no,width=550,height=340,directories=no,location=no,scrollbars=yes,status=no,resizable=no,menubar=no");
	Window2.focus();
}


//check email (member_forgotpwd.asp)
function funcSubmit(frm){
	if (checkemail(frm.email.value)){
		frm.submit();
		return true;
	} else {
		return false;
	}
}


//Submit "Buy" email check and double confirm email
function buySubmit(frm) {
	if (checkemail(frm.email.value) && DoubleConfirm(frm.email, frm.confirmemail, "電郵確認不正確!\nConfirm Email Incorrect!") && CheckCB()){
		return true;
	} else {
		return false;
	}
}


//Member Login
function loginCheck() {
	var A=document.loginForm.login_usr.value;
	var B=document.loginForm.login_pwd.value;
	if (A.length==0 && B.length==0) {
		alert ("請輸入所有資料!\nPlease complete all information!");
		return false;
	} else if(A.length==0){
		alert ("請輸入會員名稱\nPlease enter the login id!");
		return false;
	} else if(B.length==0){
		alert ("請輸入會員密碼\nPlease enter the password!");
		return false;
	} else {
		return true;
	}
}


//New Member Form Check
function newCheck() {
	var A=document.newForm.new_usr.value;
	var B=document.newForm.new_email.value;
	var C=document.newForm.new_email2.value;
	if (A.length==0 && B.length==0 && C.length==0) {
		alert ("請填寫所有資料!\nPlease complete all information!");
		return false;
	} else if(A.length==0) {
		alert ("請填寫會員名稱!\nPlease enter the login id!");
		return false;
	} else if(B.length==0 || C.length==0) {
		alert ("請填寫電郵地址!\nPlease enter the email!");
		return false;
	} else if(B != C) {
		alert ("電郵地址不一致!\nBoth email must match!");
		return false;
	} else if(!checkemail(C)){ //call validation.js
		return false;
	} else {
		return true;
	}
}


//change Member Password Check
function passCheck() {
	var A=document.passForm.old_pass.value;
	var B=document.passForm.new_pass.value;
	var C=document.passForm.new_pass2.value;
	if (A.length==0 && B.length==0 && C.length==0) {
		alert ("請填寫所有資料!\nPlease complete all information!");
		return false;
	} else if(A.length==0) {
		alert ("請填寫會員名稱!\nPlease enter the old password!");
		return false;
	} else if(B.length==0 || C.length==0) {
		alert ("請填寫新密碼!\nPlease enter new password!");
		return false;
	} else if(B != C) {
		alert ("密碼不一致!\nBoth new password must be match!");
		return false;
	} else {
		return true;
	}
}


//Check the agreement check box
function CheckCB(thisform) {
	if (!document.getElementById("agreement").checked) {
		alert("請選擇同意!\nPlease tick the Agree checkbox!");
		return false;
	} else {
		return true;
	}
}

function CheckPlan(thisform) {
	with (thisform) {
		if (document.getElementById("planA").checked) {
			alert("請選擇影片!\nPlease select the movie!");
			return false;
		} else if (!CheckCB(thisform)) {
			return false;
		} else {
			return true;
		}
	}
}


//checck email format
function checkemail(InEmail){
  var testresults;
  var str=InEmail;
  var filter=/^.+@.+\..{2,3}$/;
  if (filter.test(str))
    testresults=true;
  else{
    alert("請輸入正確電郵!\nPlease input a valid email!");
    testresults=false;
  }
  return (testresults);
}
//-->