/* Fancy JavaScript h4x */
$(document).ready(uiBindings);
$(document).ready(fixTheWorldOfWebDevelopment);
$(document).ready(ffFormFix);
/*
if (document.addEventListener)
    document.addEventListener('DOMContentLoaded', uiBindings, false);
  */  
function uiBindings() {
    $('#mLBL').bind('mouseenter', function() {$('#menuLeftBorder').attr('src', $('#baseDir').html()+'/frontend/img/menu/menuLeftBorderHover.png');});
	$('#mLBL').bind('mouseleave', function() {$('#menuLeftBorder').attr('src', $('#baseDir').html()+'/frontend/img/menu/menuLeftBorder.png');});
	
	$('#mRBL').bind('mouseenter', function() {$('#menuRightBorder').attr('src', $('#baseDir').html()+'/frontend/img/menu/menuRightBorderHover.png');});
    $('#mRBL').bind('mouseleave', function() {$('#menuRightBorder').attr('src', $('#baseDir').html()+'/frontend/img/menu/menuRightBorder.png');});

    
    $('a.localTTI').cluetip(
        {local: true, 
         positionBy: 'mouse',
         hoverIntent: false,
         fx: {open: 'fadeIn', speed: 'fast'}
         });
    
}
    
function fixTheWorldOfWebDevelopment() {
    /* jQuery dimensions plugin benötigt */    
    cwH = $('#contentWrapper').height();
    sbH = $('#sideBar').height();
    
    $('#body .container').css('height', Math.max(400, (Math.max(cwH, sbH) + 10))+'px');
}
    
function ffFormFix() {
    $('form.sStyle').hide().end();
    
    $('form.sStyle').find('fieldset ol li label').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();
    
    $('form.sStyle').show().end();
}