Adjust Menu Width

by Marventus

HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>www.sublimationpressworks.com</title>
<meta name="description" content="" />
<link rel="alternate" type="application/rss+xml" title="Sublimation Pressworks RSS Feed" href="http://www.sublimationpressworks.com/feed/" />
<link rel="alternate" type="application/atom+xml" title="Sublimation Pressworks Atom Feed" href="http://www.sublimationpressworks.com/feed/atom/" /> 
<link rel="pingback" href="http://www.sublimationpressworks.com/xmlrpc.php" />

<link rel="stylesheet" href="http://www.sublimationpressworks.com/wp-content/themes/piano-black/style.css" type="text/css" media="screen" />
<link rel="stylesheet" href="http://www.sublimationpressworks.com/wp-content/themes/piano-black/comment-style.css" type="text/css" media="screen" />

<!--[if lt IE 7]>
<script type="text/javascript" src="http://www.sublimationpressworks.com/wp-content/themes/piano-black/js/iepngfix.js"></script>
<link rel="stylesheet" href="http://www.sublimationpressworks.com/wp-content/themes/piano-black/ie6.css" type="text/css" media="screen" />
<![endif]--> 

<style type="text/css">
.post img, .post a img { border:1px solid #222; padding:5px; margin:0;  background:#555; }
.post a:hover img { border:1px solid #849ca0; background:#59847d; }
.post img.wp-smiley { border:0px; padding:0px; margin:0px; background:none; }
</style>

 
<link rel='stylesheet' id='sharedaddy-css'  href='http://www.sublimationpressworks.com/wp-content/plugins/jetpack/modules/sharedaddy/sharing.css?ver=0.3.1' type='text/css' media='all' />
<script type='text/javascript' src='http://www.sublimationpressworks.com/wp-includes/js/jquery/jquery.js?ver=1.7.2'></script>
<link rel="EditURI" type="application/rsd+xml"...

JavaScript

$(window).load(function() {
    $(function() {
        var cont = $("#contents").width();
        var li = "ul.menu > li";
        var liN = jQuery(li).length;
        var liP = 0;
        var menW = $("ul.menu").width();
        var fix = $("#pngfix-left").width() + $("#pngfix-right").width();
        var cal = (cont - fix - menW) / liN / 2;
        var newP = 0;
        if ( cal > 1 ) {
            $(li).each(function(){
                if( $(this).css("padding-left").replace("px",'') > liP ) {
                    liP = parseFloat( $(this).css("padding-left").replace("px",'') );
                }
                newP = liP + cal;
                $(this).css({"padding-left":newP+"px","padding-right":newP+"px"});
            });
            $("#pngfix-left").css('float','none');           
        }
    });
})(jQuery);