jQuery(document).ready(function(){

	// Opens external links in a new window (unless it's going to the cornforthimages domain)
	jQuery("a[href*='http://']:not([href*='"+location.hostname+"'])").attr("target","_blank");
	jQuery("a[href*='cornforthimages']").removeAttr("target");

	
	
	jQuery('.block').each(function(){
		jQuery(this).find('.content > p:first').find('img:first').remove().prependTo(jQuery(this)).css({
			'float': 'none',
			'margin-bottom': 10
		});
	});
	
	
	
	// Clear default values in form input fields
	var active_color = '#000'; // Colour of user provided text
	var inactive_color = '#999'; // Colour of default text
	
  jQuery("input.textfield").css("color", inactive_color);
  var default_values = new Array();
  jQuery("input.textfield").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;
    }
    jQuery(this).blur(function() {
      if (this.value == '') {
        this.style.color = inactive_color;
        this.value = default_values[this.id];
      }
    });
  });

});