﻿$(document).ready(function() {

 
 
	// Fields change colour when they're focused on
	$(".forms input.field, .forms select.field").change(function() {
		$(this).addClass("done");
	});

	// Selected state effect on radio button lists
	$(".multiple-choice input[type=radio], .multiple-choice label").click(function() {
		var row = $(this).parent().parent();
		row.siblings().removeClass("selected");
		row.addClass("selected");
	});
	$(".multiple-choice input[type=radio]:checked").trigger('click');

	// Print button
	$("li.print").click(function() {
		window.print();
	});

	// Image rollovers
	$("a.rollover").hover(function() {
		$(this).find("img").attr("src", $(this).find("img").attr("src").replace(".gif", "-hi.gif").replace(".jpg", "-hi.jpg"));
	}, function() {
		$(this).find("img").attr("src", $(this).find("img").attr("src").replace("-hi.gif", ".gif").replace("-hi.jpg", ".jpg"));
	});

	$("input.rollover, img.rollover").hover(function() {
		$(this).attr("src", $(this).attr("src").replace(".gif", "-hi.gif").replace(".jpg", "-hi.jpg"));
	}, function() {
		$(this).attr("src", $(this).attr("src").replace("-hi.gif", ".gif").replace("-hi.jpg", ".jpg"));
	});

	// Auto-jump for credit card number type fields
	$(".auto-jump").live("keyup", function() {
		if ($(this).val().length >= 4) {
			$(this).next("input[type=text]:first").trigger("focus");
			$(this).addClass("done");
		}
	});

});
