
$(document).ready(function() { 

// footer expandable link lists
  $('div.p:eq(1)> ul li.hideli').hide();
  $('div.p:eq(1)> ul a.more').click(function() {
	$('div.p:eq(1)> ul li.hideli').slideToggle('fast');
	 $('div.p:eq(1)> ul li.morelink').remove();
  });


  $('div.p:eq(2)> ul li.hideli').hide();
  $('div.p:eq(2)> ul a.more').click(function() {
	$('div.p:eq(2)> ul li.hideli').slideToggle('fast');
	 $('div.p:eq(2)> ul li.morelink').remove();
  });


  $('div.p:eq(3)> ul li.hideli').hide();
  $('div.p:eq(3)> ul a.more').click(function() {
	$('div.p:eq(3)> ul li.hideli').slideToggle('fast');
	 $('div.p:eq(3)> ul li.morelink').remove();
  });

// fade in & out then scroll to top
$('.backtotop').click(function(){
$("body,#container").fadeTo(1000, 0, function() {
            $('html,body').animate({scrollTop: top}, 0);
}).fadeTo(1000, 1); 
$("a.backtotop").each(function(){this.blur();});
	});


// comment live preview
  $('#comment').one('focus',function() {
	$('#comment').after('<div id="preview-box"><label for="comment-by">Live Comment Preview</label><div id="live-preview"></div></div>');
  });
  var $comment = ''; // that's two single quotation-marks at the end
  $('#comment').keyup(function() {
	$comment = $(this).val();
	$comment = $comment.replace(/\n/g, "<br />").replace(/\n\n+/g, '<br /><br />').replace(/(<\/?)script/g,"$1noscript");
	$('#live-preview').html( $comment );
  });


// more link make visible
$("li.morelink").css("display","block");

function equalHeight(group) {
    tallest = 0;
    group.each(function() {
        thisHeight = $(this).height();
        if(thisHeight > tallest) {
            tallest = thisHeight;
        }
    });
    group.height(tallest);
}

jQuery.fn.equalHeights=function() {
var maxHeight=0;
this.each(function(){
 if (this.offsetHeight>maxHeight) {maxHeight=this.offsetHeight;}
});
this.each(function(){
 $(this).height(maxHeight + "px");
 if (this.offsetHeight>maxHeight) {
  $(this).height((maxHeight-(this.offsetHeight-maxHeight))+"px");
 }
});
};
$("p.eql").equalHeights();
$(".snip h2").equalHeights();
//$("#text, #sidebar").equalHeights();



if ($.browser.version = jQuery.browser.msie &&
    parseInt(jQuery.browser.version) == 6) {
     
  }else{
$("#sidebar").fadeTo('fast', 0.4);

$("#sidebar").hover(function(){
$(this).stop().fadeTo('fast', 1);
$("#text, .threesnips").stop().fadeTo('fast', 0.4);
},function(){
$(this).stop().fadeTo('fast', 0.4);
$("#text, .threesnips").stop().fadeTo('fast', 1);
});
  }




});

