/************************ Utilities *****************************************/

/*
	Sets up all anchor tags with "rel=facebox" as facebox triggers.
*/
function activateFacebox() {
  if ($j.facebox == undefined)
    return;
	$j(document).ready(function($) {
		$j('a[rel*=facebox]').facebox(); 
	})
}

/*
	Loads data from a remote URL into facebox.
*/
function faceboxRemote(url) {
	$j.facebox(function($) { 
	  $j.get(url, function(data) {
	    $j.facebox(data)
	  })
	})	
}

/*
  Close Facebox pop-up.
*/
function closeFacebox() {
  $j.facebox.close();
}

function fadeForms(from, to) {
  $j(from).fadeOut();
  $j(to).fadeIn();
}

function fadeMessage(htmlid, delay) {
  setTimeout('$j("#'+htmlid+'").fadeOut();', delay);
}

/****************************************************************************/

/************************ Specialised ***************************************/

/*
	This method executes after every Ajax request.
*/
function afterAjax() {
	// Activate our facbox links
	activateFacebox();
}

/****************************************************************************/

/************************ Document Prep *************************************/

$j = jQuery.noConflict();

$j(document).ready(function($) {
	activateFacebox();
})

/****************************************************************************/
