var counter = 0;
var currentDiv;
$(document).ready(function(){
jQuery.each( $('.menu li'), function() { 
	if( counter % 3 == 0 ){
		$( this ).parent().append( "<div id='div" + this.id + "' class='headerOrganizer'>" );
		$( '#div' + this.id ).insertBefore( '#' + this.id );
		$( '#div' + this.id ).html( $( this ) );
		currentDiv = '#div' + this.id;
	} else {
		$( currentDiv ).append( $(this) );
	}
	counter++;
});

var browserUserAgent = navigator.userAgent;
if( browserUserAgent.indexOf( "MSIE 7.0" ) != -1 ) {
	$('#lang_sel_list UL').css( 'margin-top', '-15px' );
}

$('.menu-item').hover( 
	function() {
		if( !$(this).hasClass( 'current-page-ancestor' ) ) {
			$($(this).children()[0]).css( 'color', '#E72E22' );
		}
	}, 
	function() {
		if( !$(this).hasClass( 'current-page-ancestor' ) && !$(this).hasClass( 'current-menu-item' ) ) {
			$($(this).children()[0]).css( 'color', '#FFFFFF' );
		}
	} 
);

$('input[type="submit"]').hover( 
	function(){
		$(this).css( 'color', '#DCC989' );
	}, 
	function(){
		$(this).css( 'color', '#FFFFFF' );
	} 
);
});
