
function show(elements) {
	// This is used to reveal elements that use the .png class
	// We hide them until page load to avoid the "blocking" effect before the transformation occurs
	for (e=0; e<elements.length; e++) {
		document.getElementById(elements[e]).style.display = 'block';
	}
}

function toggleDebug() {
	// This toggles debugging information, if debugging is turned on:
	var d = document.getElementById('debug');
	if (d.style.display == 'block') {
		d.style.display = 'none';
	}
	else {
		d.style.display = 'block';
	}
	return false;
}

function paginate() {
	document.getElementById('pagination').submit();
}


function number_format( number, decimals, dec_point, thousands_sep ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +     bugfix by: Michael White (http://getsprink.com)
    // +     bugfix by: Benjamin Lupton
    // +     bugfix by: Allan Jensen (http://www.winternet.no)
    // +    revised by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
    // +     bugfix by: Howard Yeend
    // *     example 1: number_format(1234.5678, 2, '.', '');
    // *     returns 1: 1234.57     
 
    var n = number, c = isNaN(decimals = Math.abs(decimals)) ? 2 : decimals;
    var d = dec_point == undefined ? "." : dec_point;
    var t = thousands_sep == undefined ? "," : thousands_sep, s = n < 0 ? "-" : "";
    var i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;
    
    return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
}

function limitChars(textid, limit, infodiv) {
	/* From: http://www.ajaxray.com/blog/2007/11/09/interactive-character-limit-for-textarea-using-jquery/ */
		// alert("!");
	var text = $('#'+textid).val(); 
	var textlength = text.length;
	if(textlength > limit) {
		// $('#' + infodiv).html('You cannot write more then '+limit+' characters!');
		$('#'+textid).val(text.substr(0,limit));
		$('span.' + infodiv).html('0');
		return false;
	}
	else {
		$('span.' + infodiv).html((limit - textlength) + '');
		return true;
	}
}
/* IE was throwing objections to having this here...? */
$(function() {
	$('a.fancybox').fancybox({
		'frameWidth':		630
	});
	
	$('a[href=#]').css('cursor','default');
	$('a[href=#][onclick]').css('cursor','pointer');
 // How do we use jQuery to select links WITHOUT an onclick attribute?
	$('a[href=#]').click(function() {
		// This still works because the onclick event is still respected, so this just means that straight '#' links aren't followed
		return false;
	});	
	
});

/* New LHM: */
	
	$(function() {
		$('#menu a').hover(
			function () {
         		// $('#debug').html("OVER IMG");
        		$(this).next('div.hidden').show(); // fadeIn('fast');
	      	}, 
			function () {
				// $('#debug').html("OUT IMG");
				$(this).next('div.hidden').hide(); // fadeOut();
			}
		)
		$('#menu div.hidden').hover(
			function() {
				// $('#debug').html("OVER DIV");
				$(this).removeClass('hidden');
				$(this).show();
			},
			function() {
				/* This isn't working too well in IE6 */				
				// $('#debug').html("OUT DIV");
				$(this).hide();
				$(this).addClass('hidden');
			}			
		);
	});
	

