jQuery(document).ready(function($){


	// Work out the position of the search box relative to the OuterBox
	var myTop = 0;
//	myTop += $('#ContentColBox').position().top;
	myTop += $('#ShareBar').position().top;

//	alert(myTop);

	// Work out share height
	var shareHeight = 0;
	shareHeight += $('#ShareBar').outerHeight(true);
	shareHeight += $('#SearchBar').outerHeight(true);

	// Get width and height of background image
	var bgImage = $('#OuterBox').css('background-image');
	bgImage = bgImage.replace(/^url\(\"/,'');
	bgImage = bgImage.replace(/\"\)$/,'');
	var bgDims = bgImage.split("?")[1];
	if(bgDims){
		var bgDimsArray = bgDims.split(",");
		var imWidth = bgDimsArray[0];
		var imHeight = bgDimsArray[1];
		var imPosLeft = $('#OuterBox').outerWidth() - imWidth - 25;
		var offset = 0;
		// Hacky - If the image is bigger than 250px high offset by 40px
		if(parseInt(imHeight) > 250){offset = 40;}
		var imPosTop = myTop - (imHeight / 2) + (shareHeight / 2) - offset;
		// Move the background image
		$('#OuterBox').css('background-position',imPosLeft + 'px ' + imPosTop + 'px');
	}

});