function initForteMenu() {
	jQuery("ul li:nth-child(even)").addClass('even');
	jQuery("ul li:nth-child(odd)").addClass('odd');
	jQuery("ul li:first-child").addClass('first');
	jQuery("ul li:last-child").addClass('last');
	
	jQuery("ul li.yuimenubaritem:first-child").addClass('first-of-type');
	jQuery("ul li.yuimenubaritem:first-child").removeClass('first');
	jQuery("ul li.yuimenubaritem:last-child").addClass('last-of-type');
	jQuery("ul li.yuimenubaritem:last-child").removeClass('last');
	jQuery("ul li.yuimenubaritem:nth-child(even)").addClass('even');
	jQuery("ul li.yuimenubaritem:nth-child(odd)").addClass('odd');
	
	jQuery("ul li.yuimenuitem:first-child").addClass('first-of-type');
	jQuery("ul li.yuimenuitem:first-child").removeClass('first');
	jQuery("ul li.yuimenuitem:last-child").addClass('last-of-type');
	jQuery("ul li.yuimenuitem:last-child").removeClass('last');
	jQuery("ul li.yuimenuitem:nth-child(even)").addClass('even');
	jQuery("ul li.yuimenuitem:nth-child(odd)").addClass('odd');
	
	
	var p = window.location.pathname.toString() + window.location.search.toString();
		p = p.substring(p.lastIndexOf("/") + 1, p.length);	
		if(p.length==0){ p = window.location.pathname.toString() + window.location.search.toString(); }
	
	
	var selected_item = jQuery('ul.menuItemCt a[href="' + p + '"]');
	if ( selected_item.length == 0 ) { selected_item = jQuery('ul.menuItemCt a[href*="' + p + '"]'); }
	selected_item.addClass('menuItem-active').parents("li:first").addClass('menuItem-active').parents("li:first").addClass('menuItem-active').parents("li:first").addClass('menuItem-active');
	
	jQuery("ul.menuItemCt li.menuItem-active").find("a:first").addClass('menuItemLabel-active');		
	jQuery("ul.menuItemCt li:has(.menuCt)").addClass('menuItem-hasChildren');
	jQuery("ul.menuItemCt li.menuItem-hasChildren").find("a:first").addClass('menuItemLabel-hasChildren');
}

function initForteTables() {
	jQuery("table tr:nth-child(even)").addClass('tr-even');
	jQuery("table tr:nth-child(odd)").addClass('tr-odd');
	jQuery("table tr:first-child").addClass('tr-first');
	jQuery("table tr:last-child").addClass('tr-last');
	jQuery("table td:nth-child(even)").addClass('td-even');
	jQuery("table td:nth-child(odd)").addClass('td-odd');
	jQuery("table td:first-child").addClass('td-first');
	jQuery("table td:last-child").addClass('td-last');
}

function initForteVideos() {
	jQuery("a.forteVideoPlayer").each(function(index) {
		var objId = jQuery(this).attr('id');
		var objWidth = jQuery(this).width();
		var objHeight = jQuery(this).height();
		var iconLeft = parseInt((objWidth / 2) - (83 / 2));
		var iconTop = parseInt((objHeight / 2) - (83 / 2));
		jQuery(this).css('position','relative');
		jQuery(this).append('<img src="/common_scripts/images/play_large.png" border="0" style="position:absolute;top:' + iconTop + 'px;left:' + iconLeft + 'px;"/>')
	});
	var startVideo = function(event) {
		event.preventDefault();
		var objId = jQuery(this).attr('id');
		var vidSt = jQuery(this).attr('href');
		flowplayer(objId, { src:'http://releases.flowplayer.org/swf/flowplayer-3.2.5.swf', wmode:'transparent' },{
			clip: { url:vidSt, autoPlay:false, autoBuffering: true, bufferLength: 5, scaling: 'scale' }
		}).ipad().play();
		jQuery(this).unbind('click', startVideo);
		return false;
	}
	jQuery("a.forteVideoPlayer").bind('click', startVideo);
}

function onStateMainNavigation(MenuId) {
	jQuery("li#yui-item" + MenuId).addClass('yuimenubaritem-onstate').find("a:first").addClass('yuimenubaritemlabel-onstate');
}

jQuery(document).ready(function(){
	initForteMenu();
	initForteTables();
	initForteVideos();
});
