/* adds bookmark in browser */
function CreateBookmarkLink(title, url) {
	if (window.sidebar) {
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) {
		window.external.AddFavorite( url, title);
	} else if(window.opera && window.print) {
		return true;
	}
}

/* creates hyperlinks for table rows */
function Goto(page) {
	$("tr.highlight").click(function (event) {
		if ($(event.target).is('td')) {
			document.location.href = page;
		}
	});
}

var active_color = '#000000'; // Colour of user provided text
var inactive_color = '#444444'; // Colour of default text

/**
* No need to modify anything below this line
*/

$(document).ready(function() {
	$("input.default-value").each(function() {
		$("input.default-value").css("color", inactive_color);
			var default_values = new Array();
			$(this).focus(function() {
				if (!default_values[this.id]) {
					default_values[this.id] = this.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];
				}
			});
		});
	});
	
	/* tab interface for modules */
	$("#tabs").tabs();
	
	/* dialog box */
	$("a#tell-a-friend").click(function () { 
		$("#dialog").dialog({
			bgiframe: true,
			height: 250,
			width: 400,
			modal: true,
			resizable: false,
			draggable: false,
			hide: 'slide',
			show: 'slide',
			close: function(ev, ui) { $(this).dialog("destroy"); } 
		});
	});
	
	/* tab overlay */
	$("div.tabs img").mouseover(function () {
		var tab = this.id;
		$("#img_" + tab).fadeIn("fast");
	});
	$("div.tabs img").mouseout(function () {
		var tab = this.id;
		$("#img_" + tab).fadeOut("fast");
	});
});