var thickHeight;
var thickWidth;

$(function() {
	attach_site_actions();
	update_dimensions();
});

function resize_content_div() {
	$("#content").css('height', (Math.ceil($("#content").height()/152)*152));	
}
window.onload = function() {
	resize_content_div();
}

function attach_site_actions() {
	$("a[@href^='http:']").attr('target','_blank');
	$("a.external").attr('target','_blank');
	
	
	var active_color = '#BF0D93'; // Colour of user provided text
	var inactive_color = '#BF0D93'; // Colour of default text
	$("input[title], textarea[title]").css("color", inactive_color);
	var default_values = new Array();
	$("input[title], textarea[title]").each(function() {
			if (!default_values[this.id]) {
				default_values[this.id] = $(this).attr('title');
			}
			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('title');
		}
		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];
			}
		});
	});
	
	$("form").submit(function() {
		$("input[title], textarea[title]").each(function() {
				if (!default_values[this.id]) {
					default_values[this.id] = $(this).attr('title');
				}
				if (this.value==default_values[this.id]) {
					this.style.color = active_color;
					this.value = '';
				}
			});
			
		return true;
	});
	
}

function update_dimensions() {
	thickHeight = $(window).height()-50;
	thickWidth=650;
}