// ------------------------------------
var NewsManager =
// ------------------------------------
{
	_monthNames : [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ],
	_items : new Array(),
	_tableElement: null,
	_yearDropDown: null,
	_entityNameDropDown: null,
	_panelElement: null,

	initialize : function(tableElement, yearDropDown, entityNameDropDown)
	{
		NewsManager._tableElement = $(tableElement);
		NewsManager._yearDropDown = $(yearDropDown);
		NewsManager._entityNameDropDown = $(entityNameDropDown);

		for (var i = 0; i < NewsManager._items.length; i++)
		{
			// Populate years and entity names dropdown
			NewsManager.addOption(NewsManager._yearDropDown, NewsManager._items[i].date.getFullYear(), false);
			NewsManager.addOption(NewsManager._entityNameDropDown, NewsManager._items[i].entityName, true);
		}
		NewsManager.update();
	},
	
	initializePanel : function(panelElement)
	{
		NewsManager._panelElement = $(panelElement);
		NewsManager.updatePanel();
	},
	
	update: function()
	{
		NewsManager._tableElement.find('tbody tr[class!="emptyMessage"]').remove();

		var empty = true;
		var html = '';
		for (var i = 0; i < NewsManager._items.length; i++)
		{
			var mustAdd = true;
			if (NewsManager._yearDropDown.val() != '' &&
				NewsManager._yearDropDown.val() != NewsManager._items[i].date.getFullYear())
			{
				mustAdd = false;
			}
			
			if (mustAdd)
			{
				empty = false;
				html +=
					'<tr><td class="center">' +
						NewsManager.formatDate(NewsManager._items[i].date) +
					'</td><td><a class="iframePopup" href="../../JavaScript/' +
						NewsManager._items[i].url +
					'">' +
						NewsManager._items[i].title +
					'</a></td></tr>';
			}
		}

		NewsManager._tableElement.find('tbody').append(html);
		NewsManager._tableElement.find('tbody tr:even[class!="emptyMessage"]').addClass('alternate');
		NewsManager._tableElement.find('a.iframePopup').click(NewsManager.itemClick);
		NewsManager._tableElement.find('tbody tr.emptyMessage').css('display', empty ? '' : 'none');
	},
		
	updatePanel : function()
	{
		NewsManager._panelElement.empty();
		if (NewsManager._items.length == 0)
		{
			NewsManager._panelElement.css('display', 'none');
		}
		else
		{
			var html = '<label>Latest News</label>';
			for (var i = 0; i < NewsManager._items.length && i < 3; i++)
			{
				html += 
					'<img class="separator" src="../../Images/panel_separator.gif" />' +
					'<a class="iframePopup" href="../../JavaScript/' +
					NewsManager._items[i].url +
					'">' +
					NewsManager._items[i].title +
					'</a>';
			}
			html += 
				'<img class="separator" src="../../Images/panel_separator.gif" />' + 
				'<a class="more" href="../../en_US/News/News.shtml">more...</a>';
			
			NewsManager._panelElement.append(html);
			NewsManager._panelElement.find('a.iframePopup').click(NewsManager.itemClick);
		}
	},
	
	itemClick: function()
	{
		IframeManager.create($(this).attr('href'), {width: 600});
		return false;
	},

	addItem : function(date, entityName, title, url)
	{
		NewsManager._items.push(new NewsItem(date, entityName, title, url));
	},
	
	addOption : function(selectElement, value, ascending)
	{
		var added = false;
		var existingOptions = selectElement.children('option');
		for (var i = 0; i < existingOptions.size(); ++i)
		{
			if (existingOptions.get(i).value == '')
			{
				continue;
			}
			if (existingOptions.get(i).value == value)
			{
				added = true;
				break;
			}
			else if (
				(ascending == true && existingOptions.get(i).value > value) ||
				(ascending == false && existingOptions.get(i).value < value))
			{
				$(existingOptions.get(i)).before(
					'<option value="' + value + '">' + value + '</option>'
				);
				added = true;
				break;
			}
		}
		
		if (!added)
		{
			selectElement.append(
				'<option value="' + value + '">' + value + '</option>'
			);
		}
	},

	formatDate : function(date)
	{
		var formatted = NewsManager._monthNames[date.getMonth()] + ' ' + date.getDate() + ', ' + date.getFullYear();
		return formatted;
	}
};
//---------------------------------------------------------------------------

