var moomultiajax = {
	
	initialize: function(element, options) {
		this.options = Object.extend({
			ajaxUrls:				'', //an array of ajax requests ['/AJAX/YouTube.aspx?vid=','/AJAX/VideoRating.aspx?vid=','/AJAX/VideoIngredients.aspx?vid=']
			ajaxTargets:			'', //an array list of ajax targets for each ajaxUrls [req-state-1, req-state-2]
			ajaxLinks:				''  //an array list of links to add click event [vidLink01,vidLink02]
		}, options || {});

		var id = 0;
		
		this.options.ajaxUrls.each(function(url) {
			++id;
		});

		for (var i = 0, xhrs = []; i < id; i++) { 
			xhrs.push(new Ajax(this.options.ajaxUrls[i], {method: 'get',evalScripts: true,evalResponse: true,update: $(this.options.ajaxTargets[i])}));
		}

		id = 0;
		
		this.options.ajaxLinks.each(function(link, index) {
			$(link).addEvent('click', function(e) {
				new Event(e).stop();
			
				xhrs.each(function(xhr){
					xhr.url = xhr.url + (index + 1);
					xhr.request();
					xhr.url = xhr.url.substring(0, xhr.url.length-1);
				});
			});	
		});
	},
	
	open: function(sAjaxUrls, sAjaxTargets) {
		var id = 0;
		sAjaxUrls.each(function(url) {
			++id;
		});

		for (var i = 0, xhrs = []; i < id; i++) { 
			xhrs.push(new Ajax(sAjaxUrls[i], {method: 'get',evalScripts: true,evalResponse: true,update: $(sAjaxTargets[i])}));
		}
				
		xhrs.each(function(xhr){
		
			xhr.request();
		});
		
		//return false;
	}
};
