$(function() {
	$("a[href*=#]").not(".register a").click(function() {
		if (location.pathname.replace(/^\//,"") == this.pathname.replace(/^\//,"") && location.hostname == this.hostname) {
			var $target = $(this.hash);
			$target = $target.length && $target || $("[id=" + this.hash.slice(1) +"]");
			if ($target.length) {
				var targetOffset = $target.offset().top;
				var delay =  $(this).offset().top;
				if (delay<targetOffset)
					delay = targetOffset;
				$("html,body").animate({scrollTop: targetOffset}, 500);
				return false;
			}
		}
	});
	$("div.button").hover(function () {
		$(this).animate({
			left: '+=5',
			queue:false
		}, 200);
	}, function () {
		$(this).animate({
			left: '-=5',
			queue:false
		}, 200);
	})
	$(".checkbox").click(function () {
		if($(this).is(":checked")) {
			$(".off").attr('disabled', true);
		} else {
			$(".off").removeAttr('disabled');
		}
	})
});

//Display an external page using an iframe
function openRegister(src){
	$.modal('<iframe src="' + src + '" height="500" width="650" style="border:0">', {
		closeHTML:"",
		containerCss:{
			backgroundColor:"#fff",
			borderColor:"#fff",
			padding:10
		},
		overlayClose:true,
		opacity:70,
		overlayCss: {backgroundColor:"#000"},
		position: [95,50],
		onOpen: function (dialog) {
			dialog.overlay.fadeIn('slow', function () {
				dialog.container.slideDown('slow', function () {
					dialog.data.fadeIn('slow');
				});
			});
		}
	});
}

