
var mlUnsub = {
	xml: null,
	mlForm: null,
	respHold: null,
	prepareSubmit: function (fld){
		mlUnsub.mlForm = document.forms.emailform;
		mlUnsub.respHold = $('respHolder');
		if (mlUnsub.mlForm.email.value == ""){
			if(mlUnsub.respHold){
				mlUnsub.respHold.innerHTML = unsubErr;
			}
		} else if((-1 == mlUnsub.mlForm.email.value.indexOf("@")) || (0 == mlUnsub.mlForm.email.value.indexOf("@"))|| ((mlUnsub.mlForm.email.value.length -1) == mlUnsub.mlForm.email.value.lastIndexOf(".")) ||(-1 == mlUnsub.mlForm.email.value.indexOf("."))) {
			if(mlUnsub.respHold){
				mlUnsub.respHold.innerHTML = unsubErr;
			}
		} else {		
			var cb = {
				success:function(r){
					var respMsg = (r.responseXML).getElementsByTagName('response')[0].childNodes[0].nodeValue;
		
					if(mlUnsub.respHold){
						mlUnsub.respHold.innerHTML = respMsg;
						mlUnsub.mlForm.email.value = '';
					}
				},
				failure:function(r){}
			}
			YUC.setForm(mlUnsub.mlForm);
			YUC.asyncRequest('POST', mlUnsub.mlForm.action, cb);
		}
	},
	init: function(){
		var unsubSumit = $('unsubSubmit');
		if(!unsubSumit) return;
		YUE.on(unsubSumit, 'click', mlUnsub.prepareSubmit, false);
	}
}

YUE.on(window, 'load', mlUnsub.init, false);