var Mnet = new Class();

// Use this method for any duration to allow transitions to be turned off
Mnet.showTransitions = true;
Mnet.getDuration = function(duration) {
	return Mnet.showTransitions && $defined(duration) ? duration : 0;
};

/* Debug class */
Mnet.Debug = new Class();

Mnet.Debug.init = function() {
	if(!$defined(Mnet.Debug.el)) {
		Mnet.Debug.el = new Element('div', { id:'debug', style:'position:fixed; top:0px; left:0px; background-color:#FFFFFF; color:#000; ' +
			' width:200px; height:12px; z-index:10; text-align:left; line-height:12px; font-size:10px;' }); 
			
		var elClose = new Element('a', { href:'javascript:Mnet.Debug.clear();', html:'[X]', style:'position:absolute; right:0px; color:#000;' });
		Mnet.Debug.el.appendChild(elClose);

		Mnet.Debug.elText = new Element('div', {  });
		Mnet.Debug.el.appendChild(Mnet.Debug.elText);
			
		document.body.appendChild(Mnet.Debug.el);
	}
	else
		Mnet.Debug.el.setStyle('visibility', 'visible');
}
	
Mnet.Debug.append = function(txt) {
	Mnet.Debug.init();	
	var ctxt = Mnet.Debug.elText.get('html');
	if(ctxt != '')
		txt = ctxt + '<br/>' + txt;
		
	Mnet.Debug.el.setStyle('height', Mnet.Debug.elText.getStyle('height').toInt() + 12);
	
	Mnet.Debug.set(txt);
};
_d = Mnet.Debug.append;

Mnet.Debug.set = function(txt) {
	Mnet.Debug.init();
	Mnet.Debug.elText.set('html', txt);
};

Mnet.Debug.clear = function() {
	Mnet.Debug.init();
	Mnet.Debug.set('');
	Mnet.Debug.el.setStyle('height', 12);
	Mnet.Debug.el.setStyle('visibility', 'hidden');
};

Mnet.ImageScrollerContent = new Class({
	Implements: Options,
	
	options:{
		duration:500,
		transition:Fx.Transitions.Sine.easeInOut,
		direction:'ltr',
		link:'cancel'
	},
	
	initialize: function(handler, index, id, options) {
		this.setOptions(options);

		// Make sure element is empty
		this.contentDiv = $(id + '-body');
		this.contentDiv.empty();
		this.contentDiv.set('morph', {
			duration: Mnet.getDuration(this.options.duration), 
			transition: this.options.transition,
			link: this.options.link
		});

		this.directionRtl = (this.options.direction == 'rtl');
		this.handler = handler;
		this.index = index;
		
		this.imageCount = 0;
		this.imageIndex = 0;

		this.imageLoader = new Mnet.SerialImageLoader({ onProgress:this.onProgress.bind(this) });
	},
	
	addImages: function(images) {
		this.imageLoader.addImages(images);
	},

	load: function() {
		this.imageLoader.load();
	},
	
	onProgress: function(image, index, count) {
		this.imageCount++;
		
		// Load 1st image into 1st slot
		if(index == 0) {
			this.imageWidth = image != null ? image.getProperty('width') : this.imageLoader.imageArray[index].width;
			this.loadSlots(0, null, 0);
			this.moveSlot(0);
		}
		else if(index == 1) {
			this.loadSlots(1);

			// Alert handler that we are ready
			this.handler.scrollerReady(this.index);
		}
	},

	getImageDetails: function(index, newIndex) {
		var obj = this.imageLoader.imageArray[index];
		var img = this.imageLoader.images[index];
		
		// Create HTML
		var el;
		if($type(obj) == 'object') {
			if($defined(obj.flashsrc)) {
				if(obj.link != '')
					el = new Element('a', { href:obj.link, title:obj.title, style:'background:url('+obj.src+') no-repeat; display:block;' });
				else
					el = new Element('div', { style:'background:url('+obj.src+') no-repeat;' });

				var fo = Mnet.Flash.object(el, obj.flashsrc, obj.width, obj.height);
				/*
				fo.name = 'test1';
				fo.id = 'test1';
				
				document.body.appendChild(el);
				el.childNodes[0].id = 'test1';
				el.childNodes[0].name = 'test1';
				//alert(el.innerHTML);
				
				o = document['test1'];
				//alert(o.PercentLoaded() + ":" + o.StopPlay());
				
				x = function() {
					alert(o.PercentLoaded());
					//o.Rewind();
					o.StopPlay();
					o.GotoFrame(0);
					
					
					//o.StopPlay();
					//o.StopPlay();
				}
				x.delay(1000);
				*/
				
			/*		
				if(fo) {
					try {
						alert(fo);
						fo.Play();
						fo.Rewind();
					}
					catch(e) { alert(e.message); }
				}
				
				//this.imageLoader.images[index] = el;
				//obj.loaded = true;
				*/
			}
			else { // if(!obj.loaded) {
				img.setProperty('title', obj.title);
				if(obj.link != '') {
					el = new Element('a', { href:obj.link, title:obj.title });
					el.appendChild(img);
				}
				else
					el = img;
					
				//this.imageLoader.images[index] = el;
			
				//obj.loaded = true;
			}
			//else
			//	el = img;
				
			if(newIndex == index)
				this.options.currentDelay = obj.delay;
		}
		else 
			el = img;

		return el;
		/*
		return {
			src:img.src,
			title: obj.title,
			link: obj.title
		}
		*/
	},
	
	loadSlots: function(leftIndex, rightIndex, newIndex) {
		var img1 = this.getImageDetails(leftIndex, newIndex);
		var img2;
		if($defined(rightIndex))
			img2 = this.getImageDetails(rightIndex, newIndex);
		
		// If 1st or 2nd image, only append
		if(!$defined(rightIndex)) {
			this.contentDiv.appendChild(img1);
		}
		else {
			this.contentDiv.empty();
			this.contentDiv.appendChild(img1);
			this.contentDiv.appendChild(img2);
		}
	},
	
	moveSlot: function(index) {
		if(index == 1)
			this.contentDiv.setStyle('left', -this.imageWidth + 'px');
		else
			this.contentDiv.setStyle('left', 0);
	},
		
	next: function() {
		var thisIndex = this.imageIndex;
		var nextIndex = thisIndex + 1;
		if(nextIndex >= this.imageCount)
			nextIndex = 0;
	
		// Right to left?
		if(this.directionRtl) {
			this.loadSlots(nextIndex, thisIndex, nextIndex);
			this.moveSlot(1);
		}
		else {
			this.loadSlots(thisIndex, nextIndex, nextIndex);
			this.moveSlot(0);
		}
	
		this.contentDiv.morph({
			'left': this.directionRtl ? 0 : -this.imageWidth
		});	
		
		this.imageIndex = nextIndex;
	},
	
	prev: function() {
		var thisIndex = this.imageIndex;
		var prevIndex = thisIndex - 1;
		if(prevIndex < 0)
			prevIndex = this.imageCount - 1;

		// Right to left?
		if(this.directionRtl) {
			this.loadSlots(thisIndex, prevIndex, prevIndex);
			this.moveSlot(0);
		}
		else {
			this.loadSlots(prevIndex, thisIndex, prevIndex);
			this.moveSlot(1);
		}
		
		this.contentDiv.morph({
			'left': this.directionRtl ? -this.imageWidth : 0
		});	
		
		this.imageIndex = prevIndex;
	}
});

