$(document).ready(function(){
 	//IE6 hover
 	if(getInternetExplorerVersion() <= 6){
		$("#menu li").hover( function(){ $(this).addClass("over"); }, function(){ $(this).removeClass("over"); });
 	}
 	$("#menu .submenu-ul > li").hover(

 		function() {
			var imgObj = $('a.image', $(this));
			
			if(imgObj.size()) {
				var html = imgObj.html();
			
				if($.trim(html)) {
					var data = html.match(/(.*)\|(.*)/);
            	
					if(data) {
                		var newImg = $('<img>').attr({src : $.trim(data[1]), title : $.trim(data[2]), alt : $.trim(data[2])});
                		imgObj.html('').append(newImg);
            		}
				}
			}
			
 			var subsub_height = $(this).parent().children('.col-2').height();
 			var submenu_height = $(this).parent().height();
			if(subsub_height < submenu_height){
				$(this).children('.subsub').height(submenu_height - 16);
				$(this).parent().height(submenu_height);
			}
			else {
				$(this).parent().height(subsub_height);
				$(this).children('.subsub').height(subsub_height - 16);
			}
 		},

 		function(){
 			//Uncomment if height is not fixed to max
			//$(this).find('.subsub').css('height','auto');
			//$(this).parent().parent().css('height','auto');
 		}
 	);
});
function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).

{
  var rv = -1; // Return value assumes failure.
  if (navigator.appName == 'Microsoft Internet Explorer')
  {
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }

  return rv;
}


