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

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

function registrationform(){

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

  // Processing
  $( 'form.registrationform' ).find( '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 = null;
    this.appendChild( labelSpan );
  } ).end();

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

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

function commentsform(){

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

  // Processing
  $( 'form.commentsform' ).find( '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 = null;
    this.appendChild( labelSpan );
  } ).end();

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

$(document).ready(function(){
        $(document).pngFix();
        $("#newsletteremail").clearfocus();
        $("#password").clearfocus();
        $("form.registrationform ol li:eq(3)").css("padding-bottom","30px");

        $('a.youtubin').youtubin();

});

