$(document).ready(function() {
   $("div#promoted_article").slideView()
   $("div#focus .svw").slideView()
   $("div#focus .stripViewer").height(500);
   show_article_arrows();
   set_blocks_height();
   set_top_articles_event();
});

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

function show_article_arrows(){
  if($(window).width() < 1073){
    $("#arrow-prev").hide();
    $("#arrow-next").hide();
  }else{
    $("#arrow-prev").fadeTo("slow", 0.5);
    $("#arrow-next").fadeTo("slow", 0.5);
  }
}

function set_equal_max_height(block1, block2){
  if(block1.height() < block2.height()){
    block1.height(block2.height())
  }else{
    block2.height(block1.height())
  }
}

function set_blocks_height(){
  //if frontpage
  if($("#promoted-articles")){
    set_equal_max_height($("#promoted-articles"), $("#unpromoted-articles"));
    set_equal_max_height($("#category-0"), $("#category-1"));
    set_equal_max_height($("#category-2"), $("#category-3"));
    set_equal_max_height($("#category-4"), $("#category-5"));
    
  }
}

function set_top_articles_event(){
  $(function() {
		$("#top-articles .tabs").tabs({
			event: "mouseover"
		});
	});
}
