/**
 * Window onload function to apply HTML and CSS correction on navigators
 * That have a different understanding than Mozilla Firefox.
 *
 * @author Loops <pierrot at nvision dot lu>
 */

jQuery(document).ready( function(){

  // Correction of rounded border on IE and Opera
  // Add top and bottom element to right boxes
  if( jQuery.browser.msie || jQuery.browser.opera )
  {
    jQuery('.right-box.gray').prepend(jQuery('<div></div>').addClass('top')).append(jQuery('<div></div>').addClass('bottom'));
    jQuery('.right-box.blue').prepend(jQuery('<div></div>').addClass('top')).append(jQuery('<div></div>').addClass('bottom'));
  }

  // Correction of line-height on big-round-link on Mozilla with Mac
  if( jQuery.browser.mozilla && window.navigator.userAgent.toLowerCase().indexOf( 'win' ) === -1 )
  {
    //jQuery('.big-round-link').css({'line-height':'46px'});
  }

  // Multiple CSS correction
  if( jQuery.browser.msie )
  {
    if( parseInt(jQuery.browser.version) <= 7 )
    {
      // Pseudo-class :before on read more link
      jQuery('.read-more-link').prepend('&gt; ');

      // Pseudo-class :after on round link
      jQuery('.round-link').each( function(){ jQuery(this).html(jQuery('<span></span>').addClass('inner').append(jQuery(this).html()) ); } );
      jQuery('.big-round-link').each( function(){ jQuery(this).html(jQuery('<span></span>').addClass('inner').append(jQuery(this).html()) ); } );

      // Pseudo-class :before on block
      //jQuery('.block').before(jQuery('<div></div>').addClass('clear'));

      // Table display on partners
      //var jTRow = jQuery('<tr></tr>');
      //var jTable = jQuery('<table></table>').attr({'id':'partners'}).append(jQuery('<tbody></tbody>').append(jTRow));
      //jQuery('#partners').children().each( function(){ jTRow.append( jQuery('<td></td>').append(jQuery(this).html()) ); } );
      //jQuery('#partners').replaceWith(jTable);

/*      if( parseInt(jQuery.browser.version) <= 6 )
      {
        // Emulate :first-child pseudo class
        jQuery('ul li:first-child').addClass('first-child');

        // Change background PNG image in real PNG imgage and apply :hover effect 
        jQuery('#header a').each( function(){
          // Append span around content
          jQuery(this).html( jQuery('<span></span>').append(jQuery(this).html()) );
          // Append image
          jQuery(this).prepend( jQuery('<img />').attr({'src':jQuery(this).css('background-image').replace(/(^url\(")|("\))$/g,'')}) );
          // Unset background
          jQuery(this).css({'background-image':'none'});
          // Bind effects
          jQuery(this).bind('mouseenter mouseleave', function(e){ $(this).toggleClass('over'); });
        } );


        // Change background PNG image in real img and apply :hover effect
        jQuery('#header ul li a').each( function(){
          // Append image into span because of vertical-align CSS correction
          jQuery(this).prepend( jQuery('<span></span>').append(jQuery('<img />').attr({'src':jQuery(this).css('background-image').replace(/(^url\(")|("\))$/g,'')})) );
          // Unset background
          jQuery(this).css({'background-image':'none'});
          // Bind effects
          jQuery(this).bind('mouseenter mouseleave', function(e){ $(this).toggleClass('over'); });
        } );

        jQuery('.submit').bind('mouseenter mouseleave', function(e){ $(this).toggleClass('over'); });

        // Append png transparency behavior on PNG images
        //jQuery('img[src$=.png]').each( function(){ this.style.behavior = 'url("' + virtualRoot + 'css/behaviors/pngtransparency.htc")'; } );
        jQuery('img[src$=.png]').each( function(){ this.style.behavior = 'url("' + virtualRoot + 'css/behaviors/pngtransparency.htc")'; } );

        // Apply correction onbottom calculation (expression seems to not work on bottom calculation for this design)
        jQuery('#broadband .cross-list').css({'top':(jQuery('#broadband .cross-list').parent().height()-jQuery('#broadband .cross-list').height()-18)+'px'});
       // jQuery('#copyright').css({'top':(jQuery('#copyright').parent().height()+65+86-jQuery('#copyright').height()-14)+'px'});
        jQuery('#onlimits').css({'top':(jQuery('#onlimits').parent().height()-jQuery('#onlimits').height())+'px'});
      } */
    }
  }

} );