var MailListener = new MailJS();

function MailJS() {
}

//---------------------------REGISTER
//when register button pressed
MailJS.prototype.send = function(args) {
	//store these
	this.target =	isset(args['target']) ? args['target'] : null;
	this.func =		isset(args['func']) ? args['func'] : null;
	delete(args['target']);
	delete(args['func']);
	
	ajaxRequest({	script:			'mail',
					target:			'Mail',
					func:			'send',
					args:			args, 
					return_target:	this, 
					return_func:	'sendReturn'});
}

//
MailJS.prototype.sendCompany = function(args) {
	//store these
	this.target =	isset(args['target']) ? args['target'] : null;
	this.func =		isset(args['func']) ? args['func'] : null;
	delete(args['target']);
	delete(args['func']);
	
	ajaxRequest({	script:			'mail',
					target:			'Mail',
					func:			'sendCompany',
					args:			args, 
					return_target:	this, 
					return_func:	'sendReturn'});
}


MailJS.prototype.sendDataCompany = function(args) {
	//store these
	this.target =	isset(args['target']) ? args['target'] : null;
	this.func =		isset(args['func']) ? args['func'] : null;
	delete(args['target']);
	delete(args['func']);
	
	ajaxRequest({	script:			'mail',
					target:			'Mail',
					func:			'sendDataCompany',
					args:			args, 
					return_target:	this, 
					return_func:	'sendReturn'});
}





//finishes above register process
MailJS.prototype.sendReturn = function(config) {
	callFunc(this.target, this.func, config);
}