var plushObj;
var Plush = Class.create();

Plush.prototype = {
	initialize: function() {
		this.nav_root = $('nav-top-list');
		this.vertical_accordion=null;
		this.init_nav();
		this.fix_pricing();
		this.zoom_image();
	},
	
	fix_pricing: function(){
		$$('#pricing').each(function(pricing) {
			pricing.innerHTML = "<div class='pricing_spacer'>"+pricing.innerHTML+"</div>";
		});
	},
	
	init_nav: function(){
		var t = this;
		$$(".top-nav-item dl").each(function(node){
			node.setStyle({
				'visibility' : 'visible'
				});
				Element.hide(node);	
			});
		$$('.top-nav-item').each(function(node){
			var ul = $A(node.getElementsByTagName("dl")).first();
			if(ul!=null){

				node.onmouseover = function(){
                	Element.show(ul);
					//this.addClassName("active");
                }
				node.onmouseout = function(){
 					Element.hide(ul);
					//this.removeClassName("active");
				}
			}
			});
		if($('nav-top-products')){
			t.vertical_accordion = new accordion('nav-top-products');
		}
		
	},
	replaceFlash : function(ele,swfFile,w,h){
		var flashTargetEle = $ele;
			var so = new SWFObject(swf, "flashReplaced", w, h, "9", "#FFFFFF");
			so.addParam("wmode","transparent");
			so.write(ele);
	},
	swapLargeImg : function(newHref){
		var image_holder=$('default_product_image_wrapper');
		image_holder.setStyle({
			'position':'relative',
			'height':'240px',
			'width':'187px'
		});
		var replaceable_image=$('default_image');
		var newImage = new Image();
		newImage.src = newHref;
		image_holder.getElementsByTagName("a")[0].appendChild(newImage);
		newImage.setStyle({
			'position':'absolute',
			'top':'0px',
			'left':'0px',
			'opacity':'0',
			'height':'240px',
			'width':'187px'
			
		});
		var tween1 = new Effect.Opacity(replaceable_image, { from: 1.0, to: 0.0, duration: 0.5});
		var tween2 = new Effect.Opacity(newImage, { from: 0.0, to: 1.0, duration: 0.5, delay: 0.5});
	},
	
	zoom_image: function(){
		$$('.zoom').each(function(zoom_image) {
			zoom_image.insert('<span class="zoom_image"></span');
		});
	}
	

	
}

Event.observe(window, 'load', function(){
	plushObj = new Plush();
});