////
// Document Ready
//
$(document).ready(function() {
	
	
	////
	// make the background fit
	//
	//$('#bg').backgrounder();
	// You need to specify the size of your background image here (could be done automatically by some PHP code)
	//	var FullscreenrOptions = {  width: 1321, height: 807, bgID: '#bg' };
	// This will activate the full screen background!
//	jQuery.fn.fullscreenr(FullscreenrOptions);
	
	
	
	
	
	
////
// add '_blank' to external links
//
$('a[href^="http"]:not([href*="'+location.hostname+'"], .youtube)').each(function() {
    var orgTitle = $(this).attr("title");
    
    $(this).attr({'target': "_blank", 'title': orgTitle+" [new window]"});
    
        if ($(this.parentNode).attr("id") !== 'logoholder'){
    if($(this).parent('.feat').length)
    {
    	$(this).after('<img class="out" src="pixels/external-link-min-inverse.png" alt="External Link (Will open in a new window)" width="7" height="7" />');
    }
    else
    {
        $(this).after('<img class="out" src="pixels/external-link-min.png" alt="External Link (Will open in a new window)" width="7" height="7" />');
    }
        }
});

////
// add 'target="_blank"' to links to PDFs
//
$('a[href$=".pdf"]').each(function() {
    var orgTitle = $(this).attr("title");
    
    $(this).attr({'target': "_blank", 'title': orgTitle+" [.PDF]"});
    $(this).addClass('pdf');
});
	
	
	
	////
	// embed project youtube videos
	//
	if($('#projects').length)
	{
	    $('a.youtube').click(function(event) {
	    	event.preventDefault();
	    }).youtubin();
	    
	}
	
	
	/////
	// vidlist changer
	//
	if($('.vid').length)
	{
		$('.vidlist a').click(function(event) {
			event.preventDefault();
			$(this).parents('.vid').find('.youtube').attr('href', $(this).attr('href')).youtubin();
			$('.vidlist a').removeClass('active');
			$(this).addClass('active');
		});
	}
	
});




