
$(document).ready(function() {


var maxsize = 100;

$(".comment p.message a.fancy img").each(function() {
    var t = $(this);
    var maxdim = Math.max(t.width(), t.height());
    if (maxdim > maxsize) {
        t.css({
            width: t.width() / 2,
            height: t.height() / 2
        });
    }
});

var max_size_mini = 200;
$(".mini a.fancy img").each(function(i) {
  if ($(this).height() > $(this).width()) {
    var h = max_size_mini;
    var w = Math.ceil($(this).width() / $(this).height() * max_size);
  } else {
    var w = max_size_mini;
    var h = Math.ceil($(this).height() / $(this).width() * max_size);
  }
  $(this).css({ height: h, width: w });
});	





$('a[href=#top]').click(function(){
	$('html, body').animate({scrollTop:0}, 'slow');
	return false;
});
$('a[href=#bottom]').click(function(){
	$('html, body').animate({
		 scrollTop: $(document).height()
	 },
	 1500);
	return false;
});
$(function(){
	$("div.tab_container_view .tab_content_view").hide();


	if($.cookie('active_view') == null)
	{
	$("div.tab_container_view .tab_content_view:first").show();
	$("ul.grid_list li:first").show();
	}
	else
	{
	$($.cookie('active_view')).show();
	}

	//Default Action
	
	//On Click Event
	$("ul.grid_list li").click(function() {
		$("div.tab_container_view .tab_content_view").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		$.cookie('active_view', $(this).find("a").attr("href"), { path: '/', expires: 10 });
		return false;
	});
	});
});
