function chkEmpty(obj,alarm){
	if($.trim(obj.val()).length < 1){
		obj.focus();
		alert(alarm);
		return true;
	}

	return false;
}

$(document).ready(function() {

    $(".gallery_module").each(function (i) {
	  x = Math.floor(i/4);
	  y = i%4;
      $(this).next('.gallery_details').css('top',x*150+'px');
      $(this).next('.gallery_details').css('left',y*149+'px');
    });


    $(".gallery_module").mouseover(function () {
      if ($(this).next('.gallery_details').is(":hidden")) $(this).next('.gallery_details').slideDown("fast");
      else $(this).next('.gallery_details').slideUp("fast");
    });
	$(".gallery_details").mouseout(function () {
		$(this).slideUp("slow");		
	});
	
	$('#gallery a').lightBox();
	
	$('#membership').submit(function(){
		if(chkEmpty($('#username'),'Please enter your ID.')) return false;
		if(chkEmpty($('#password'),'Please enter your password.')) return false;
		return true;
	});	
});