Mnet.ImageScroller = new Class({
	Implements: Options,
	
	options:{
		delay:3000
	},

	initialize: function(id, options) {
		this.setOptions(options);
		
		this.navPrev = $(id + '-nav-prev');
		this.navNext = $(id + '-nav-next');
		this.navPlay = $(id + '-nav-play');
		
		this.scrollersReady = 0;
		this.scrollers = [];

		this.navNext.addEvent('click', this.next.bind(this));
		this.navPrev.addEvent('click', this.prev.bind(this));
		this.navPlay.addEvent('click', this.play.bind(this));

		this.options.currentDelay = this.options.delay;

		this.hideNav();
	},
	
	addScroller: function(id, images, options) {
		var index = this.scrollers.length;

		var scroller = new Mnet.ImageScrollerContent(this, index, id, options);
		scroller.addImages(images);
		
		this.scrollers.push(scroller);
	},

	load: function() {
		this.scrollers.each(function(item) { item.load(); });
	},
	
	scrollerReady: function(index) {
		this.scrollersReady++;	
		if(this.scrollersReady == this.scrollers.length)
			this.onReady();
	},
	
	onReady: function() {
		// Get delay from first scroller
		if(this.scrollers.length > 0)
			this.options.currentDelay = this.scrollers[0].options.currentDelay;
		
		this.showNav();
		if($defined(this.options.onReady))
			this.options.onReady.run(null, this);
	},
	
	showNav: function() {
		this.navPrev.setStyle('visibility', 'visible');
		this.navNext.setStyle('visibility', 'visible');
		this.navPlay.setStyle('visibility', 'visible');
	},

	hideNav: function() {
		this.navPrev.setStyle('visibility', 'hidden');
		this.navNext.setStyle('visibility', 'hidden');
		this.navPlay.setStyle('visibility', 'hidden');
	},

	next: function(event, onTimer) {
		this.scrollers.each(function(item, index) { 
			item.next(); 
			if(index == 0) {
				this.options.currentDelay = item.options.currentDelay ? item.options.currentDelay : this.options.delay;
				//_d('x'+this.options.currentDelay+":"+item.options.currentDelay);
			}
		}, this);
		
		// If playing and called by user, reset the timer
		if(!onTimer && $defined(this.timerId)) {
			$clear(this.timerId);
			this.timerId = this.next.periodical(this.options.currentDelay, this, true);
		}
	},

	prev: function() {
		this.scrollers.each(function(item, index) { 
			item.prev(); 
			if(index == 0) 
				this.options.currentDelay = item.options.currentDelay ? item.options.currentDelay : this.options.delay;
		}, this);

		// If playing and called by user, reset the timer
		if($defined(this.timerId)) {
			$clear(this.timerId);
			this.timerId = this.next.periodical(this.options.currentDelay, this, true);
		}
	},

	play: function() {
		// Pause
		if($defined(this.timerId)) {
			$clear(this.timerId);
			this.timerId = null;
			
			if($defined(this.options.onPlayPause))
				this.options.onPlayPause.run(false, this);
		}
		// Play
		else {
			this.timerId = this.next.periodical(this.options.currentDelay ? this.options.currentDelay : this.options.delay, this, true);
			
			if($defined(this.options.onPlayPause))
				this.options.onPlayPause.run(true, this);
		}
	}
});

Mnet.SerialImageLoader = new Class({
	imageIndex: 0,
	
	initialize: function(options) {
		if(!$defined(options))
			options = {}

		this.onProgress = $defined(options.onProgress) ? options.onProgress : $empty;
		this.onComplete = $defined(options.onComplete) ? options.onComplete : $empty;
	},
	
	addImages: function(images) {
		if(!$defined(this.imageArray))
			this.imageArray = [];
		
		this.imageArray.extend(images);
	},
	
	load: function() {
		this.imageCount = this.imageArray.length;
		this.imageIndex = -1;
		
		// Call onload method - first time will init and load first image
		this.onLoad();
	},
	
	onLoad: function() {
		// First load call? init images array and skip event calling
		if(!$defined(this.images))
			this.images = [];
		else {
			this.onProgress(this.images[this.imageIndex], this.imageIndex, this.imageCount);
		}
		
		// More images to load?
		if(++this.imageIndex < this.imageCount) {
			var image = this.imageArray[this.imageIndex];
			var src = ($type(image) == 'object') ? image.src : image;
			
			/*
			if(src.match(/\.swf$/i)) {
				this.images.push(null);
				this.onLoad();
			}
			else
			*/
				this.images.push(new Asset.image(src, {onload:this.onLoad.bind(this)}));
		}
		else
			this.onComplete(this.imageCount);
	}
});

Mnet.ExpandCollapseButton = new Class({
	Implements: Options,
	
	options:{
		duration:500,
		transition:'pow:out',
		mode:'vertical',
		link:'ignore',
		classActive:'selected',
		classMouseOver:'hover'
	},
	
	initialize: function(button, box, options) {
		this.setOptions(options);

		if($type(button) == 'array') {
			this.elButton = [];
			button.each(function(item) { this.elButton.push($(item)); }.bind(this));
		}
		else
			this.elButton = [$(button)];
			
		this.elBox = $(box);
		if(!this.elBox || !this.elButton[0])
			return;

		this.slide = new Fx.Slide(box, {
			mode: this.options.mode,
			transition: this.options.transition,
			duration: Mnet.getDuration(this.options.duration),
			link: this.options.link
		});
		
		if(!$defined(this.options.expanded))
			this.options.expanded = this.elButton[0].hasClass(this.options.classActive);
		
		if(!this.options.expanded)
			this.slide.hide();
		else	
			this.slide.show();

		this.elBox.setStyle('visibility','visible');		
		
		// Add events to button(s)
		this.elButton.each(function(item) { 
			item.setStyle('cursor', 'pointer');

			item.addEvent('click', function() {
				// Still working?
				if(this.slide.timer)
					return;

				if(!this.options.expanded) {
					this.slide.slideIn();
					this.elButton.each(function(item) {
						item.addClass(this.options.classActive);
					}.bind(this));
				}
				else {
					this.slide.slideOut();
					this.elButton.each(function(item) {
						item.removeClass(this.options.classActive);
					}.bind(this));
				}
				
				this.options.expanded = !this.options.expanded;
				
			}.bind(this));

			item.addEvent('mouseover', function() {
				if(!this.options.expanded) {
					this.elButton.each(function(item) {
						item.addClass(this.options.classMouseOver);
					}.bind(this));
				}
			}.bind(this));

			item.addEvent('mouseout', function() {
				if(!this.options.expanded) {
					this.elButton.each(function(item) {
						item.removeClass(this.options.classMouseOver);
					}.bind(this));
				}
			}.bind(this));
		}, this);
	}
});

