var Modify = {
	breadcrumbs: function() {
		var breadcrumbs = $('#breadcrumbs li');
		breadcrumbs.slice(0, breadcrumbs.length - 1).append('&nbsp;&nbsp;&gt;&gt;&nbsp;|&nbsp;');
		
		var breadcrumbs = $('#breadcrumbsOverlay li');
		breadcrumbs.slice(0, breadcrumbs.length - 1).append('&nbsp;&nbsp;&gt;&gt;&nbsp;|&nbsp;');		
	},
	
	taketheplunge: function() {
		$('.social a:first-child')
			.after('&nbsp;&nbsp;|&nbsp;&nbsp;')
		;
	},	
	
	social: function() {
		$('.social a:first-child')
			.after('&nbsp;&nbsp;|&nbsp;&nbsp;')
		.next().click(function(eventObject) {
			print();
			eventObject.stopPropagation();
			return false;
		});
	},
	
	taketheplungeChange4Life: function() {
		Modify.taketheplunge();
		$('.social')
			.css({'display': 'inline', 'padding-left': '8px'})
			.before($(document.createElement('img'))
				.attr({'src': 'images//change_4_life/figure_left.gif', 'alt': ''})
				.css({'vertical-align': 'top', 'margin-left': '8px'}))
			.children('a:first').next()
				.after($(document.createElement('img'))
					.attr({'src': 'images//change_4_life/figure_right.gif', 'alt': ''})
					.css({'vertical-align': 'middle', 'margin-left': '0px'}));
	},	
	
	socialChange4Life: function() {
		Modify.social();
		$('.social')
			.css({'display': 'inline', 'padding-left': '8px'})
			.before($(document.createElement('img'))
				.attr({'src': 'images//change_4_life/figure_left.gif', 'alt': ''})
				.css({'vertical-align': 'top', 'margin-left': '8px'}))
			.children('a:first').next()
				.after($(document.createElement('img'))
					.attr({'src': 'images//change_4_life/figure_right.gif', 'alt': ''})
					.css({'vertical-align': 'middle', 'margin-left': '0px'}));
	},
	
	footer: function() {
		$('#left_footer li.mid').append('&nbsp;&nbsp;&nbsp;|');
		$('#right_footer li.mid').append('&nbsp;&nbsp;&nbsp;|');
	},
	
	search: function() {
		var inputText = $('#postcode');
		var inputTop = $(document.createElement('img')).attr({'src': 'images/pool_finder/input_postcode_top.gif', 'alt': ''});
		var inputBottom = $(document.createElement('img')).attr({'src': 'images/pool_finder/input_postcode_bottom.gif', 'alt': ''});
		$('label').text('').append(inputTop).append(inputBottom).append(inputText);
	},
	
	searchResults: function() {
		$('.result .more-info a:first-child').after($(document.createElement('span')).text(' | '));

		var inputText = $('#postcode');
		var inputTop = $(document.createElement('img')).attr({'src': 'images/pool_finder/input_postcode_top.gif', 'alt': ''});
		var inputBottom = $(document.createElement('img')).attr({'src': 'images/pool_finder/input_postcode_bottom.gif', 'alt': ''});
		$('label').text('').append(inputTop).append(inputBottom).append(inputText);
	},
	
	sampleForm: function() {
		$("#sampleform").validate({
			errorElement: "strong",
			errorPlacement: function(error, element) {
				if(element.is(":radio"))
					error.appendTo(element.parents('li').get(1));
				else
					error.appendTo(element.parent('li'));
			},
			rules: {
				'firstname':		"required",
				surname:			"required",
				'address1':		"required",
				city:				"required",
				country:			"required",
				postcode:			"required",
				email: 				{ required: true, email: true },
				'emailconfirm':	{ required: true, email: true, equalTo: "#email" },
				'samplesize':		"required"
			},
			messages: {
				'firstname':		"Please enter your first name",
				surname:			"Please enter your surname",
				'address1':		"Please enter an address",
				city:				"Please enter a city",
				country:			"Please enter a country",
				postcode:			"Please enter a postcode",
				email: 				{ required: "Please enter your email address",
									  email: "Please enter a valid email address" },
				'emailconfirm':	{ required: "Please enter your email address",
									  email: "Please enter a valid email address",
									  equalTo: "Email and confirmed email need to have the same value" },
				'samplesize': 		"Please choose your preferred sample format"
			}
		});
	},
	
	sampleTerms: function() {
		$('.bottom ol li').each(function(i) {
			$(this).prepend(i + 1 + '. ');
		});
	},
	
	faqList: function() {
		$('#faq_content .text ul li a').append('&nbsp;&gt;&gt');
	},
	
	elements: function() {
		var functions = arguments;
		$(document).ready(function() {
			for(var i = 0; i < functions.length; i++) {
				Modify[functions[i]]();
			}
		});
	}
}