
var multibox;

window.addEvent("domready", function(){
									 
	$$(".latestOffersSlide").each(function(el){ new Ticker(el, {"interval": 10000}) });

	/*$$(".promotionContent, .promotions li").each(function(el){
		$ES(".delete", el).each(function(delLink){
			delLink.addEvent("click", function(e){
				new Event(e).stop();
				var boxToShow = $ES(".removePromotion", el)[0];
				TB_show("Delete Promotion", "#TB_inline?height=75&width=400&inlineId=" + boxToShow.id, "");
			});
		});
	});
	
	$$(".promotionContent").each(function(el){
		$ES(".add", el).each(function(delLink){
			delLink.addEvent("click", function(e){
				new Event(e).stop();
				var boxToShow = $ES(".addedPromotion", el)[0];
				TB_show("Promotion Saved", "#TB_inline?height=75&width=400&inlineId=" + boxToShow.id, "");
			});
		});
	});*/

new SmoothScroll({"links": $$(".scroll")});

$$(".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");
	});
	
	var toggler = $$("#nav .togglerLink")[0];
	
	if(toggler) {
		var customLink = new Fx.Slide(
			"moreItems",
			{ 
				"duration":600, 
				"transition": Fx.Transitions.Sine.easeOut,
				"onStart": function(){
				
					if (
						toggler.getParent().hasClass("more")){
						toggler.getParent().removeClass("more");
						toggler.getParent().addClass("less");
						toggler.setHTML("Less");
					} else {
						toggler.getParent().removeClass("less");
						toggler.getParent().addClass("more");
						toggler.setHTML("More");
					}
				}
			}
		);
		customLink.hide();
		toggler.addEvent("click", function(e){
			new Event(e).stop();
			customLink.toggle();
		});
	}
	
	var addthis_pub = "";

	$$(".socialize").each(function(el){
			el.addEvent("click", function(e){
			new Event(e).stop();
			addthis_url = location.href;
			addthis_title = document.title;
			addthis_click(this);
		});
	});
	
	$$(".reveal").each(function(el){
		el.addEvent("click", function(e){
			new Event(e).stop();
			window.open(el.href);
			el.setStyle("display", "none");
		});
	});
	
	multibox = new MultiBox('multibox', {
		useOverlay:true,
		showControls:false,
		openFromLink:true
	});
	
	$$(".multiboxClose").each(function(el){
		el.addEvent("click", function(e){
			new Event(e).stop();
			window.parent.multibox.close();
		});
	});
	
	$$(".viewlist").each(function(el){
		el.addEvent("click", function(e){
			new Event(e).stop();
			window.parent.location.href = "/my-account/saving-list/";
		});
	});
	
		multibox = new MultiBox('map', {
		showControls:false,
		useOverlay:true,
		overlayColor: "#ffffff"
	});

	
		if($("locmap")){
		var flash = new FlashObject("/_images/map/location.swf", "locmap", "520", "400", "8");
		flash.addParam("menu","false");
		flash.addParam("quality","high");
		flash.write("locmap");
	}
	
	

	//$$(".confirmYes").each(function(el){
		//el.addEvent("click", function(e){
			//new Event(e).stop();
			//window.parent.location.href = "/my-account/saving-list/?delete=true";
		//});
	//});
	
	var predictive = $("predictive");
	var keywords = $("keywords");
	
	if(predictive){
		keywords.addEvent("keyup", function(el){
			predictive.setStyle("display", "block");
		});
		keywords.addEvent("blur", function(el){
			setTimeout(function(){
				predictive.setStyle("display", "none");
			}, 500);
		});
	}
	
});

