document.createElement('header');
document.createElement('footer');
document.createElement('section');
document.createElement('article');
document.createElement('aside');
document.createElement('nav');
var $j = jQuery.noConflict();
jQuery.fn.equalHeightify = function() {
        var highest = 0; // keep track of the greatest height
        $j(this).each(function() { // for each element
            if ($j(this).height() > highest) { // compare heights
                highest = $j(this).height();
            }
        });
		//console.log(highest);
        $j(this).height(highest); // set new height
    };
jQuery.fn.wrapFirstWord = function (numWords) { 
    var node = this.contents().filter(function () { 
            return this.nodeType == 3 
        }).first(),
        text = node.text(),
        first = text.split(" ", numWords).join(" ");

    if (!node.length)
        return;

    node[0].nodeValue = text.slice(first.length);
    node.before('<span>' + first + '</span>');
};


$j(document).ready(function() {
	
	
	$j('footer.container_16 div section.widget').equalHeightify();
	
	
	$j('aside section h3.widgettitle').each(function(i){
		$j(this).wrapFirstWord(1);
		//console.log(i);
	});
	
	
	if(!$j.support.opacity === false) {
		$j('section.twitter:eq(0)').before('<section class="widget twitter-teaser"><h3 class="widgettitle">twitter in the house</h3><ul class="hl_recent_tweets twitter-list"></ul></section>');
		$j('section.twitter').each(function(index){
			var listItem = $j(this).find("ul").html();
			var title = $j('section.twitter:eq(0) h3.widgettitle span').text().trim();
			//console.log(title);
			$j('section.twitter-teaser ul.twitter-list').append(listItem);
			if(title === "vance") {
				//console.log("Match");
				$j('section.twitter-teaser ul.twitter-list li:eq(' + index + ') p').prepend('<a href="http://twitter.com/lloydvance_nfl" class="' + title + '-twitter twitter-link">@lloydvance_nfl</a><br />');	
				//$j(this).append('<a href="http://wmmr.com" class="' + title + '-twitter">@lloydvance_nfl</a>');
			} else if (title === "lombardo") {
				$j('section.twitter-teaser ul.twitter-list li:eq(' + index + ') p').prepend('<a href="http://twitter.com/MattLombardoPHL" class="' + title + '-twitter twitter-link">@mattlombardoPHL</a><br />');	
			}
			
			$j('section.twitter:eq(0)').remove();
		});
		$j('section.twitter-teaser h3.widgettitle').wrapFirstWord(1);
		$j(".recent-videos ul li").hover(function(){
			var videoText = $j(this).find(".video-description p").text();
			
			if (videoText !== "") {
				$j(".recent-videos header p").text(videoText);
			} else {
				$j(".recent-videos header p").text("Take a look at the most recently added videos on the site ranging from player interviews and game recaps to Eagle &amp; NFL news -- plus, much more.");
			}
			
		}, function() {
			$j(".recent-videos header p").text("Take a look at the most recently added videos on the site ranging from player interviews and game recaps to Eagle &amp; NFL news -- plus, much more.");
				
		});
	}
});





/* INNER SHIV */
//http://jdbartlett.com/innershiv/
// http://bit.ly/ishiv | WTFPL License
window.innerShiv=function(){function h(c,e,b){return/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i.test(b)?c:e+"></"+b+">"}var c,e=document,j,g="abbr article aside audio canvas datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video".split(" ");return function(d,i){if(!c&&(c=e.createElement("div"),c.innerHTML="<nav></nav>",j=c.childNodes.length!==1)){for(var b=e.createDocumentFragment(),f=g.length;f--;)b.createElement(g[f]);b.appendChild(c)}d=d.replace(/^\s\s*/,"").replace(/\s\s*$/,"").replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"").replace(/(<([\w:]+)[^>]*?)\/>/g,h);c.innerHTML=(b=d.match(/^<(tbody|tr|td|col|colgroup|thead|tfoot)/i))?"<table>"+d+"</table>":d;b=b?c.getElementsByTagName(b[1])[0].parentNode:c;if(i===!1)return b.childNodes;for(var f=e.createDocumentFragment(),k=b.childNodes.length;k--;)f.appendChild(b.firstChild);return f}}();