Mnet.Slider = new Class({
	Implements: Options,
	
	options: {
		duration: 1000,
		transition: Fx.Transitions.Pow.easeOut,
		link: 'cancel',
		reflect: {
			opacity:0.6,
			height:0.33
		}
	},
	
	initialize: function(slider, items, options) {
		this.setOptions(options);
		
		this.elSlider = $(slider);
		this.elFrame = this.elSlider.getElement('.slider');
		this.elBody = this.elSlider.getElement('.slider-body');
		this.elTracker = this.elSlider.getElement('.slider-tracker');
		this.elKnob = this.elSlider.getElement('.slider-knob');
		this.elLeft = this.elSlider.getElement('.slider-left');
		this.elRight = this.elSlider.getElement('.slider-right');
		
		// Calc width
		if($type(items) == 'string')
			items = this.elBody.getElements(items);
		
		this.items = items;
		this.widths = {};
		this.imageWidths = {};
		this.loaded = 0;
		
		this.bodyWidth = 0;
		
		this.scroller = new Fx.Scroll(this.elFrame, { 
			link: this.options.link,
			duration: Mnet.getDuration(this.options.duration), 
			transition: this.options.transition
		}).toLeft();

		// Go through each item and get width + add onload event to image
		this.items.each(function(item, index) {
			// Find image
			var img = item.getElement('.image img');
			this.widths[index] = img.width;
			
			var a = new Asset.image(img.src, { 
				onload: this.onImageLoad.bind(this, [img, index])
			});
		}, this);
	},
	
	onImageLoad: function(img, index) {
		this.loaded++;
		this.items[index].setStyle('width', this.widths[index]);
		this.bodyWidth +=  this.widths[index] + 10;
		this.elBody.setStyle('width', this.bodyWidth);
		
		if(this.options.reflect)
			img.reflect(this.options.reflect);
		
		if(this.loaded == this.items.length)
			this.onLoaded();
	},
	
	// All loaded, set up slider
	onLoaded: function() {
		// Get index max
		var widthCont = this.elSlider.getStyle('width').toInt();
		var width = 0;
		var i = this.items.length;
		while(i >= 0 && width < widthCont) {
			width += this.widths[i - 1] + 10;
			//_d(i + ":" + width + ":" + widthCont);
			if(width < widthCont)
				i--;
		}
		
		// Set knob width
		var count = this.items.length;
		var max = i;
		width = (count - max) / count;
		this.elKnob.setStyle('width', (width * 100) + '%');
		
		this.slider = new Slider(this.elTracker, this.elKnob, {
			range: [0, i],
			wheel: true,
			snap: true,
			//onStart: this.onStart.bind(this),
			//onTick: this.onTick.bind(this),
			//onComplete: this.onComplete.bind(this),
			onChange: this.onChange.bind(this)
		});
		this.slider.set(0);
		
		// Add links to left / right buttons
		if(this.elLeft)
			this.elLeft.addEvent('click', this.onStep.bind(this, -1));
		if(this.elRight)
			this.elRight.addEvent('click', this.onStep.bind(this, 1));
	},
	
	/*
	onStart: function() {
		//this.borderFx = this.borderFx || this.element.tween('border').start('#ccc');
		//Mnet.Debug.append('s');
	},
	onTick: function(pos) {
		//Mnet.Debug.append(this.slider.step);
		this.elKnob.setStyle('left', pos);
	},
	onComplete: function() {
		//alert(this.step + ":");
		//this.element.morph('left').start(10);
		//Mnet.Debug.append('d');
	},
	*/
	onChange: function() {
		var item = this.items[this.slider.step];
		this.scroller.toElement(item);
	},
	onStep: function(step) {
		this.slider.set(this.slider.step + step);
	}
});

Mnet.Accordion = new Class({
	Implements: Options,
	
	options: {
		link:'cancel',
		opacity:true,
		display:-1,
		alwaysHide:true,
		duration:700,
		transition:'expo:out',
		openClass:'selected',
		frame:'.accordion%level%',
		togglers:'.acc-toggler%level%',
		contents:'.acc-content%level%'
	},

	/*
	 * togglers
	 * contents
	 * options:
	 *   [accordion options]
	 *   openClass
	 */
	initialize: function(options) {
		this.setOptions(options);

		// Fix for IE6
		var heightValue = (window.ie6) ? '100%' : '';

		var _onComplete = $defined(options) ? options.onComplete : null;
		var _onActive = $defined(options) ? options.onActive : null;
		var _onBackground = $defined(options) ? options.onBackground : null;
		
		this.options.onComplete = function(toggler, content) {
			var element = $(this.elements[this.previous]);
			if(element && element.offsetHeight > 0) element.setStyle('height', heightValue);
			
			if($defined(_onComplete))
				_onComplete(toggler, content, this.options.level);
		};
		this.options.onActive = function(toggler, content) {
			if($defined(this.options.openClass))
				toggler.addClass(this.options.openClass);
			if($defined(_onActive))
				_onActive(toggler, content, this.options.level);
		};
		this.options.onBackground = function(toggler, content) {
			if($defined(this.options.openClass))
				toggler.removeClass(this.options.openClass);
			if($defined(_onBackground))
				_onBackground(toggler, content, this.options.level);
		};

		var frameCounter = 1;
		
		// Go through each level
		do {
			var frames = $$(this.options.frame.replace(/%level%/g, frameCounter));
			
			var moreFrames = (frames.length > 0);
			
			if(moreFrames) {
				// Create accordions for each frame
				frames.each(function(frame, index) {
					var togglers = frame.getElements(this.options.togglers.replace(/%level%/g, frameCounter));
					var contents = frame.getElements(this.options.contents.replace(/%level%/g, frameCounter));
				
					var valid = (togglers.length > 0 && togglers.length == contents.length);
					
					if(valid) {
						// Display contents if hidden
						contents.each(function(item) {
							if(item.getStyle('display') == 'none')
								item.setStyle('display', 'block');
						});
						
						// Check which item to display
						i = 0;
						while(i < togglers.length && !togglers[i].hasClass(this.options.openClass))
							i++;							
						this.options.display = (i < togglers.length) ? i : -1;
		
						// Create Accordion
						this.options.level = frameCounter;
						var acc = new Accordion(togglers, contents, this.options);
						acc.options.wait = false;
						
						if(frame.id != '')
							window['accordion-' + frame.id] = acc;
					}
					
				}, this);
				
				frameCounter++;
			}
		} while(moreFrames);
	}
});


