
var frontpage = {
	carousel: function(){
				var wrappers = $$('.subcatWrap');
				//var bubbles = $$('.bubble');
				wrappers.each(function(parent,x) {
					var myPages = parent.getElements('div.page');
					var myBubbles = parent.getElements('div.bubble');
					var myBubblesPrice = parent.getElements('span.price');
					var pageWrap  = parent.getElement('div.pageWrap');
					if (myBubbles.length > 0) {
					myBubbles.setStyle('opacity', 0);
					myBubbles[0].setStyle('opacity', 1);
					}
					if (myBubblesPrice.length > 0) {
					myBubblesPrice.setStyle('opacity', 0);
					myBubblesPrice[0].setStyle('opacity', 1);
					}
					myPages.each(function(el, i) {
						el.set('morph', {link : 'cancel'});
						el.addEvents({
							'mouseenter': function() {
								myBubbles.morph({
									'opacity' : 0
								});
								if (myBubblesPrice.length > 0) {
									myBubblesPrice.morph({
										'opacity' : 0
									});
								}
								myBubbles[i].morph({
									'opacity' : 1
								});
								if (myBubblesPrice.length > 0) {
									myBubblesPrice[i].morph({
										'opacity' : 1
									});
								}
							}
						});
					});
					parent.set('morph', {link : 'cancel'});
					parent.addEvent('mouseleave', function(event) {
						if (myBubbles.length > 0) {
							myBubbles.morph({
									'opacity' : 0
								});
							myBubbles[0].morph({
									'opacity' : 1
								});
						}
					});
				});
			},
			init: function(){
				this.carousel();	
			}
};
window.addEvent('domready', frontpage.init.bind(frontpage));
