$(function(){

  $("#commentform").hide();

  /*FIX PNGS FOR IE6*/
        $('#s1').ifixpng(); $('#s2').ifixpng(); $('#s3').ifixpng(); $('#s4').ifixpng();
        $('.s1').ifixpng(); $('.s2').ifixpng(); $('.s3').ifixpng(); $('.s4').ifixpng();
        $('.s5').ifixpng(); $('.s6').ifixpng(); $('.s7').ifixpng(); $('.s8').ifixpng();
        $('.s9').ifixpng(); $('.s10').ifixpng(); $('.s11').ifixpng(); $('.s12').ifixpng();





/*  if($("#main.corkboard").width() >= 980) {
    $("#main.corkboard").css("width","980px");
  }
  if($("#main.corkboard p.cbtop").width() >= 980) {
    $("#main.corkboard p.cbtop").css("width", "980px");
  }
  if($("#main.corkboard p.cbfoot").width() >= 980) {
    $("#main.corkboard p.cbfoot").css("width", "980px");
  }
  if($(".corkboardwrapper").width() >= 980) {
    $(".corkboardwrapper").css("width", "980px");
  } */

   $("#addcomments").click(function(event){
     $("#commentform").slideDown();
     $("#mComments").focus();
     $("#addcomments").hide();
     event.preventDefault();
   });

   $("#btncancelcomments").click(function(event){
   $("#addcomments").show();
   $("#commentform").slideUp();
    $("#mComments").val("");
    $("#tForename").val("");
    $("#tSurname").val("");
   });

  smartColumns();


});

function smartColumns() {
   $("ul.bookcolumn").css({'width':'100%'});
   var colWrap = $("ul.bookcolumn").width();
   var colNum = Math.floor(colWrap/290);
   var colFixed = Math.floor(colWrap/colNum);
   $("ul.bookcolumn").css({'width':colWrap});
   $("ul.bookcolumn li").css({'width':colFixed});
}

$(window).resize(function() {
  smartColumns();
});