//registration ajax by Mikkel Oscar Lyderik
$(function() {
	$(".reghandle").blur(function()
	{
		var elemID = $(this).attr("id");
		var val = $("#"+elemID).val();
		var pwd = $("#pwd1").val();
		var mail = $("#mail1").val();
		var dataString = 'elemID='+elemID+'&value='+val+'&pass='+pwd+'&mail='+mail;
	
		$("#regoutput-"+elemID).show();
		$("#regoutput-"+elemID).fadeIn(400).html('<img src="images/loader.gif" alt="loading" />');
	
		$.ajax({
			type: "POST",
			url: "ajaxreg.php",
			data: dataString,
			cache: false,
			success: function(html){
				$("#regoutput-"+elemID).hide();
				$("#regoutput-"+elemID).html(html);
				$("#regoutput-"+elemID).fadeIn("def");
				}
			});
	});
});

//Document ready functions
$(document).ready(function() {
	//sc_sortable handles the sort box on the right
	$("#sortable-box").sortable({
	  helper : 'clone',
	  opacity : 0.8,
      handle : '.boxhandle',
	  revert: 250,
	  placeholder: 'box-placeholder',
	  forcePlaceholderSize: true,
      update : function () {
		  var order = $('#sortable-box').sortable('serialize');
		  $.ajax({
			type: "POST",
			url: "sc_sortable.php",
			data: order,
			cache: false
		  });
      }
    });
	
	//activate fancybox plugin
	$("a.zoomfancy").fancybox({
		'zoomSpeedIn'	:	500,
		'zoomSpeedOut'	:	500
	});
});