/*
Note if we change the DOM or styles we should call curvyCorners.redraw().
*/
var syn = {
	masthead: {
		interval: 4500, //5k = 5sec
		data: null,
		position: 0,
		rotate: function(){
			if(syn.masthead.data != null){
				var next = syn.masthead.position+1;
				var data = syn.masthead.data;
				if( ! data[next]) next = 0;
				syn.masthead.position = next;
			
				jQuery('#masthead_img img').attr('src', data[next]['img']);
				jQuery('#masthead_quote').text(data[next]['text']);
				jQuery('#masthead_source').text(data[next]['source']);
				
				// Let IE round corners again (FUIE) // causes errors!?
				// if(curvyCorners && curvyCorners.redraw) curvyCorners.redraw();
				
				syn.masthead.timout = window.setTimeout(syn.masthead.rotate, syn.masthead.interval);
			}
		},
		timeout: null
	}
};
$(function(){
	var masthead = $('#masthead');
	if (masthead.size() > 0){
		syn.masthead.data = eval(masthead.attr('data-rotate'));
	}	
	window.setTimeout(syn.masthead.rotate, syn.masthead.interval);
});
