$(document).ready(function(){
	//post link - change background of container
	$('.link .post_box h2 a').hover(function(){
		$(this).parent().parent().css({'background-color' : '#d9cedb'});
	}, function(){
		$(this).parent().parent().css({'background-color' : '#FFFFFF'});
	});
	
	/*
		Better Vimeo Embeds on Tumblr by Matthew Buchanan
		http://matthewbuchanan.name/141302328
	*/
	$("object[data^='http://vimeo.com']").each(function() {
		var parent = $(this).parent();
		var vimeoCode = parent.html();
		var params = "";
		if (vimeoCode.toLowerCase().indexOf("<param") == -1) {
			$("param", this).each(function() {
				params += $(this).get(0).outerHTML;
			});
		}
		var oldOpts = /show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF/g;
		var newOpts = "show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=c31d1a";
		vimeoCode = vimeoCode.replace(oldOpts, newOpts);
		if (params != "") {
			params = params.replace(oldOpts, newOpts);
			vimeoCode = vimeoCode.replace(/<embed/i, params + "<embed");
		}
		parent.html(vimeoCode);
	});
var color = "c31d1a";
  $("object[data^='http://vimeo.com']").each(function() {
    var $obj = $(this);
    var data = $obj.attr("data");
    var temp = data.split("clip_id=")[1];
    var id = temp.split("&")[0];
    var server = temp.split("&")[1];
    var w = $obj.attr("width");
    var h = $obj.attr("height");
    $obj.replaceWith(
      "<iframe src='http://player.vimeo.com/video/"+id+
      "?"+server+"&title=0&byline=0&portrait=0&color="+color+"' "+
      "width='"+w+"' height='"+h+"' frameborder='0'></iframe>"
    );
  });
	/*
		Better YouTube Embeds on Tumblr by Matthew Buchanan
		http://matthewbuchanan.name/261951286
	*/
	$("object").each(function() {
		if ($(this).find("param[value^='http://www.youtube.com']").length > 0) {
			var parent = $(this).parent();
			var youtubeCode = parent.html();
			var params = "";
			if (youtubeCode.toLowerCase().indexOf("<param") == -1) {
				$("param", this).each(function() {
					params += $(this).get(0).outerHTML;
				});
			}
			var oldOpts = /rel=0/g;
			var newOpts = "rel=0&amp;color1=0xFFFFFF&amp;color2=0xFFFFFF";
			youtubeCode = youtubeCode.replace(oldOpts, newOpts);
			if (params != "") {
				params = params.replace(oldOpts, newOpts);
				youtubeCode = youtubeCode.replace(/<embed/i, params + "<embed");
			}
			parent.html(youtubeCode);
		}
	});
	
	var portfolioAlert = "<div class='post'><div class='meta round_box'><h2>Portfolio Update in Progress</h2><p>Details about the projects, roles and agencies below will be coming soon! Current work was created at <a href='http://www.newezra.com/' target='_blank'>New Ezra</a> digital culture agency, but the majority of the work over the years was created while at <a href='http://www.2advanced.com/' target='_blank'>2Advanced Studios</a> and <a href='http://www.blitzagency.com/' target='_blank'>Blitz Agency</a>.<p><em>Updated: Sunday, March 28th at 3:30 PST.</em></p><p class='alert_action'><a href='#'>Close</a></p></div></div>";
	$(".portfolio #alert").html(portfolioAlert);
	$(".portfolio #alert").css({'display' : 'block'});
	$(".portfolio #alert p.alert_action a").click(function() {
		$(this).parent().parent().parent().hide();
		return true;
	})
});