window.addEvent("domready", function(){
	new SmoothScroll();

	new Accordion($$("#viewcomments"), $$("#blogcomments"), { "alwaysHide":true, "show":-1 });
	
	new Accordion($$(".formopen"), $$(".addressforms li"), { "alwaysHide":true, "show":-1 });
	new Accordion($$("#myaccount .open "), $$("#myaccount .opencontent"), { "alwaysHide":true, "show":-1 });
	new Accordion($$(".giftmessage"), $$(".giftmessagearea"), { "alwaysHide":true, "show":-1 });
	/*new Accordion($$(".specialinstructions label"), $$(".specialinstructions div"), { "alwaysHide":true, "show":-1 });*/

	new Tips($$(".tooltip"), { "offsets":{ "x":-0, "y":-130 } });

	new Asset.images(['/_images/buttons/buy-hover.gif', '/_images/buttons/continue-hover.gif', '/_images/buttons/gotocheckout-hover.gif', '/_images/buttons/makepayment-hover.gif', '/_images/buttons/update-hover.gif', '/_images/buttons/submit-hover.gif']);

	$$('.list-buynow').addEvents({
		"mouseover": function() {
			this.setProperty('src', '/_images/buttons/add-to-basket-hover.gif'); 
		},
		"mouseout": function() {
			this.setProperty('src', '/_images/buttons/add-to-basket.gif'); 
		}
	});

	$$('.continue').addEvents({
		"mouseover": function() {
			this.setProperty('src', '/_images/buttons/continue-hover.gif'); 
		},
		"mouseout": function() {
			this.setProperty('src', '/_images/buttons/continue.gif'); 
		}		
	});
	
	$$('.update').addEvents({
		"mouseover": function() {
			this.setProperty('src', '/_images/buttons/update-hover.gif'); 
		},
		"mouseout": function() {
			this.setProperty('src', '/_images/buttons/update.gif'); 
		}		
	});

	$$('.submit').addEvents({
		"mouseover": function() {
			this.setProperty('src', '/_images/buttons/submit-hover.gif'); 
		},
		"mouseout": function() {
			this.setProperty('src', '/_images/buttons/submit.gif'); 
		}		
	});

	$$('.continuecheckout').addEvents({
		"mouseover": function() {
			this.setProperty('src', '/_images/buttons/gotocheckout-hover.gif'); 
		},
		"mouseout": function() {
			this.setProperty('src', '/_images/buttons/gotocheckout.gif'); 
		}		
	});

	$$('.makepayment').addEvents({
		"mouseover": function() {
			this.setProperty('src', '/_images/buttons/makepayment-hover.gif'); 
		},
		"mouseout": function() {
			this.setProperty('src', '/_images/buttons/makepayment.gif'); 
		}		
	});


	$$(".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");
	});


	if($E(".step1formcontainer")){
		var tabs = $$("#step1-login li");
		var tabContent = $$(".step1form");


		tabs.each(function(tab, index){
			tab.addEvent("click", function(e){
				new Event(e).stop();
				tabs.removeClass("selected");
				this.addClass("selected");
			});
		});
	
		loginAccordion = new Accordion(tabs, tabContent, {
			"opacity":false
		});
	}

	if($("reminderdate")) new Calendar({ "reminderdate": "d/m/Y" });
	
	$$(".assignAddress").each(function(el){
		
		el.addEvent("click", function(e){
		
			new Event(e).stop();
			
			var assignPrefix = "Assign";
			var assignID = el.getProperty("value");
			var selectedAddressID = $("SelectedAddressID");
			
			if (selectedAddressID) {
				selectedAddressID.setProperty("value", assignID);
			}
			
			$("assignAddressForm").submit();
			
		});
		
	});
	
});

window.addEvent("load", function(){
								 
	
new TextImage("h1", {
	"color":"#FF3FA3",
	"background-color":"#000"
	});


new TextImage("#content h2", {
	"color":"#FF3FA3",
	"background-color":"#000"
	});

new TextImage("#accountcontainer h2", {
	"color":"#FF3FA3",
	"background-color":"#000"
	});

new TextImage("#side-col h2", {
	"color":"#FF3FA3",
	"background-color":"#000"
	});

new TextImage("#content h2 .link", {
	"color":"#FF3FA3",
	"background-color":"#000"
	});

new TextImage("#accountcontainer h2 .link", {
	"color":"#FF3FA3",
	"background-color":"#000"
	});

new TextImage(".user-actions span", {
	"color":"#FF3FA3",
	"background-color":"#000"
	});
							 
});
