var ftw = {};
ftw.forms = {
	init : function () {
		this.login();
	},
	
	login : function () {
		var loginlink = jQuery("a.submit-button");
		if (loginlink.length === 0) { return; }
		loginlink.click(function() {
			jQuery(this).parent().parent().submit();
			return false;
		});
		
	}

};
ftw.webshop = {
	init : function() {
		this.buy_button();	
	},
	buy_button : function () {
		if (jQuery('.wpsc_buy_button').length == 0) { return; }
		jQuery('.wpsc_buy_button').each(function() {
			jQuery(this).addClass('hide-button').after('<span class="clear-float"></span><p><a href="#" class="wpsc_buy_button_link">Add to cart <span>+</span></a></p>');
			jQuery('.wpsc_buy_button_link').click(function() {
				jQuery(this).parent().parent().submit();
				console.log('hej');
				return false;
			});
		});
	}
};
ftw.tourplan = {
	init : function() {
		if (jQuery('.tourinfo').length == 0) { return; }
		jQuery('.tourinfo').each(function() {
				jQuery(this).hide();
				jQuery(this).prev().click(function() {
					jQuery(this).next().toggle();
					return false;
			 });
		});
	}
};
jQuery(document).ready(function() {
	ftw.forms.init();
	ftw.webshop.init();
	ftw.tourplan.init();
});