/* DEFINE THE CALLOUT SETS
Each callout is defined in the form
	new Callout(id, title, calltoaction, url, text)
where
	id - the id given to the div the callout sits in (use this id in site.css to define the image associated with the callout)
	title - the text to appear in the callout heading
	calltoaction - the text to appear in the link (do not include the " >>", as this is added automatically)
	url - the url of the page to link to
	text - the main text of the callout, appears below the heading and before the link

Below we put each set of 3 callouts in an array, then one of these sets is picked out randomly and output to the page.
To define a new set, add another array of three Callouts to the array below. */
var callout_sets = [

[new Callout('callout-budget', 'Budget Report', 'Click here for more', '/content/taxcentre_budget/index.html', "Budget Report 2010."),
new Callout('callout-personal', 'Personal Tax Services', 'Click here for more', '/about/ourservices_personaltax.html', "We are the tax specialists. We can provide you with year round tax advice, call us today for a personal tax planning review."),],

[new Callout('callout-aboutus', 'About', 'Click here for more', '/about/index.html', "N.R. Barton & Co. was established as a firm of Chartered Accountants in 1948, and has grown consistently by providing a first class, professional service to owner-managed businesses. From our offices in Wigan we service a wide range of clients throughout the North West and the rest of the U.K."),
	 new Callout('callout-bookkeeping', 'Book Keeping Tutorial', 'Click here for more', '/about/ourservices_bookkeeping01.html', "This tutorial is aimed at people keeping the books for a small business.")],
	
	[new Callout('callout-business', 'Business Services', 'Click here for more', '/about/ourservices.html', "Whether you need help with growing your business or advice on optimising your personal or family finances, we are here to help you get the best results."),
	 new Callout('callout-personal', 'Personal Tax Services', 'Click here for more', '/about/ourservices_personaltax.html', "We are the tax specialists. We can provide you with year round tax advice, call us today for a personal tax planning review."),],
	
	[new Callout('callout-budget', 'Budget Report', 'Click here for more', '/content/taxcentre_budget/index.html', "Budget Report 2010."),
	 new Callout('callout-financial', 'Financial Planning Guide', 'Click here for more', '/content/taxcentre_planning/index.html', "This area of our site contains an important range of personal and business planning guides."),],
	
	[new Callout('callout-aboutus', 'About', 'Click here for more', '/about/index.html', "N.R. Barton & Co. was established as a firm of Chartered Accountants in 1948, and has grown consistently by providing a first class, professional service to owner-managed businesses. From our offices in Wigan we service a wide range of clients throughout the North West and the rest of the U.K."),
new Callout('callout-financial', 'Financial Planning Guide', 'Click here for more', '/content/taxcentre_planning/index.html', "This area of our site contains an important range of personal and business planning guides."),],

[new Callout('callout-business', 'Business Services', 'Click here for more', '/about/ourservices.html', "Whether you need help with growing your business or advice on optimising your personal or family finances, we are here to help you get the best results."),
 new Callout('callout-bookkeeping', 'Book Keeping Tutorial', 'Click here for more', '/about/ourservices_bookkeeping01.html', "This tutorial is aimed at people keeping the books for a small business.")],

];



// the Callout object
function Callout(id, title, calltoaction, url, text) {
	this.id = id;
	this.title = title;
	this.text = text;
	this.calltoaction = calltoaction;
	this.url = url;
	this.classes = ['index-callout'];
}

Callout.prototype.output = function() {
	var html = '<div id="'+this.id+'" class="'+this.classes.join(' ')+'">';
	html += '<h2>'+this.title+'</h2>';
	html += '<p class="callout-intro">'+this.text+'</p>';
	html += '<p class="calltoaction"><a href="'+this.url+'">'+this.calltoaction+' &gt;&gt;</a></p></div>';
	return html;
};

Callout.prototype.addClass = function(classname) {
	this.classes.push(classname);
};

// choose a random set (with the current second)
var now = new Date();
var rand = now.getSeconds() % callout_sets.length;
var callout_set = callout_sets[rand];

// generate output
var output_html = '';
for(var i=0, callout; (callout = callout_set[i]); i++) {
	callout.addClass('callout'+(i+1));
	output_html += callout.output();
}

// write to document
window.onload = function() { document.getElementById('index-callouts').innerHTML = output_html; }