Mnet.PageTabs = new Class({
	Implements: Options,
	
	options: {
		link:'cancel',
		opacity:true,
		display:0,
		duration:700,
		transition:'expo:out',
		classMouseOver:'hover',
		classActive:'selected',
		frame:'.tabs%level%',
		tabs:'.tab%level%',
		tabFrame:'.tab%level%Frame',
		contents:'.tab%level%Content'
	},

	initialize: function(options) {
		this.setOptions(options);

		var frameCounter = 1;
		
		// Go through each level
		do {
			var frames = $$(this.options.frame.replace(/%level%/g, frameCounter));
			
			var moreFrames = (frames.length > 0);
			if(moreFrames) {
				// Create accordions for each frame
				frames.each(function(frame, index) {
					var tabs = frame.getElements(this.options.tabs.replace(/%level%/g, frameCounter));
					var tabFrame = frame.getElement(this.options.tabFrame.replace(/%level%/g, frameCounter));
					var contents = frame.getElements(this.options.contents.replace(/%level%/g, frameCounter));
				
					var valid = (tabs.length > 0 && tabs.length == contents.length);
					if(valid) {
						// Check which item to display
						i = 0;
						while(i < tabs.length && !tabs[i].hasClass(this.options.classActive))
							i++;
						this.options.display = (i < tabs.length) ? i : -1;

						new Mnet.Tabs(tabs, tabFrame, contents, this.options);
					}
										
				}, this);
				
				frameCounter++;
			}
		} while(moreFrames);
	}
});

Mnet.Tabs = new Class({
	Implements: Options,
	
	options: {
		link:'cancel',
		opacity:true,
		display:0,
		duration:700,
		transition:'expo:out',
		classMouseOver:'hover',
		classActive:'selected',
		tabs:'.tab%level%',
		tabFrame:'.tab%level%Frame',
		contents:'.tab%level%Content'
	},

	initialize: function(tabs, tabFrame, contents, options) {
		this.setOptions(options);

		if($type(tabs) == 'string')
			tabs = $$(tabs);
		if($type(tabFrame) == 'string')
			tabFrame = $$(tabFrame)[0];
		if($type(contents) == 'string')
			contents = $$(contents);
		
		this.tabs = tabs;
		this.tabFrame = tabFrame;
		this.contents = contents;
		
		// Setup tabs
		tabs.each(function(item, index) {
			item.addEvent('click', function() {
				this.display(index);
			}.bind(this));

			item.addEvent('mouseover', function() {
				if(index != this.options.display)
					item.addClass(this.options.classMouseOver);
			}.bind(this));

			item.addEvent('mouseout', function() {
				if(index != this.options.display)
					item.removeClass(this.options.classMouseOver);
			}.bind(this));
		}, this);
		
		// Setup tab contents
		contents.each(function(item) {
			item.setStyles({opacity:0, display:'none'});
			item.set('tween', { link:this.options.link, duration:Mnet.getDuration(this.options.duration) });
		}, this);

		tabFrame.set('morph', { transition:this.options.transition, duration:Mnet.getDuration(this.options.duration) });
		
		var index = this.options.display;
		this.options.display = -1;
		
		var img = this.contents[index].getElements('img');
		if(img.length && !img[img.length - 1].complete) {
			img[img.length - 1].onload = this.display.bind(this, index);
			//alert('onload');
		}
		else
			this.display(index);
  	},
	
	display: function(displayIndex) {
		if(this.options.display == displayIndex || displayIndex >= this.tabs.length)
			return;
			
		// Hide the other tabs
		this.tabs.removeClass(this.options.classActive);
		this.tabs.removeClass(this.options.classMouseOver);
		
		// Add active class
		this.tabs[displayIndex].addClass(this.options.classActive);
		
		// Hide prev tab
		if(this.options.display >= 0) {
			var fx = new Fx.Tween(this.contents[this.options.display]);
			fx.start('opacity',1,0).chain(
    			function() { this.set('display','none'); }
			);
			//this.contents[this.options.display].tween('opacity', 0);
		}
		
		this.contents[displayIndex].setStyle('display','block');
		
		// Check if height is increasing or getting smaller
		var newHeight = this.contents[displayIndex].getFullHeight();
		this.tabFrame.morph({'height': newHeight});
		
		this.contents[displayIndex].tween('opacity', 1);

		this.options.display = displayIndex;
	}
});

Element.implement({
	getFullHeight: function() {
		//var value = this.retrieve('Element:fullHeight');
		//if(!$defined(value)) {
		var value = this.offsetHeight.toInt() + this.getHeightExtras();
		//	this.store('Element:fullHeight', value);
		//}
		return value;
	},
	
	getFullWidth: function() {
		//var value = this.retrieve('Element:fullWidth');
		//if(!$defined(value)) {
		var value = this.offsetWidth.toInt() + this.getWidthExtras(); 
		//	this.store('Element:fullWidth', value);
		//}
		return value;					
	},

	getWidthExtras: function() {
		//var value = this.retrieve('Element:widthExtras');
		//if(!$defined(value)) {
		var value = this.getStyle('marginRight').toInt() +
				this.getStyle('marginLeft').toInt() +
				this.getStyle('paddingRight').toInt() +
				this.getStyle('paddingLeft').toInt() +
				this.getStyle('borderRightWidth').toInt() +
				this.getStyle('borderLeftWidth').toInt();
		//	this.store('Element:heightExtras', value);
		//}
		return value;
	},
	
	getHeightExtras: function() {
		//var value = this.retrieve('Element:heightExtras');
		//if(!$defined(value)) {
		var value = this.getStyle('marginTop').toInt() +
				this.getStyle('marginBottom').toInt() +
				this.getStyle('paddingTop').toInt() +
				this.getStyle('paddingBottom').toInt() +
				this.getStyle('borderTopWidth').toInt() +
				this.getStyle('borderBottomWidth').toInt();
		//	this.store('Element:heightExtras', value);
		//}
		return value;
	},
	
	hasEvent: function(type) {
		var events = this.retrieve('events', {});
		events[type] = events[type] || {'keys': [], 'values': []};
		return events[type].values.length > 0;
	}
});


