document.write("<style>body {visibility:hidden;}</style>");

var	newsGroupEN = 10430, newsGroupFR = 10431, maxNewsStories = 3,
	linksGroupEN = 10462, linksGroupFR = 10668, maxLinks = 4,
	monthName = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"),
	EngOrFr,
	MenuArrayEN = new Array(
		{pageid:112315, hoffset:0, voffset:-1, animate:"true"},
		{pageid:123267, hoffset:0, voffset:-1, animate:"true"},
		{pageid:112313, hoffset:0, voffset:-1, animate:"true"},
		{pageid:112314, hoffset:0, voffset:-1, animate:"true"},
		{pageid:123268, hoffset:0, voffset:-1, animate:"true"},
		{pageid:112316, hoffset:0, voffset:-1, animate:"true"}
//		{pageid:0, hoffset:0, voffset:0, animate:"true"}
	),
	MenuArrayFR = new Array(
		{pageid:120099, hoffset:0, voffset:-1, animate:"true"},
		{pageid:123270, hoffset:0, voffset:-1, animate:"true"},
		{pageid:117461, hoffset:0, voffset:-1, animate:"true"},
		{pageid:120098, hoffset:0, voffset:-1, animate:"true"},
		{pageid:123271, hoffset:0, voffset:-1, animate:"true"},
		{pageid:120100, hoffset:0, voffset:-1, animate:"true"}
//		{pageid:0, hoffset:0, voffset:0, animate:"true"}
	);


if (RequestedFrench) { EngOrFr = "fr"; }
else if (navigator.userLanguage) { EngOrFr = navigator.userLanguage; }
else if (navigator.browserLanguage) { EngOrFr = navigator.browserLanguage; }
else if (navigator.language) { EngOrFr = navigator.language; }
else { EngOrFr = "en"; }

	startLang = (EngOrFr.indexOf("fr")>-1)?"fr":"en";
	swfLANG = (EngOrFr.indexOf("fr")>-1)?"fr":"en";




/************* Test IDs *******************/
	//newsGroupEN = 9609, newsGroupFR = 9609, linksGroupFR = 10462;
/******************************************/


$(document).ready(function(){
	$("#newsAreaEN").attr("nid",newsGroupEN).newsHeadline({charHeadline:75,uniqueListID:"EN",callback:function(ulID){newsCallback(ulID);}});
		$("#newsAreaFR").attr("nid",newsGroupFR).newsHeadline({charHeadline:75,uniqueListID:"FR",callback:function(ulID){newsCallback(ulID);}});
	$("#linksAreaEN").attr("linkid",linksGroupEN).linksList({uniqueListID:"EN",callback:function(numLinks,ulID){linksCallback(ulID)}});
		$("#linksAreaFR").attr("linkid",linksGroupFR).linksList({uniqueListID:"FR",callback:function(numLinks,ulID){linksCallback(ulID)}});
	
	swapLanguage(startLang);
		$("body").css("visibility","visible");
	
	$(window).ready(function(){
		initMenu("navEN","down",MenuArrayEN,0);
		initMenu("navFR","down",MenuArrayFR,0);
	});
});

function swapLanguage(lang){
	if(lang=="en") {
		$("#homepage").css("visibility","hidden");
			$(".swapLangClass").removeClass("french").addClass("english");
			$(".english").css("display",""); $(".french").css("display","none");
			$("#swapLangEng").addClass("on"); $("#swapLangFr").removeClass("on");
		$("#homepage").css("visibility","visible");
	}
	else {
		$("#homepage").css("visibility","hidden");
			$(".swapLangClass").removeClass("english").addClass("french");
			$(".french").css("display",""); $(".english").css("display","none");
			$("#swapLangFr").addClass("on"); $("#swapLangEng").removeClass("on");
		$("#homepage").css("visibility","visible");
	}
}

function linksCallback(ulID){
	if($("#"+ulID).html()){
		var setMeBack = $("#"+ulID).parent().css("display");
		$("#"+ulID).parent().css("visibility","hidden").css("display","block");
			$("#"+ulID+" span").each(function(){$(this).css("margin-top",(72-$(this).height())+"px");});
		$("#"+ulID).parent().css("display",setMeBack).css("visibility","visible");
		$("#LSphoto a").css("position","relative").css("z-index","400");
	}
}

function newsCallback(ulID){
	$(".newsItem").css("width",((460-(10*maxNewsStories))/maxNewsStories)+"px");
	$("#"+ulID+" .author").each(function(){
		var $pubDateReplace = $("<div></div>");
			$("<span></span>").addClass("pubDateMonth").html($(this).text().substr(0,3)).appendTo($pubDateReplace);
			$Day = $("<span></span>").addClass("pubDateDay").text($(this).text().substr(4,2)).appendTo($pubDateReplace);
		$(this).html($pubDateReplace);
	});
}