function fixthumbs() {

  if ($(window) .width() <= 1167) {
    $("#media").addClass("small");
    $("#mholder").addClass("small");

  } else {
	$("#mholder").removeClass("small");
    $("#media").removeClass("small");
  }

  if ($(window) .width() <= 1024) {
    resetLayout("1024px");
    resizeContent();

    $(".post").addClass("oblue");

    $(".vidholder").css({width:"139px"});
    
    $(".post").css({
      width: "135px"
    });

  } else {

    if ($(window).width() >= 1024) {
      resetLayout("100%");
      resizeContent();

    if ($(".post").hasClass("oblue")) {
      $(".post").removeClass("oblue")
    }

    $(".post").attr("style", "");

  } else {

      $("#wrap").css({
        width: "",
        margin: "0 0px"
      });
      resizeContent();
    }
  }
}

function resetLayout(a) {
  $("#wrap").css({
    width: a,
    margin: "auto"
  });
}

function resizeParent(b, a) {
  $("div." + b).width($("div." + b).parent().width() - a);
}

function resizeBlockContent(c) {
  var a = $("div." + c + " div.block ul li.vidholder:visible").children().width() + 6;
  averageThumb = parseInt($("div." + c).width() / a);
  var b = 100 / averageThumb + "%";
  $("div." + c + " div.block ul li.vidholder").width(b);
}

 
  function resizeContent (){
    resizeParent ("flexBlk" , 0);
    resizeBlockContent ("flexBlk");
    }

    $(document).ready(function() {
    fixthumbs ();
    
    jQuery(".th").hover(function() {
		var myRel = jQuery(this).attr('rel');
		var myHtml = jQuery('#vidInfo' + myRel).find('#tagContainer' + myRel).html().toString();

		if (myHtml.length == 0) {
			//jQuery("#tags" + myRel)
			jQuery.get('/vidtags.php?id=' + myRel, {}, function(r) {
				jQuery("#tagContainer" + myRel).html(r);
			});
			
//			jQuery('#tags' + myRel).html('<strong>Tags:</strong>&nbsp;');
		}
	}, function() {
		//
	});
	
    });

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

