var ns=(document.layers);
var ie=(document.all);
function makeRoundSet(selector,t){
  jQuery(selector).css('position','relative');
  jQuery(selector).append('<b class="lt"></b><b class="rt"></b><b class="lb"></b><b class="rb"></b>');
  jQuery(selector).children('b').css('background-image','url('+template_url+'/images/rc10_'+t+'.gif)');
  if(ie && selector!='div#calendar_wrap'){
    jQuery(selector).children('b.rb').css('bottom','-1px');
    jQuery(selector).children('b.lb').css('bottom','-1px');
  }
}
function init_makeRound() {
  makeRoundSet('div#wrapper',3);
  makeRoundSet('div#calendar_wrap',2);
  makeRoundSet('h2.posttitle',1);
  makeRoundSet('div.commentbox',1);
  makeRoundSet('div.postrefer',1);
  if(ie) {
    jQuery('b.rt').css('right','-1px');
    jQuery('b.rb').css({right:'-1px'});
  }
}
function init_next() {
  jQuery('.next').each(function(i){jQuery(this).attr('href','#'+jQuery('.post:eq('+(i-1)+')').attr('id'));});
  jQuery('.next:first').removeClass('scrollto').attr('href','#').unbind();
  jQuery('.prev').each(function(i){jQuery(this).attr('href','#'+jQuery('.post:eq('+(i+1)+')').attr('id'));});
  jQuery('.prev:last').removeClass('scrollto').attr('href','#').unbind();
}
function img_max_width(max_width) {
  if(ie) {
    max_width = max_width || jQuery('#content').width();
    jQuery('#content .postentry img').filter(function(){return jQuery(this).width()>max_width;}).css('width','100%');
  }
}
function init_commentlist() {
  jQuery('#commentlist .commentbox').hover(function(){
    jQuery(this).css('background','#f2f9fc');},function(){
    jQuery(this).css('background','#f7f7f7');}
  );
}
jQuery(document).ready(function() {
  init_makeRound();
  img_max_width();
  init_next();
  init_commentlist();
});

