(function($) {

    $.titleBlock = {

        defaults: {

            removeTitle: true,
            thefontSize: "12px"

        }

    }

    $.fn.extend({
        titleBlock:function(config) {

            var config = $.extend({}, $.titleBlock.defaults, config);

            return this.each(function() {

                var theImage    = $(this),
                    removeTitle = config.removeTitle,
                    theFontSizeValue = config.thefontSize;

                theImage
                    .wrap("<div class='subtitles'>")
                    .parent()
                    .append("<h2>&nbsp;</h2>")
                    .find("h2")
                    .html(theImage.attr('title'))
                    .wrapInner("<span style='font-size:" + theFontSizeValue + "px;'></span>")
                    .find("br")
                    .before("<span class='spacer'>&nbsp;</span>")
                    .after("<span class='spacer'>&nbsp;</span>");

                if (removeTitle) {

                    theImage
                        .removeAttr("title");

                }


            })


        }

    })


})(jQuery);

$.fn.clearfocus = function() {
	return this.focus(function() {
		if( this.value == this.defaultValue ) {
			this.value = "";
		}
	}).blur(function() {
		if( !this.value.length ) {
			this.value = this.defaultValue;
		}
	});
};


$(document).ready(function(){
	$("a").focus(function() {
		$(this).blur();
	});

	$("#blogsearch").clearfocus();

	$("div.box").after("<div class=\"shadow\">&nbsp;</div>");

});

if( document.addEventListener ) document.addEventListener( 'DOMContentLoaded', contactform, false );

function contactform(){

  // Hide forms
  $( 'form.contactform' ).hide().end();

  // Processing
  $( 'form.contactform' ).find( 'ol.blockstyle>li>label' ).not( '.nogx' ).each( function( i ){
    var labelContent = this.innerHTML;


    var labelWidth = document.defaultView.getComputedStyle( this, '' ).getPropertyValue( 'width' );

    var labelSpan = document.createElement( 'span' );
        labelSpan.style.display = 'block';
        labelSpan.style.width = labelWidth;
        labelSpan.innerHTML = labelContent;
    this.style.display = '-moz-inline-box';
    this.innerHTML = "";
    this.appendChild( labelSpan );
  } ).end();

  // Show forms
  $( 'form.contactform' ).show().end();
}