if( document.addEventListener ) { 
  document.addEventListener( 'DOMContentLoaded', cmxform, false );
} else {
	$(addReq);
}

function addReq() {

  	$('li.req label').each(function(i) {
        $(this).append( "<em>*</em>" );
    });
}

function cmxform(){
  // Hide forms
 // $( 'form#mailform' ).hide().end();

  // Processing
  $( 'form#mailform' ).find( 'label' ).not( '.nocmx' ).each( function( i ){
    console.log(this);
    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();

  	$('li.req label span').each(function(i) {
        $(this).append( "<em>*</em>" );
    });


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