﻿//var context = "/sclub";
var context = "";

/*
function doLogin()  {
	var theForm = "memberLoginForm";
	document.forms[theForm].action = context + "/UserLogin";
	document.forms[theForm].submit();
}
function doLogout()  {
	var theForm = "memberLogoutForm";
	document.forms[theForm].action = context + "/UserLogout";
	document.forms[theForm].submit();
}
*/
function doLogin()  {
	var theForm = "memberForm";
	document.forms[theForm].action = context + "/UserLogin";
	document.forms[theForm].submit();
}
function doLogout()  {
	var theForm = "memberForm";
	document.forms[theForm].action = context + "/UserLogout";
	document.forms[theForm].submit();
}
function doReferToFriend()  {
	var theForm = "referToFriendForm";
//	document.forms[theForm].action = "/sclub/R2FdCtrl";
	document.forms[theForm].action = "refer_to_friend.jsp";
	document.forms[theForm].submit();
}
/*
function doRegister()  {
	var theForm = "memberLoginForm";
	document.forms[theForm].action = context + "/MemberCtrl";
	document.forms[theForm].task.value = "register";
	document.forms[theForm].submit();
}
*/
function doRegister()  {
	var theForm = "memberForm";
	document.forms[theForm].action = context + "/MemberCtrl";
	document.forms[theForm].task.value = "register";
	document.forms[theForm].submit();
}
function doRegisterNow()  {
	var theForm = "registerForm";
	document.forms[theForm].action = context + "/MemberCtrl";
	document.forms[theForm].task.value = "register";
	document.forms[theForm].submit();
}
function doSendToFriend()  {
	var theForm = "sendToFriendForm";
	document.forms[theForm].action = context + "/EmailCtrl";
	document.forms[theForm].submit();
}
function doForgetPassword()  {
	var theForm = "forgetPasswordForm";
	document.forms[theForm].action = context + "/ForgetPasswordCtrl";
	document.forms[theForm].submit();
}
/*
function doEditProfile(id)  {
	var theForm = "memberLogoutForm";
	document.forms[theForm].action = context + "/MemberCtrl";
	document.forms[theForm].task.value = "modify";
	document.forms[theForm].memberId.value = id;
	document.forms[theForm].submit();
}
*/
function doEditProfile(id)  {
	var theForm = "memberForm";
	document.forms[theForm].action = context + "/MemberCtrl";
	document.forms[theForm].task.value = "modify";
	document.forms[theForm].memberId.value = id;
	document.forms[theForm].submit();
}
function doCheckPermission(id)  {
	var theForm = "printCouponForm";
	result = document.forms[theForm].permission.value;
	if (result == "pass")  {
		doPrintCoupon(id);
	}
	else  {
		document.forms[theForm].method = "post";
		document.forms[theForm].action = context + "/chinese/coupon_login_error.jsp";
		document.forms[theForm].submit();
	}
}
function doCheckPermissionEn(id)  {
	var theForm = "printCouponForm";
	result = document.forms[theForm].permission.value;
	if (result == "pass")  {
		doPrintCoupon(id);
	}
	else  {
		document.forms[theForm].method = "post";
		document.forms[theForm].action = context + "/english/coupon_login_error.jsp";
		document.forms[theForm].submit();
	}
}
function doPrintCoupon(id)  {
	var theForm = "printCouponForm";	
	var lang = document.forms[theForm].lang.value;

	couponWindow = window.open(context + "/PrintECouponCtrl?task=printECoupon&eCouponId=" + id + "&lang=" + lang, "couponWindow", "width=620,height=400,directories=no,toolbar=no,resizable=yes,menubar=no,scrollbars=yes,status=yes,screenX=80,screenY=80, top=50, left=80");
	if (couponWindow.open)  {
		couponWindow.focus();
	}
}
function doENews()  {
	var theForm = "eNewsSubscriptionForm";
	document.forms[theForm].action = context + "/ENewsCtrl";
	document.forms[theForm].task.value = "subscribe";
	document.forms[theForm].submit();	
}
function doSwitchLang()  {
	var theForm = "memberForm";
	var doc = document.forms[theForm];
	doc.action = context + "/Redirect";
	doc.submit();
}
