$(function() {
	
	$("#accordion").tabs("#accordion div.pane", {tabs: 'h4', effect: 'slide', initialIndex: null});
	
	$("a[href^='http'], a.external").attr('target','_blank');
	
	$(".scrollable").scrollable({
		circular:true
	});
	$(".print-page").click(function() {
		window.print();
	});
	
	/* default-value */
	var active_color = '#000'; // Colour of user provided text
	var inactive_color = '#ccc'; // Colour of default text

	$("input.default-value, textarea.default-value").css("color", inactive_color);
	var default_values = new Array();
	$("input[default-value], textarea[default-value]").each(function() {
			if (!default_values[this.id]) {
				default_values[this.id] = $(this).attr('default-value');
			}
			if (this.value == '' || this.value==default_values[this.id]) {
				this.style.color = inactive_color;
				this.value = default_values[this.id];
			}
		}).focus(function() {
		if (!default_values[this.id]) {
			default_values[this.id] = $(this).attr('default-value');
		}
		if (this.value == default_values[this.id]) {
			this.value = '';
			this.style.color = active_color;
		}
		$(this).blur(function() {
			if (this.value == '') {
				this.style.color = inactive_color;
				this.value = default_values[this.id];
			}
		});
	});
});
