var Ajax;
if (Ajax && (Ajax != null)) {
	Ajax.Responders.register({
	  onCreate: function() {
        if($('spinner') && Ajax.activeRequestCount>0)
          Effect.Appear('spinner',{duration:0.5,queue:'end'});
	  },
	  onComplete: function() {
        if($('spinner') && Ajax.activeRequestCount==0)
          Effect.Fade('spinner',{duration:0.5,queue:'end'});
	  }
	});
}

// -------------------- custom mark XD
function getvalidateBday(){
	var currentTime = new Date()
	var month = currentTime.getMonth() + 1
	var day = currentTime.getDate()
	var year = currentTime.getFullYear()
	
	var birthdayDate  = new Date(document.regForm.birthDate_month.value+"/"+document.regForm.birthDate_day.value+"/"+document.regForm.birthDate_year.value);
	var currentDate  = new Date(month + "/" + day + "/" + year);

	if (birthdayDate>=currentDate) {
		return true;
	}
	return false;
}
function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}
function getvalidateRadio(){
	if (getCheckedValue(document.regForm.contactVia) == "mobile"){
		if (document.regForm.mobileNumber.value == ""){
			return true;
		}
	}
	return false;
}
function getvalidateRadioPhone(){
	if (getCheckedValue(document.regForm.contactVia) == "phone"){
		if (document.regForm.phoneNumber.value == ""){
			return true;
		}
	}
	return false;
}
// -----

function getvalidateBdayRewards(){
	var currentTime = new Date()
	var month = currentTime.getMonth() + 1
	var day = currentTime.getDate()
	var year = currentTime.getFullYear()
	
	var birthdayDate  = new Date(document.regeditForm.birthDate_month.value+"/"+document.regeditForm.birthDate_day.value+"/"+document.regeditForm.birthDate_year.value);
	var currentDate  = new Date(month + "/" + day + "/" + year);

	if (birthdayDate>=currentDate) {
		return true;
	}
	return false;
}
function getCheckedValueRewards(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}
function getvalidateRadioRewards(){
	if (getCheckedValueRewards(document.regeditForm.contactVia) == "mobile"){
		if (document.regeditForm.mobileNumber.value == ""){
			return true;
		}
	}
	return false;
}
function getvalidateRadioPhoneRewards(){
	if (getCheckedValueRewards(document.regeditForm.contactVia) == "phone"){
		if (document.regeditForm.phoneNumber.value == ""){
			return true;
		}
	}
	return false;
}

// ------------------- custom

