
//this file uses jquery


(function(){

//NameSpace
window.NewMind = window.NewMind || {};
var NewMind = window.NewMind;
NewMind.Enterprise = NewMind.Enterprise || {};


//MOST Specific 
NewMind.Enterprise.MOST = function() {
	
	//private
	/**
	 * Display a random MOSTDidYouKnow
	 * 
	 */
	var MOSTDidYouKnow = function() {
		if($(".MOSTDidYouKnow").length > 0) {
			var MOSTDidYouKnowList = {
				"items" : [
					{"title": "DID YOU KNOW", "description": "The Survey of Visitor Attractions monitors trends in the visitor attraction sector throughout the UK to improve wider understanding of the dynamics of the sector.", "link": "/site/visitor-attraction-surveys", "img": "/images/find_green.gif" },
					{"title": "DID YOU KNOW", "description": "The accommodation occupancy survey is open to all businesses that provide accommodation, ranging from self-catering businesses to one-bedroom B&Bs, to hotels with over 100 rooms.", "link": "/site/accommodation-occupancy-surveys", "img": "/images/find_green.gif" },
					{"title": "DID YOU KNOW", "description": "The quarterly business performance survey is open to all tourism businesses. It is designed to assess general business performance within the tourism industry retrospectively quarter by quarter.", "link": "/site/quarterly-business-performance-surveys", "img": "/images/find_green.gif" },
					{"title": "DID YOU KNOW", "description": "How does the performance of <strong>YOUR</strong> pub measure up?<p>Are you making as much profit from your pub as you would like?</p><p>Are you getting the return from your investment you deserve?</p><p>Do you get as much out of your staff as your competitors get out of theirs?", "link": "/site/performance-improvement-for-pubs", "img": "/images/find_green.gif" }
				] 
			}
			
			var itemToShow = Math.ceil((MOSTDidYouKnowList.items.length - 1) * Math.random());
			var title =  MOSTDidYouKnowList.items[itemToShow].title;
			var description = MOSTDidYouKnowList.items[itemToShow].description;
			var link = MOSTDidYouKnowList.items[itemToShow].link;
			var img = MOSTDidYouKnowList.items[itemToShow].img;
			$(".MOSTDidYouKnow").append('<h2 class="feature">' + title + '</h2><div class="feature"><p>' + description + '</p><p class="featurestrapline">' + '<a href="' + link + '"><img class="button" alt="FIND OUT MORE" src="' + img + '"/></a></p></div>');
		}
	};
	
	
	//public
	return{
		init : function(){
			
			//load up MOSTDidYouKnow control
			MOSTDidYouKnow();

		}
	};
}();

$(document).ready(NewMind.Enterprise.MOST.init);
})();