Mnet.Gallery = new Class({
	Implements: Options,
	
	options: {
		holderClass:'image-holder',
		thumbnailsClass:'thumbnails',
		fadeDuration:700,
		display:0,
		thumbFaded:0.5,
		thumbFadeDuration:200
	},
	
	initialize: function(holder, thumbnails, thumbnailHolder, options) {
		this.setOptions(options);
		
		this.holder = holder;
		this.images = holder.getElements('img');
		
		if($defined(thumbnails))				
			this.thumbnails = thumbnails.getElements(thumbnailHolder);				
		
		this.currentIndex = -1;
		this.maxIndex = this.images.length - 1;
		
		if(this.maxIndex < 0)
			return;

		// Wrap images in fixed div to keep h/w
		/*
		this.holderWrap = new Element('div').setStyles({
			position:'relative',
			height:this.options.height,
			width:this.options.width,
			margin:0,
			padding:0,
			cursor:'pointer'
		}).addEvent('click', this.next.bind(this));
		*/
		

		
		
		//var img = this.images[0];
		//holder.appendChild(this.holderWrap.adopt(holder.childNodes));
		
		//if(img.complete) this.wrap(img);
		//else img.onload = this.wrap.bind(this, img);
		
		var addHolderLink = true;
		
		this.images.each(function(item, index) {
			item = item.setStyles({
				position:'absolute',
				left:'0px',	
				top:'0px',
				opacity:0
			}).set('tween', {'link':'cancel','duration': Mnet.getDuration(this.options.fadeDuration)});
			
			if(item.getParent().get('tag') == 'a')
				addHolderLink = false;
		}, this);
		
		// If images don't already have links on them, add next() link to holder
		if(addHolderLink) {
			this.holder.setStyles({
				cursor:'pointer'
			}).addEvent('click', this.next.bind(this));
		}
				
		if($defined(this.thumbnails)) {
			this.thumbnails.each(function(item, index) {
				item
				.setStyles({cursor:'pointer','opacity':this.options.thumbFaded})
				.set('tween', {'link':'cancel','duration': Mnet.getDuration(this.options.thumbFadeDuration)})
				.addEvent('click', function() {
					this.display(index);	
				}.bind(this))
				.addEvent('mouseover', function() {
					item.tween('opacity', 1);
				}.bind(this))
				.addEvent('mouseout', function() {
					if(index != this.currentIndex)
						item.tween('opacity', this.options.thumbFaded);
				}.bind(this));
			}, this);
		}
		
		// Make sure image is loaded before displaying
		var img = this.images[this.options.display];
		if(img.complete) this.display(this.options.display);
		else img.onload = this.display.bind(this, this.options.display);
	},
	
	/*
	wrap: function(img) {
		this.holderWrap.setStyles({
			'width':img.getFullWidth(),
			'height':img.getFullHeight()
		});
	},
	*/
	
	display: function(index) {
		if(this.currentIndex == index)
			return;

		// Hide current image
		/*
		this.images.each(function(item, index) {
			if(index != this.currentIndex)
				item.set({opacity:0});
		}, this);
		*/
		
		// Update holder height		
		this.holder.setStyle('height', this.images[index].getFullHeight());
				
		if(this.currentIndex >= 0) {
			this.images[this.currentIndex].tween('opacity', 0);
			if($defined(this.thumbnails))
				this.thumbnails[this.currentIndex].tween('opacity', this.options.thumbFaded);
		}
		
		this.images[index].tween('opacity', 1);
		if($defined(this.thumbnails))
			this.thumbnails[index].set('opacity', 1);
		
		this.currentIndex = index;
	},
	
	prev: function() {
		var index = this.currentIndex - 1;
		this.display(index < 0 ? this.maxIndex : index);
	},
	
	next: function() {
		var index = this.currentIndex + 1;
		this.display(index > this.maxIndex ? 0 : index);
	},
	
	link: function() {
		var item = this.images[this.currentIndex];
		var parent = item.getParent();
		
		if(parent.get('tag') == 'a') {
			if(parent.hasEvent('click'))
				parent.fireEvent('click');
			else {
				var href = parent.href;
				if($type(href) == 'function')
					(href)();
				else if($type(href) == 'string' && href != '')
					document.location.href = href;
			}
		}
	}
});	

Mnet.Videos = new Class({
	Implements: Options,
	
	options: {
		fadeDuration:700,
		display:0,
		thumbFaded:0.5,
		thumbFadeDuration:200,
		params: {
			allowFullScreen:true, 
			wMode:'opaque', 
			bgcolor:'#fff',
			width:400,
			height:320
		}
	},
	
	initialize: function(holder, thumbnails, options) {
		this.setOptions(options);
		
		this.holder = holder;
		this.thumbnails = thumbnails && thumbnails.getElements('a');				
		this.title = options.titleHolder;
		
		if(!this.thumbnails || !this.holder)
			return;
						
		this.currentIndex = -1;
		this.maxIndex = this.thumbnails.length - 1;
		if(this.maxIndex < 0)
			return;
				
		this.thumbnails.each(function(item, index) {
			item
			.setStyles({cursor:'pointer','opacity':this.options.thumbFaded})
			.set('tween', {'link':'cancel','duration': Mnet.getDuration(this.options.thumbFadeDuration)})
			.addEvent('click', function() {
				this.display(index);	
				return false;
			}.bind(this))
			.addEvent('mouseover', function() {
				item.tween('opacity', 1);
			}.bind(this))
			.addEvent('mouseout', function() {
				if(index != this.currentIndex)
					item.tween('opacity', this.options.thumbFaded);
			}.bind(this));
		}, this);
		
		if(this.options.display >= 0)
			this.display(this.options.display);
	},
	
	display: function(index) {
		if(this.currentIndex == index)
			return;
		
		if(this.currentIndex >= 0) {
			//this.images[this.currentIndex].tween('opacity', 0);
			this.thumbnails[this.currentIndex].tween('opacity', this.options.thumbFaded);
		}
		
		var a = this.thumbnails[index];
		if($defined(this.title))
			this.title.innerHTML = a.getProperty('title');
		
		//this.holder.data = a.getProperty('href');
		
		Mnet.Flash.object(this.holder, a.getProperty('href'), this.options.width, this.options.height, this.options.params);
		
		//alert(this.holder.parentNode.innerHTML);
		/*
		this.images[index].tween('opacity', 1);
		if($defined(this.thumbnails))
			
		*/
		this.thumbnails[index].set('opacity', 1);
		
		this.currentIndex = index;
	},
	
	prev: function() {
		var index = this.currentIndex - 1;
		this.display(index < 0 ? this.maxIndex : index);
	},
	
	next: function() {
		var index = this.currentIndex + 1;
		this.display(index > this.maxIndex ? 0 : index);
	}
});	