function NewsItem(date, entityName, title, url)
{
	this.date		= date;
	this.entityName = entityName;
	this.title		= title;
	this.url		= url;
}

//---------------------------------------------------------------------------
// Create news entries here
//---------------------------------------------------------------------------
NewsManager.addItem(
	new Date(2010, 7, 10), 'Symbility Solutions Inc.', 'Symbility Signs Contract with Major Contractor Network', './../en_US/Content/News/NewsSS20100810.shtml'
);
NewsManager.addItem(
	new Date(2010, 5, 15), 'Symbility Solutions Inc.', 'Symbility Launches Haus360\u00B0 Product Suite in Germany', './../en_US/Content/News/NewsSS20100615.shtml'
);
NewsManager.addItem(
	new Date(2010, 5, 1), 'Symbility Solutions Inc.', 'Symbility Forms Strategic Partnership with Wipro', './../en_US/Content/News/NewsSS20100601.shtml'
);
NewsManager.addItem(
	new Date(2010, 3, 6), 'Symbility Solutions Inc.', 'Symbility Finalizes Three Year Contract with Groupe Promutuel', './../en_US/Content/News/NewsSS20100406.shtml'
);
NewsManager.addItem(
	new Date(2010, 2, 22), 'Symbility Solutions Inc.', 'Symbility Debuts New First Notice of Loss Estimating Technology', './../en_US/Content/News/NewsSS20100322.shtml'
);
NewsManager.addItem(
	new Date(2009, 11, 1), 'Symbility Solutions Inc.', 'Andrew de Groot Appointed Vice President, Global Sales & Marketing for Symbility', './../en_US/Content/News/NewsSS20091201.shtml'
);
NewsManager.addItem(
	new Date(2009, 7, 17), 'Symbility Solutions Inc.', 'Ellipta Signs Innovation Symbility Solution in the UK', './../en_US/Content/News/NewsSS20090817.shtml'
);
NewsManager.addItem(
	new Date(2009, 6, 23), 'Symbility Solutions Inc.', 'RSA Signs Innovation Symbility Solution in the UK', './../en_US/Content/News/NewsSS20090723.shtml'
);
NewsManager.addItem(
	new Date(2009, 3, 1), 'Symbility Solutions Inc.', 'Promutuel Signs Multi-Year Contract with Symbility', './../en_US/Content/News/NewsSS20090401.shtml'
);
NewsManager.addItem(
	new Date(2009, 2, 23), 'Symbility Solutions Inc.', 'Symbility Announces Contract with Farmers Mutual United Insurance Company', './../en_US/Content/News/NewsSS20090323.shtml'
);
NewsManager.addItem(
	new Date(2009, 2, 12), 'Symbility Solutions Inc.', 'Symbility Solutions Signs Contract with Chubb', './../en_US/Content/News/NewsSS20090312.shtml'
);
NewsManager.addItem(
	new Date(2008, 10, 5), 'Symbility Solutions Inc.', 'Symbility Solutions Signs Contract with Franklin Mutual Insurance Company', './../en_US/Content/News/NewsSS20081105.shtml'
);
NewsManager.addItem(
	new Date(2008, 9, 28), 'Symbility Solutions Inc.', 'Symbility Solutions Surpasses 10,000 Users of its Mobile Claims Application', './../en_US/Content/News/NewsSS20081028.shtml'
);
NewsManager.addItem(
	new Date(2008, 9, 14), 'Symbility Solutions Inc.', 'Symbility Solutions Launches in the U.K.', './../en_US/Content/News/NewsSS20081014.shtml'
);
NewsManager.addItem(
	new Date(2008, 6, 22), 'Symbility Solutions Inc.', 'Symbility Solutions Announces Strategic Partnership with e2Value', './../en_US/Content/News/NewsSS20080722.shtml'
);
NewsManager.addItem(
	new Date(2008, 5, 11), 'Symbility Solutions Inc.', 'Symbility Solutions Releases Version 3.1 of its Mobile Claims Software Package', './../en_US/Content/News/NewsSS20080611.shtml'
);
NewsManager.addItem(
	new Date(2008, 4, 27), 'Symbility Solutions Inc.', 'Symbility Solutions Surpasses 9,000 Users of its Mobile Claims Application', './../en_US/Content/News/NewsSS20080527.shtml'
);
NewsManager.addItem(
	new Date(2008, 3, 24), 'Symbility Solutions Inc.', 'Symbility Solutions Partners with Innovation Group to Expand Globally', './../en_US/Content/News/NewsSS20080424.shtml'
);
NewsManager.addItem(
	new Date(2008, 2, 31), 'Symbility Solutions Inc.', 'Symbility Solutions Releases Version 3.0 of its Mobile Claims Software Package', './../en_US/Content/News/NewsSS20080331.shtml'
);
NewsManager.addItem(
	new Date(2008, 2, 27), 'Symbility Solutions Inc.', 'Symbility Solutions Announces Innovative Integration with Enservio', './../en_US/Content/News/NewsSS20080327.shtml'
);
NewsManager.addItem(
	new Date(2008, 2, 25), 'Symbility Solutions Inc.', 'Schafer, Wood & Associates Signs Contract with Symbility Solutions', './../en_US/Content/News/NewsSS20080325.shtml'
);
NewsManager.addItem(
	new Date(2008, 2, 17), 'Symbility Solutions Inc.', 'Farmers Mutual of Nebraska Extends its Contract with Symbility Solutions', './../en_US/Content/News/NewsSS20080317.shtml'
);
NewsManager.addItem(
	new Date(2008, 0, 23), 'Symbility Solutions Inc.', 'Symbility Solutions Passess the 8,000 User Mark with its Mobile Claims System', './../en_US/Content/News/NewsSS20080123.shtml'
);
NewsManager.addItem(
	new Date(2007, 9, 30), 'Symbility Solutions Inc.', 'Symbility Solutions Expands Sales Team', './../en_US/Content/News/NewsSS20071030.shtml'
);
NewsManager.addItem(
	new Date(2007, 8, 24), 'Symbility Solutions Inc.', 'Symbility Solutions Announces Groundbreaking Partnership with Enservio', './../en_US/Content/News/NewsSS20070924.shtml'
);
NewsManager.addItem(
	new Date(2007, 8, 4), 'Symbility Solutions Inc.', 'Symbility Solution Partners with Panasonic for Best-of-Breed Mobile Platform for Insurance Adjusters', './../en_US/Content/News/NewsSS20070904.shtml'
);
NewsManager.addItem(
	new Date(2007, 7, 21), 'Symbility Solutions Inc.', 'Symbility Solutions Inc. Announces Partnership with Lautriv', './../en_US/Content/News/NewsSS20070821.shtml'
);
NewsManager.addItem(
	new Date(2007, 7, 9), 'Symbility Solutions Inc.', 'Symbility Announces Mobile Claims v2.9', './../en_US/Content/News/NewsSS20070809.shtml'
);
NewsManager.addItem(
	new Date(2007, 6, 31), 'Symbility Solutions Inc.', 'Symbility Solutions Mobile Claims Technology Surpasses 7,000 Users', './../en_US/Content/News/NewsSS20070731.shtml'
);
NewsManager.addItem(
	new Date(2007, 5, 6), 'Symbility Solutions Inc.', 'Symbility Announces Solution Partner Agreement with Lenovo', './../en_US/Content/News/NewsSS20070606.shtml'
);
NewsManager.addItem(
	new Date(2007, 4, 14), 'Symbility Solutions Inc.', 'Symbility Solutions Joins Motion Computing Partner Program', './../en_US/Content/News/NewsSS20070514.shtml'
);
NewsManager.addItem(
	new Date(2007, 4, 2), 'Symbility Solutions Inc.', 'Symbility Solutions Surpasses 6,000 Users of its Mobile Claims System', './../en_US/Content/News/NewsSS20070502.shtml'
);
NewsManager.addItem(
	new Date(2007, 5, 27), 'Symbility Solutions Inc.', 'Symbility Signs Agreement with U.S. Based Mercer Insurance Group', './../en_US/Content/News/NewsSS20070327.shtml'
);
NewsManager.addItem(
	new Date(2007, 1, 21), 'Symbility Solutions Inc.', 'Symbility Solutions Launches Version 2.8 of Mobile Claims', './../en_US/Content/News/NewsSS20070221.shtml'
);
NewsManager.addItem(
	new Date(2007, 1, 15), 'Symbility Solutions Inc.', 'Symbility Solutions Names Rocky Cosentino as Regional Sales Vice President', './../en_US/Content/News/NewsSS20070215.shtml'
);
NewsManager.addItem(
	new Date(2007, 1, 12), 'Symbility Solutions Inc.', 'Symbility Process Proves to be Three Times Faster', './../en_US/Content/News/NewsSS20070212.shtml'
);
NewsManager.addItem(
	new Date(2007, 1, 7), 'Symbility Solutions Inc.', 'David Chalmers is Named to Lead Symbility Business Development', './../en_US/Content/News/NewsSS20070207.shtml'
);
NewsManager.addItem(
	new Date(2007, 0, 29), 'Symbility Solutions Inc.', 'Symbility Solutions Surpasses 5,000 Users of its Mobile Claims System', './../en_US/Content/News/NewsSS20070129.shtml'
);
NewsManager.addItem(
	new Date(2006, 10, 21), 'Symbility Solutions Inc.', 'Symbility Solutions Expands Business in Quebec', './../en_US/Content/News/NewsSS20061121.shtml'
);
NewsManager.addItem(
	new Date(2006, 10, 14), 'Symbility Solutions Inc.', 'Symbility Signs Contract with State Auto', './../en_US/Content/News/NewsSS20061114.shtml'
);
NewsManager.addItem(
	new Date(2006, 9, 23), 'Symbility Solutions Inc.', 'Symbility Solutions Receives 2006 Mobile Star Awards', './../en_US/Content/News/NewsSS20061023.shtml'
);
NewsManager.addItem(
	new Date(2006, 8, 27), 'Symbility Solutions Inc.', 'Symbility Solutions Reaches Milestone of 3,500 Individual User of its Mobile Claims System', './../en_US/Content/News/NewsSS20060927.shtml'
);
NewsManager.addItem(
	new Date(2006, 8, 20), 'Symbility Solutions Inc.', 'Boris Znebel is Named as President of Symbility Solutions', './../en_US/Content/News/NewsSS20060920.shtml'
);
NewsManager.addItem(
	new Date(2006, 7, 3), 'Symbility Solutions Inc.', 'Symbility Solutions Settle U.S. Lawsuit', './../en_US/Content/News/NewsSS20060803.shtml'
);
NewsManager.addItem(
	new Date(2006, 6, 24), 'Symbility Solutions Inc.', 'Symbility Solutions Signs Commercial Agreement with Quebec Based Sinisoft Inc.', './../en_US/Content/News/NewsSS20060724.shtml'
);
NewsManager.addItem(
	new Date(2006, 5, 27), 'Symbility Solutions Inc.', 'Symbility Solutions Signs an A.M. Best A++ U.S. Insurance Company', './../en_US/Content/News/NewsSS20060627.shtml'
);
NewsManager.addItem(
	new Date(2006, 5, 20), 'Symbility Solutions Inc.', 'Symbility Solutions Signs Up 3,000th User of its Mobile Claims System', './../en_US/Content/News/NewsSS20060620.shtml'
);
NewsManager.addItem(
	new Date(2006, 5, 7), 'Symbility Solutions Inc.', 'Symbility Solutions Signs First Insurance Company of Hawaii, Ltd.', './../en_US/Content/News/NewsSS20060607.shtml'
);
NewsManager.addItem(
	new Date(2006, 4, 17), 'Symbility Solutions Inc.', 'Symbility Solutions Will Attend ACORD/LOMA Insurance Systems Forum 2006', './../en_US/Content/News/NewsSS20060517.shtml'
);
NewsManager.addItem(
	new Date(2006, 1, 21), 'Symbility Solutions Inc.', 'Symbility Solutions Signs Farmers Mutual Insurance of Nebraska', './../en_US/Content/News/NewsSS20060221.shtml'
);
NewsManager.addItem(
	new Date(2006, 0, 27), 'Symbility Solutions Inc.', 'Symbility Solutions to Demonstrate the Power of \'Insurance Mobility\'', './../en_US/Content/News/NewsSS20060127.shtml'
);
NewsManager.addItem(
	new Date(2006, 0, 26), 'Symbility Solutions Inc.', 'Symbility Solutions Signs Up 1,500th User for its Mobile Claims System', './../en_US/Content/News/NewsSS20060126.shtml'
);
NewsManager.addItem(
	new Date(2006, 0, 25), 'Symbility Solutions Inc.', 'Automated Benefits Initiates Two More Software Pilots', './../en_US/Content/News/NewsSS20060125.shtml'
);
NewsManager.addItem(
	new Date(2006, 0, 23), 'Symbility Solutions Inc.', 'Symbility Solutions Launches Version 2.4 of its Advanced Mobile Claims Software Platform', './../en_US/Content/News/NewsSS20060123.shtml'
);
NewsManager.addItem(
	new Date(2006, 0, 13), 'Symbility Solutions Inc.', 'Symbility Solutions Commences Two U.S. Software Pilot Programs', './../en_US/Content/News/NewsSS20060113.shtml'
);
NewsManager.addItem(
	new Date(2006, 0, 3), 'Symbility Solutions Inc.', 'Symbility Solutions Joins Microsoft Insurance Value Chain Program', './../en_US/Content/News/NewsSS20060103.shtml'
);
NewsManager.addItem(
	new Date(2005, 11, 30), 'Symbility Solutions Inc.', 'Symbility Solutions Receives Response to Complaints Filed in the United States', './../en_US/Content/News/NewsSS20051230.shtml'
);
NewsManager.addItem(
	new Date(2005, 1, 13), 'Symbility Solutions Inc.', 'Symbility Solutions Announces New Executive Sales Team', './../en_US/Content/News/NewsSS20051213.shtml'
);
NewsManager.addItem(
	new Date(2005, 10, 14), 'Symbility Solutions Inc.', 'Symbility Solutions Signs Up 1,000th User for its Mobile Claims System', './../en_US/Content/News/NewsSS20051114.shtml'
);
NewsManager.addItem(
	new Date(2005, 9, 21), 'Symbility Solutions Inc.', 'Automated Benefits Corp. Announces New Symbility Executive Team', './../en_US/Content/News/NewsSS20051021.shtml'
);
NewsManager.addItem(
	new Date(2005, 9, 6), 'Symbility Solutions Inc.', 'Symbility Solutions Launches Version 2.3 of its Advanced Mobile Claims Software Platform', './../en_US/Content/News/NewsSS20051006.shtml'
);
NewsManager.addItem(
	new Date(2005, 7, 31), 'Symbility Solutions Inc.', 'Gore Mutual Selects Symbility Solutions for Advanced Mobile Claims System', './../en_US/Content/News/NewsSS20050831.shtml'
);
NewsManager.addItem(
	new Date(2005, 7, 5), 'Symbility Solutions Inc.', 'Symbility Solutions Responds to Complaint Served by Competitor Xactware in United States', './../en_US/Content/News/NewsSS20050805.shtml'
);
NewsManager.addItem(
	new Date(2005, 5, 29), 'Symbility Solutions Inc.', 'Automated Benefits Corp Announces Allstate Insurance Company of Canada Adoption of Symbility mobile claims System', './../en_US/Content/News/NewsSS20050629.shtml'
);
NewsManager.addItem(
	new Date(2005, 5, 21), 'Symbility Solutions Inc.', 'Automated Benefits Corp. Announces Signed Contract between Symbility and The Economical Insurance Group', './../en_US/Content/News/NewsSS20050621.shtml'
);
NewsManager.addItem(
	new Date(2005, 5, 8), 'Symbility Solutions Inc.', 'Automated Benefits Corp. Announces Symbility Launch with ServiceMaster of Canada', './../en_US/Content/News/NewsSS20050608.shtml'
);
NewsManager.addItem(
	new Date(2005, 3, 22), 'Symbility Solutions Inc.', 'Automated Benefits Corp. Announces Symbility Launch with Disaster Kleenup International', './../en_US/Content/News/NewsSS20050422.shtml'
);
NewsManager.addItem(
	new Date(2005, 3, 19), 'Symbility Solutions Inc.', 'Automated Benefits Corp. Announces Symbility USA Marketing Launch', './../en_US/Content/News/NewsSS20050419.shtml'
);
NewsManager.addItem(
	new Date(2005, 2, 17), 'Symbility Solutions Inc.', 'Automated Benefits Corp. Announces Symbility Pilot Launch with Gore Mutual Insurance Company', './../en_US/Content/News/NewsSS20050317.shtml'
);
//---------------------------------------------------------------------------