/*window.addEvent('domready', function() {
	// You can skip the following two lines of code. We need them to make sure demos
	// are runnable on MooTools demos web page.
	if (!window.demo_path) window.demo_path = '';
	var demo_path = window.demo_path;
	// --
		
	//We can use one Request object many times.
	var req = new Request.HTML({url:demo_path+'index.php?option=com_onlinestore&view=rollover&id=123', 
		onSuccess: function(html) {
			//Clear the text currently inside the results div.
			$('overDiv').set('text', '');
			//Inject the new DOM elements into the results div.
			$('overDiv').adopt(html);
		},
		//Our request will most likely succeed, but just in case, we'll add an
		//onFailure method which will let the user know what happened.
		onFailure: function() {
			$('overDiv').set('text', 'The request failed.');
		}
	});
	
	$('imgMoreInfo').addEvent('mouseover', function() {
		req.send();
	});

});

/* Tips 2 */
/*var Tips2 = new Tips($$('.Tips2'), {
	initialize:function(){
		this.fx = new Fx.Style(this.toolTip, 'opacity', {duration: 500, wait: false}).set(0);
	},
	onShow: function(toolTip) {
		this.fx.start(1);
	},
	onHide: function(toolTip) {
		this.fx.start(0);
	}
});*/
/*var url = 'http://demos111.mootools.net/demos/Group/lipsum.html?antiCache=';
var id = 0;
var tips = new Tips();
*/

window.addEvent('domready', function(){
	
	var tips = new Tips();
	var url = 'index.php?option=com_onlinestore&task=moreinfo';
			
	/*var options = {
				method: 'get',
				onRequest: function(){
					this.options.reqState
						.addClass('ajax-loading')
						.setHTML('Request ...');
				},
				onComplete: function(resp){
					this.options.reqState
						.removeClass('ajax-loading')
						.setProperty('title', 'Response: :: ' + resp)
						.setHTML(resp);
					tips.build(this.options.reqState);
			
				}
			};
	
	var xhrs = [
				new Ajax(url, $merge({reqState: $('overDiv')}, options)),
			];
	
	var group = new Group(xhrs[0]);

	group
		.addEvent('onRequest', function() {
					$('overDiv')
						.addClass('ajax-loading')
						.setHTML('All Requests started ...');
				})
		.addEvent('onComplete', function() {
					$('overDiv')
						.removeClass('ajax-loading')
						.setHTML('All Completed!');
				});
	
		
	$('imgMoreInfo').addEvent('click', function(e) {
				new Event(e).stop();
			
				xhrs.each(function(xhr){
					xhr.url = url + $random(100, 999);
					xhr.request();
				});
			});
	*/
	
	if($('imgMoreInfo')){
	$('imgMoreInfo').addEvent('mouseover', function(e) {
		e = new Event(e).stop();
	
		var url = "index.php?option=com_onlinestore&task=moreinfo";
	
		/**
		 * The simple way for an Ajax request, use onRequest/onComplete/onFailure
		 * to do add your own Ajax depended code.
		 */
	new Ajax(url, {
			method: 'get',
			onComplete: function(resp){
					/*$('overDiv').setHTML(resp);
						.removeClass('ajax-loading')
					$('overDiv').setProperty('title', 'Response: :: ' + resp);
					tips.build($('overDiv'));*/
					//var text = 'This is what we call a sticky, since I stick around (it goes away if you move the mouse  OVER and then OFF the overLIB popup--or mouseover another overLIB).';
					overlib(resp, STICKY, MOUSEOFF);
					//alert(resp);
				}
			/*update: $('overDiv')*/
		}).request();
	});

	}

}); 

