//iphone redirect
if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
  location.href='';
}

$.fn.reorder = function() {
 
  function randOrd() { return(Math.round(Math.random())-0.5); }
 
  return($(this).each(function() {
    var $this = $(this);
    var $children = $this.children();
    var childCount = $children.length;
 
    if (childCount > 1) {
      $children.remove();
 
      var indices = new Array();
      for (i=0;i<childCount;i++) { indices[indices.length] = i; }
      indices = indices.sort(randOrd);
      $.each(indices,function(j,k) { $this.append($children.eq(k)); });
      $("#feat_list a").show();
    }
  }));  
}


$(document).ready(function() {
	
  //check if safari - if so, add a body class to change base font size
  if ($.browser.safari) {
   $('body').addClass('safari');
  }
    
 
  


  //homepage blogs
  //-----------------
  var recent_blog = $("#blog_selector").attr("class");
  var base_height = $("#blogs").children('#' + recent_blog).height();
  
  $("#blogs div").not('#' + recent_blog).hide();
  $("#blogs").children('#' + recent_blog);
  $("#blogs").css("height", base_height);
  $("#three_descriptions").children("." + recent_blog).addClass('current');
  $('#three_descriptions div').hover(
      function () {
	
		if($(this).hasClass("current") == false){
	
	  		var hover_blog = $(this).attr("class");

  			$("#blogs").stop();	
	  		$("#blogs div:visible").css('position','absolute').hide() 
			$("#three_descriptions div.current").not('.' + hover_blog).removeClass("current");

			$('#' + hover_blog).css({
				position: "absolute",
				left: "-10000px",
				height: "auto",
				display: "block"
				}).show(function() {
					
				 	var blog_height = $('#' + hover_blog).height();
			        if(blog_height == 0){
						var blog_height = 500;
					}
					$("#blogs").animate({height: "" + blog_height + "px"}, 650);	
					$('#' + hover_blog).css({left:"0px"});							
				});

				$('#' + hover_blog + " .posts").hide().fadeIn(650);
				$('#' + hover_blog + " .posts li").hide().fadeIn(650);
				$('#' + hover_blog + " .comments").hide().fadeIn(650);
			$(this).addClass("current");
		}

      }, 
      function () { }
    );
  
  //homepage blogs
  //------------------  



  
});//doc ready




