//PAGE LOAD
$(document).ready(function(){					   					   
	//MENU ZINDEX FIX
	var _menuZ = 350;
	$("#mainBody #navigation ul#mainMenu > li").each(function(){
		$(this).css("z-index",_menuZ);
		_menuZ--;
	});	
	// Dynamically add target="_blank" to a tags inside li tags with 'openNewWindow'
	// class applied as well as to a tags with the same class applied directly
	$("li.openNewWindow > a, a.openNewWindow").attr("target","_blank");
	//VIDEO PLAYER
	$(".videoplayer").click(function(){
		var _href = $(this).attr("href");
		tb_show('',_href+'&KeepThis=true&TB_iframe=true&height=393&width=687','');
		$("#TB_window").css({ backgroundColor:"black" });
		$("#TB_window #TB_iframeContent").css({ backgroundColor:"black" });		
		return false;
	});
	//SET TITLE = ALT FOR CROSS PLATFORM STUFF
	$("#mainBody img").each(function(){
		if  ( ($(this).attr("title") == undefined) || ($(this).attr("title") == "") )  {
			if  ( ($(this).attr("alt") != undefined) && ($(this).attr("alt") != "") )  {
				$(this).attr( {title: $(this).attr("alt") });	
			}
		}
	});	
	
	//FAQ SHOW AND HIDE
	$(".faqDetail").hide();
	$(".faqQuestion").addClass("faqQuestionClosed");
	
	$(".faqQuestion").click(function(){
		$(".faqDetail").hide(0);
		$(".faqQuestion").parent().removeClass("underline");
		$(".faqQuestion").addClass("faqQuestionClosed");
		$(this).parent().next().slideToggle(100);
		$(this).parent().addClass("underline");
		$(this).removeClass("faqQuestionClosed");
		return false;
	});
	
	$("#faqShowAll").click(function(){
		$(".faqQuestion").parent().addClass("underline");
		$(".faqQuestion").removeClass("faqQuestionClosed");
		$(".faqDetail").show(0);
		$(this).parent().next().show(0);
		$(this).hide();
		return false;
	});
	
	// ALT ROW CLASSES APPLY
	$("table.tableData tr:even td").addClass("rowEven");
	$("table.tableData tr:odd td").addClass("rowOdd");
	
	$("table.plain td").removeClass("rowOdd");
	$("table.plain td").addClass("rowEven");
	
	//if($("table.tableData").hasClass('plain')){ 
		//$(this).find('td').addClass("rowEven"); 
	//}
	
}); // END PAGE LOAD

function collapseAll() {
	$(".faqDetail").hide();
	$("#collapseAll").hide();
	$("#expandAll").show();
}

function expandAll() {
	$(".faqDetail").show();
	$("#collapseAll").show();
	$("#expandAll").hide();
}
// THICKBOX CHANGED CASE, THIS IS A WRAPPER TO KEEP OLD WORKING
function TB_show(caption, url, imageGroup){
	tb_show(caption, url, imageGroup);
}




