/*! NZC News v2 <http://nvinteractive.co.nz>
	Copyright (c) NV Interactive
	
	References:
		utilities.2.1.js
		swfobject.js
		jquery-1.2.6.js
		
	Release Notes:
		2.0
		-- rewrote for jQuery
		
*/

nzc_featured_news = function(){

	var init = function(){		
		$(".featured_news").each(setupNewsPanel);
	}
	
	var setupNewsPanel = function(){
			
			var w = $(this).width();
			var h = $(this).height();
			
			var bufferColor = $(this).css("color");	
			bufferColor = new RGBColor(bufferColor).toHex();
			
			var newsContent = getInnerHtml(this);
			
			var flashVars = "movieUrl=" + encodeURIComponent(flashBasePath + "featured_news/featured_news.1.0.swf")
			flashVars += "&bufferColor=" + encodeURIComponent(bufferColor);
			flashVars += "&cssUrl=/_resx/css/flash/featured_news.css";
			flashVars += "&newsContent=" + encodeURI(newsContent);
			
			var pars = {
				flashvars:	flashVars,
				bgcolor: 	"#000000",
				wmode: 		"transparent"
				};
			
			writeFlash(this, "featured_news/featured_news_loader.swf", w, h, pars);
		
	}
	
	return {
	/* Public API
	*/
	init: init
	}	
	
}();

$(document).ready(nzc_featured_news.init);

