
/*----BACKGROUND IMAGE ------------------------------------------------*/

(function($){
	//Resize image on ready or resize
	$.fn.supersize = function() {	
		//Invoke the resizenow() function on document ready
		$(document).ready(function() {
			$('#supersize').resizenow(); 
		});
		//Invoke the resizenow() function on browser resize
		$(window).bind("resize", function() {
    		$('#supersize').resizenow(); 
		});
	};
	//Adjust image size
	$.fn.resizenow = function() {
		//Define starting width and height values for the original image
		var startwidth = 1440;  
		var startheight = 956;
		//Define image ratio
		var ratio = startheight/startwidth;
		//Gather browser dimensions
		var browserwidth = $(window).width();
		var browserheight = $(window).height();
		//Resize image to proper ratio
		if ((browserheight/browserwidth) > ratio) {
		    $(this).height(browserheight);
		    $(this).width(browserheight / ratio);
		    $(this).children().height(browserheight);
		    $(this).children().width(browserheight / ratio);
		} else {
		    $(this).width(browserwidth);
		    $(this).height(browserwidth * ratio);
		    $(this).children().width(browserwidth);
		    $(this).children().height(browserwidth * ratio);
		}
		//Make sure the image stays center in the window
		$(this).children().css('left', (browserwidth - $(this).width())/2);
		$(this).children().css('top', (browserheight - $(this).height())/2);
	};
})(jQuery);

$(document).ready(function() {
	//Funtion to create the jQuery carousel tabs - The rotating images showing previous clients work
	$(function() {
		$("#tabs").tabs({event:"mouseover"}).tabs('rotate', 10000, true);
	});
	//Invoking the supersized function on the div with id - supersize. It is the div that contains the large background image
	$("div#supersize").supersize();
});



// FANCY BOX /////////////////////////////////////////////////////////////////////

$(document).ready(function(){

var veryfancy = '.post a:has(img)[href$=".bmp"],.post a:has(img)[href$=".gif"],.post a:has(img)[href$=".jpg"],.post a:has(img)[href$=".jpeg"],.post a:has(img)[href$=".png"],.post a:has(img)[href$=".BMP"],.post a:has(img)[href$=".GIF"],.post a:has(img)[href$=".JPG"],.post a:has(img)[href$=".JPEG"],.post a:has(img)[href$=".PNG"]';
	
$(veryfancy).addClass("fancybox").attr("rel","fancybox");

$("a.fancybox").fancybox({
		    'autoScale': true,
			'padding': 0,
			'overlayShow': true,
			'overlayColor': "#000",
			'overlayOpacity': 0.6,
			'speedIn' : 400,
			'speedOut' : 300,
			'transitionIn'	:	'elastic',
		    'transitionOut'	:	'elastic',
		    'easingIn'	:	'swing',
		    'easingOut'	:	'swing',
			'enableEscapeButton': true,
			'showCloseButton': true,
			'hideOnOverlayClick': true,
			'hideOnContentClick': false,
			'width' : 600,
			'height' : 500,			
			'centerOnScroll': true
	});
});


// TABLES//////////////////////////////////////////////////

$(document).ready(function() {
	$("tr:odd").addClass("odd");
});


// TWITTER FEED//////////////////////////////////////////////////

$(document).ready(function() {

$("#twitter-feed p").getTwitter({
		userName: "yesitsamovie",
		numTweets: 1,
		loaderText: "Loading tweets...",
		showHeading: false,
		showProfileLink: false,
		showTimestamp: true
	});
});
