var addthis_pub = "";
window.addEvent("domready", function() {

    new SmoothScroll({ "links": $$(".scroll") });
    new AlphaPng();
    new Lightbox();

    $$(".volatile").each(function(el) {
        $(el).addEvent("focus", function() {
            if (this.getValue() == this.getProperty("title")) {
                this.value = "";
            }
        });
    });

    $$("a[rel*='external']").each(function(a) {
        $(a).setProperty("target", "_blank");
    });

	$$("ul.banners").each(function(el){ new Ticker(el, {"interval": 3500}) });
	$$(".latestnews ul").each(function(el){ new Ticker(el, {"interval": 5000}) });

	if($("counter")){
		var flash = new FlashObject("/_images/flash/countdown.swf", "counter", "166", "55", "8", "#000000");
		flash.addParam("menu","false");
		flash.addParam("quality","high");
		flash.addParam("WMODE","transparent");
		flash.write("counter");
	}

	if($("register")){
		var flash = new FlashObject("/_images/flash/register-now.swf", "register", "210", "80", "9", "#000000");
		flash.addParam("menu","false");
		flash.addParam("quality","high");
		flash.addParam("WMODE","transparent");
		flash.write("register");
	}

	if($("countdownFlash")){
		var flash = new FlashObject("/_images/flash/garden.swf", "countdownFlash", "220", "406", "9", "#000000");
		flash.addParam("menu","false");
		flash.addParam("quality","high");
		flash.addParam("WMODE","transparent");
		flash.write("countdownFlash");
	}

	$$(".creditList li li").each(function(el){
			new ListItemSelector($(el),{ "fxMin": 1, "fxMax": 0.5 });
		});
		
	$$(".socialize").addEvent("click", function(e){
		new Event(e).stop();
		addthis_url = location.href;
		addthis_title = document.title;
		addthis_click(this);
	});
	
	Cufon.replace('h1', { fontFamily: 'Soho Std Medium' });
	Cufon.replace('h2, .topbar .details span, .topLevel, #nav, #content .categorylist, .pageoptions, .formbutton', { fontFamily: 'Soho Std Medium', hover: true });
	Cufon.replace('#content .creditList, .sohoFont', { fontFamily: 'Soho Std', hover: true });
	
	$$("#dropdownNav li").each(function(li){
		li.addEvents({
			"mouseover":function(){ this.addClass("sfhover"); },
			"mouseout":function(){ this.removeClass("sfhover"); }
		});
	});

	$$(".faqlist li").each(function(el){
		var toggler = el.getElement(".expand");
		if(toggler){
			var slide = new Fx.Slide(el.getElement("div"),{"duration":350, "wait": false}).hide();
			toggler.addEvent("click", function(e){
				new Event(e).stop();
				if(this.hasClass("expand")){
					this.removeClass("expand").addClass("collapse");
					slide.slideIn();
				} else {
					this.removeClass("collapse").addClass("expand");
					slide.slideOut();
				}
			});
			
		}
	});

	
	
	

	// Create a new multibox and assign it to the mini basket object
	multibox = new MultiBox('multibox', {
		showControls:false,
		useOverlay:true,
		overlayColor: "#000000"
	});
	
	// Catch the close links for multibox popups
	$$(".multiboxClose").each(function(el){
		el.addEvent("click", function(e){
			new Event(e).stop();
			window.parent.miniBasket.multibox.close();
		});
	});	
 	
// 	$("CloseEventFinished").addEvent("click", function(e){
// 		new Event(e).stop();
//		var fadeout = new Fx.Style('EventFinished', 'opacity', {duration:1000});
//		fadeout.start(1, 0);
//	});
	
});


