$(document).ready(function() {
	$('#ValidationErrors > li').each(function(e) {
		if (!$("form.yform fieldset div[rel='" + key + "']").hasClass("error"))
		{
			var key = $(this).attr("rel-key");			
			var message = $(this).text();	
			if ($(key).attr("rel-message"))
			{
				message = $(this).attr("rel-message");
			}	
			$("form.yform fieldset div[rel='" + key + "']").addClass("error");
			$("form.yform fieldset div[rel='" + key + "']").prepend('<strong class="message">' + message + '</strong>');
		}
	});
	
	$(".program .choices > input").bind('click', function() {
		var box = $(this).attr("checked");
		var n = $(this).attr("name");
		$(".program .choices > input[name='" + n + "']").attr("checked", "");
		if (box) {
		    $(this).attr("checked", "true");
		}
		$("#form-choices").submit();
	});
	
	$("#imagesbottom > div").bind('click', function() {
		var src = $(this).attr("rel");
		var code = '<img src="' + src + '"/>';
		$("#imagedisplay").html(code);
	});
	
	$("#imagedisplay").html('<img src="' + $("#imagesbottom div:first").attr("rel") + '" alt="" />');	
	
    $("#header").bind('click', function() {
    	location.href = '/';
    }); 	
});

function buylink(url) {
	var MyWindow = window.open(url,'MyWindow','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=630,height=600,left=20,top=20'); 
	MyWindow.focus();
	return false;
}