/* Flash class */
Mnet.Flash = new Class();
Mnet.Flash.inline = function(container, src, width, height, bgcolor, vars, params) {
	if(!$defined(params)) {
		params = {
			allowScriptAccess: 'sameDomain',
			swLiveConnect: false,
	        bgcolor: bgcolor
	    }

		if($defined(bgcolor) && bgcolor != '') {
			params.bgcolor = bgcolor;
			params.wMode = 'opaque';
		}
		else {
			params.bgcolor = '#fff';
			params.wMode = 'transparent';
		}
	}
		
	return Mnet.Flash.object(container, src, width, height, params, vars);
}

Mnet.Flash.installed = (Browser.Plugins.Flash.version >= 6);
Mnet.Flash.object = function(container, src, width, height, params, vars, events) {
	if(!$defined(Mnet.rootUrl))
		Mnet.rootUrl = '';

	if(!$defined(params)) params = {};
	if(!$defined(vars)) vars = {};

	var options = {
	    width: width,
	    height: height,
		container: container,
	   	params: params, 
	    vars: vars,
		events: events
	};

	if(!src.match(/^\w+:\/\/|^\//))
		src = Mnet.rootUrl + 'flash/' + src + '.swf';
		
	//alert(src);
	
	if(Mnet.Flash.installed) {
		var o = new Swiff(src, options);
		return o;
	}
	else
		return null;
	//alert($(container).innerHTML + ":" + o.id);	
}

Mnet.Flash.Titles = new Class({
	Implements: Options,

	initialize: function(options) {
		if(!Mnet.Flash.installed)
			return;
		
		this.setOptions(options);
		
		if(!$defined(Mnet.rootUrl))
			Mnet.rootUrl = '';
		//if(!$defined(Mnet.Mnet.Flash.TitlesIdIndex))
		//	Mnet.Mnet.Flash.TitlesIdIndex = 0;

		for(var name in this.options) {
			options = this.options[name];
			var src = options.src;
			
			tags = $$('.flash-title-' + name);
			
			options = {
				//id: 'flash-movie-' + Mnet.Flash.TitlesIdIndex++,
			    width: options.width,
			    height: options.height,
			    params: {
					allowScriptAccess: 'same',
					swLiveConnect: false,
			        wMode: 'transparent',
			        bgcolor: options.bgcolor
			    },
			    vars: {}
			};

			tags.each(function(item) {
				var title = item.innerHTML.replace(/&amp;/g, '&');
				
				// Check for sub title
				var parts = (title + ' ').split(/<br\s*\/?>|<\/h\d>/i);
				if(parts.length > 1) {
					options.vars.sub_title = parts[1].replace(/<[^>]+>/g, '').replace(/^\s+|\s+$/, '');
					title = parts[0].replace(/<[^>]+>/g, '').replace(/^\s+|\s+$/, '');
				}
				else
					title = title.replace(/<[^>]+>/g, '').replace(/^\s+|\s+$/, '');
				
				options.vars.title = title; 
				options.container = item;
				
				new Swiff(Mnet.rootUrl + 'flash/' + src + '.swf', options);
				
				item.setStyle('visibility', 'visible');
			})
		}
	}
});

Mnet.ImageReflections = new Class({
	Implements: Options,
	
	options: {
		target:'.reflect',
		reflect: {
			opacity:0.6,
			height:0.33
		}
	},

	initialize: function(options) {
		this.setOptions(options);

		$$(this.options.target).each(function(item, index) {
			item.reflect(this.options.reflect);
		}.bind(this));
	}
});
/*!
	reflection.js for mootools v1.4
	(c) 2006-2008 Christophe Beyls <http://www.digitalia.be>
	MIT-style license.
*/

Element.implement({
	reflect: function(options) {
		var img = this;
		if (img.get("tag") != "img") return;

		options = $extend({
			height: 0.33,
			opacity: 0.5
		}, options);

		function doReflect() {
			img.unreflect();
			var reflection, reflectionHeight = Math.floor(img.height * options.height), wrapper, context, gradient;

			if (Browser.Engine.trident) {
				reflection = new Element("img", {src: img.src, styles: {
					width: img.width,
					height: img.height,
					marginBottom: -img.height + reflectionHeight,
					filter: "flipv progid:DXImageTransform.Microsoft.Alpha(opacity=" + (options.opacity * 100) + ", style=1, finishOpacity=0, startx=0, starty=0, finishx=0, finishy=" + (options.height * 100) + ")"
				}});
			} else {
				reflection = new Element("canvas");
				if (!reflection.getContext) return;
			}
			reflection.setStyles({display: "block", border: 0});

			wrapper = new Element(($(img.parentNode).get("tag") == "a") ? "span" : "div").injectAfter(img).adopt(img, reflection);
			wrapper.className = img.className;
			img.store("reflected", wrapper.style.cssText = img.style.cssText);
			wrapper.setStyles({width: img.width, height: img.height + reflectionHeight, overflow: "hidden"});
			img.style.cssText = "display: block; border: 0px";
			img.className = "";
			if (!Browser.Engine.trident) {
				context = reflection.setProperties({width: img.width, height: reflectionHeight}).getContext("2d");
				context.save();
				context.translate(0, img.height-1);
				context.scale(1, -1);
				context.drawImage(img, 0, 0, img.width, img.height);
				context.restore();
				context.globalCompositeOperation = "destination-out";

				gradient = context.createLinearGradient(0, 0, 0, reflectionHeight);
				gradient.addColorStop(0, "rgba(255, 255, 255, " + (1 - options.opacity) + ")");
				gradient.addColorStop(1, "rgba(255, 255, 255, 1.0)");
				context.fillStyle = gradient;
				context.rect(0, 0, img.width, reflectionHeight);
				context.fill();
			}
		}

		if (img.complete) {
			img.unreflect();
			doReflect();
		}
		else img.onload = doReflect;

		return img;
	},

	unreflect: function() {
		var img = this, reflected = this.retrieve("reflected"), wrapper;
		img.onload = $empty;

		if (reflected !== null) {
			wrapper = img.parentNode;
			img.className = wrapper.className;
			img.style.cssText = reflected;
			img.store("reflected", null);
			wrapper.parentNode.replaceChild(img, wrapper);
		}

		return img;
	}
});



/*!
	Slimbox v1.64 - The ultimate lightweight Lightbox clone
	(c) 2007-2008 Christophe Beyls <http://www.digitalia.be>
	MIT-style license.
*/

var Slimbox;

(function() {

	// Global variables, accessible to Slimbox only
	var state = 0, options, images, activeImage, prevImage, nextImage, top, fx, preload, preloadPrev = new Image(), preloadNext = new Image(),
	// State values: 0 (closed or closing), 1 (open and ready), 2+ (open and busy with animation)

	// DOM elements
	overlay, center, image, prevLink, nextLink, bottomContainer, bottom, caption, number;

	/*
		Initialization
	*/

	window.addEvent("domready", function() {
		// Append the Slimbox HTML code at the bottom of the document
		$(document.body).adopt(
			$$([
				overlay = new Element("div", {id: "lbOverlay"}).addEvent("click", close),
				center = new Element("div", {id: "lbCenter"}),
				bottomContainer = new Element("div", {id: "lbBottomContainer"})
			]).setStyle("display", "none")
		);

		image = new Element("div", {id: "lbImage"}).injectInside(center).adopt(
			prevLink = new Element("a", {id: "lbPrevLink", href: "#"}).addEvent("click", previous),
			nextLink = new Element("a", {id: "lbNextLink", href: "#"}).addEvent("click", next)
		);

		bottom = new Element("div", {id: "lbBottom"}).injectInside(bottomContainer).adopt(
			new Element("a", {id: "lbCloseLink", href: "#"}).addEvent("click", close),
			caption = new Element("div", {id: "lbCaption"}),
			number = new Element("div", {id: "lbNumber"}),
			new Element("div", {styles: {clear: "both"}})
		);

		fx = {
			overlay: new Fx.Tween(overlay, {property: "opacity", duration: 500}).set(0),
			image: new Fx.Tween(image, {property: "opacity", duration: 500, onComplete: nextEffect}),
			bottom: new Fx.Tween(bottom, {property: "margin-top", duration: 400})
		};
	});


	/*
		API
	*/

	Slimbox = {
		open: function(_images, startImage, _options) {
			options = $extend({
				loop: false,				// Allows to navigate between first and last images
				overlayOpacity: 0.8,			// 1 is opaque, 0 is completely transparent (change the color in the CSS file)
				resizeDuration: 400,			// Duration of each of the box resize animations (in milliseconds)
				resizeTransition: false,		// Default transition in mootools
				initialWidth: 250,			// Initial width of the box (in pixels)
				initialHeight: 250,			// Initial height of the box (in pixels)
				animateCaption: true,
				showCounter: true,			// If true, a counter will only be shown if there is more than 1 image to display
				counterText: "Image {x} of {y}"		// Translate or change as you wish
			}, _options || {});

			// The function is called for a single image, with URL and Title as first two arguments
			if (typeof _images == "string") {
				_images = [[_images,startImage]];
				startImage = 0;
			}

			images = _images;
			options.loop = options.loop && (images.length > 1);
			position();
			setup(true);
			top = window.getScrollTop() + (window.getHeight() / 15);
			fx.resize = new Fx.Morph(center, $extend({duration: options.resizeDuration, onComplete: nextEffect}, options.resizeTransition ? {transition: options.resizeTransition} : {}));
			center.setStyles({top: top, width: options.initialWidth, height: options.initialHeight, marginLeft: -(options.initialWidth/2), display: ""});
			fx.overlay.start(options.overlayOpacity);
			state = 1;
			return changeImage(startImage);
		}
	};

	Element.implement({
		slimbox: function(_options, linkMapper) {
			// The processing of a single element is similar to the processing of a collection with a single element
			$$(this).slimbox(_options, linkMapper);

			return this;
		}
	});

	Elements.implement({
		/*
			options:	Optional options object, see Slimbox.open()
			linkMapper:	Optional function taking a link DOM element and an index as arguments and returning an array containing 2 elements:
					the image URL and the image caption (may contain HTML)
			linksFilter:	Optional function taking a link DOM element and an index as arguments and returning true if the element is part of
					the image collection that will be shown on click, false if not. "this" refers to the element that was clicked.
					This function must always return true when the DOM element argument is "this".
		*/
		slimbox: function(_options, linkMapper, linksFilter) {
			linkMapper = linkMapper || function(el) {
				return [el.href, el.title];
			};

			linksFilter = linksFilter || function() {
				return true;
			};

			var links = this;

			links.removeEvents("click").addEvent("click", function() {
				// Build the list of images that will be displayed
				var filteredLinks = links.filter(linksFilter, this);
				return Slimbox.open(filteredLinks.map(linkMapper), filteredLinks.indexOf(this), _options);
			});

			return links;
		}
	});


	/*
		Internal functions
	*/

	function position() {
		overlay.setStyles({top: window.getScrollTop(), height: window.getHeight()});
	}

	function setup(open) {
		["object", window.ie ? "select" : "embed"].forEach(function(tag) {
			Array.forEach(document.getElementsByTagName(tag), function(el) {
				if (open) el._slimbox = el.style.visibility;
				el.style.visibility = open ? "hidden" : el._slimbox;
			});
		});

		overlay.style.display = open ? "" : "none";

		var fn = open ? "addEvent" : "removeEvent";
		window[fn]("scroll", position)[fn]("resize", position);
		document[fn]("keydown", keyDown);
	}

	function keyDown(event) {
		switch(event.code) {
			case 27:	// Esc
			case 88:	// 'x'
			case 67:	// 'c'
				close();
				break;
			case 37:	// Left arrow
			case 80:	// 'p'
				previous();
				break;	
			case 39:	// Right arrow
			case 78:	// 'n'
				next();
		}
		// Prevent default keyboard action (like navigating inside the page)
		return false;
	}

	function previous() {
		return changeImage(prevImage);
	}

	function next() {
		return changeImage(nextImage);
	}

	function changeImage(imageIndex) {
		if ((state == 1) && (imageIndex >= 0)) {
			state = 2;
			activeImage = imageIndex;
			prevImage = ((activeImage || !options.loop) ? activeImage : images.length) - 1;
			nextImage = activeImage + 1;
			if (nextImage == images.length) nextImage = options.loop ? 0 : -1;

			$$(prevLink, nextLink, image, bottomContainer).setStyle("display", "none");
			fx.bottom.cancel().set(0);
			fx.image.set(0);
			center.className = "lbLoading";

			preload = new Image();
			preload.onload = nextEffect;
			preload.src = images[imageIndex][0];
		}

		return false;
	}

	function nextEffect() {
		switch (state++) {
			case 2:
				center.className = "";
				image.setStyles({backgroundImage: "url(" + images[activeImage][0] + ")", display: ""});
				$$(image, bottom).setStyle("width", preload.width);
				$$(image, prevLink, nextLink).setStyle("height", preload.height);

				caption.set('html', images[activeImage][1] || "");
				number.set('html', (options.showCounter && (images.length > 1)) ? options.counterText.replace(/{x}/, activeImage + 1).replace(/{y}/, images.length) : "");

				if (prevImage >= 0) preloadPrev.src = images[prevImage][0];
				if (nextImage >= 0) preloadNext.src = images[nextImage][0];

				if (center.clientHeight != image.offsetHeight) {
					fx.resize.start({height: image.offsetHeight});
					break;
				}
				state++;
			case 3:
				if (center.clientWidth != image.offsetWidth) {
					fx.resize.start({width: image.offsetWidth, marginLeft: -image.offsetWidth/2});
					break;
				}
				state++;
			case 4:
				bottomContainer.setStyles({top: top + center.clientHeight, marginLeft: center.style.marginLeft, visibility: "hidden", display: ""});
				fx.image.start(1);
				break;
			case 5:
				if (prevImage >= 0) prevLink.style.display = "";
				if (nextImage >= 0) nextLink.style.display = "";
				if (options.animateCaption) {
					fx.bottom.set(-bottom.offsetHeight).start(0);
				}
				bottomContainer.style.visibility = "";
				state = 1;
		}
	}

	function close() {
		if (state) {
			state = 0;
			preload.onload = $empty;
			for (var f in fx) fx[f].cancel();
			$$(center, bottomContainer).setStyle("display", "none");
			fx.overlay.chain(setup).start(0);
		}

		return false;
	}

})();


// AUTOLOAD CODE BLOCK (MAY BE CHANGED OR REMOVED)
Slimbox.scanPage = function() {
	var links = $$("a").filter(function(el) {
		return el.rel && el.rel.test(/^lightbox/i);
	});
	
/*
	loop: Boolean; if true, allows to navigate between the first and last images of a Slimbox gallery, when there is more than one image to display. Default is false. 
overlayOpacity: The level of opacity of the background overlay. 1 Is opaque, 0 is completely transparent. You can change the color in the CSS file. Default is 0.8 
resizeDuration: The duration of the resize animation for width and height, in milliseconds. Default is 400. 
resizeTransition: The transition you want to use for the resize animation. You can choose amongst lots of cool transitions that are part of the optional “Transitions” module of mootools, like “Fx.Transitions.Elastic.easeOut”. Many transitions require a longer execution time to look good, so you should adjust the resizeDuration option above as well. 
initialWidth: The initial width of the box, in pixels. Default is 250. 
initialHeight: The initial height of the box, in pixels. Default is 250. 
animateCaption: Boolean; set it to false to disable the caption animation. Default is true. 
showCounter: Boolean; if true, a counter will be shown at the bottom of the caption zone if there is more than 1 image to display. Default is true. 
counterText: Allows you to customize or translate the default text for the counter. Inside the text, “{x}” will be replaced by the current image index, and “{y}” will be replaced by the total number of images. Default is “Image {x} of {y}”. 
*/
	var options = {
		overlayOpacity: 0.6,
		resizeDuration: Mnet.getDuration(500),
		resizeTransition: Fx.Transitions.Pow.easeOut,
		counterText: "Image {x} of {y}",
		loop:true
	};
	$$(links).slimbox(options, null, function(el) {
		return (this == el) || ((this.rel.length > 8) && (this.rel == el.rel));
	});
	
};

Mnet.init = function() { 
	// Hide flash titles
	if(Browser.Plugins.Flash.version >= 6) {
		document.write(
	'<' + 'style type="text/css" media="screen">' +
	'	.flash-title-main,' +
	'	.flash-title-main-acc,' +
	'	.flash-title-subtitle,' +
	'	.flash-title-subtitle-inner,' +
	'	.flash-title-inside-title,' +
	'	.flash-title-homepage,' +
	'	.flash-title-slider,' +
	'	.flash-title-featured-product,' +
	'	.flash-title-highlights { visibility:hidden; }' +
	'<' + '/' + 'style>'	
		);
	}
	
	// Hide tabs
	document.write(
	'<' + 'style type="text/css" media="screen">' +
	'	.tab1Content, .tab2Content, #top-login, #shop-by-menu ul li div.acc-content1, #bottom-expand ' +
	' 	{ visibility:hidden; }' +
	'	.acc-content1 ' +
	' 	{ display:none; }' +
	'<' + '/' + 'style>'
	);
	
	window.addEvent('domready', function() {
		// Create any accordions on the page
		new Mnet.Accordion();
		// Create any tabs on the page
		new Mnet.PageTabs();
			
		Slimbox.scanPage();
		
		// Setup flash titles
		new Mnet.Flash.Titles({
			'main':{
				src:'product_flash_titles',
				width:709,
				height:52,
				bgcolor:'#f00000'
			},
			'main-acc':{
				src:'product_flash_titles',
				width:650,
				height:52,
				bgcolor:'#f00000'
			},
			'subtitle':{
				src:'inside_subtitle',
				width:'100%',
				height:13,
				bgcolor:'#fff'
			},
			'subtitle-inner':{
				src:'inside_subtitle',
				width:328,
				height:13,
				bgcolor:'#fff'
			},
			'inside-title':{
				src:'inside_flash_titles',
				width:709,
				height:52,
				bgcolor:'#fff'
			},
			'homepage':{
				src:'homepage_flash_titles',
				width:230,
				height:52,
				bgcolor:'#000'
			},
			'slider':{
				src:'homepage_flash_titles2',
				width:704,
				height:32,
				bgcolor:'#000'
			},
			'featured-product':{
				src:'brand_flash_titles',
				width:231,
				height:62,
				bgcolor:'#f00000'
			},
			'highlights':{
				src:'brand_flash_titles2',
				width:339,
				height:52,
				bgcolor:'#000000'
			}
		});
		
		new Mnet.ImageReflections();
	
		new Mnet.ExpandCollapseButton(['quick-links-button','my-account-button'], 'bottom-expand');
		new Mnet.ExpandCollapseButton('header-menu-my_account', 'top-login');
	});
};

Mnet.initExtras = function() {
	// Hide flash titles
	if(Browser.Plugins.Flash.version >= 6) {
		document.write(
	'<' + 'style type="text/css" media="screen">' +
	'	.flash-title-blog-main { visibility:hidden; }' +
	'<' + '/' + 'style>'	
		);
	}
	
	window.addEvent('domready', function() {
		// Setup flash titles
		new Mnet.Flash.Titles({
			'blog-main':{
				src:'blog_main_titles',
				width:709,
				height:62,
				bgcolor:'#f00000'
			}
		});
	});
};
