// Note: brand_logo_container_id must be the id attribute (ie. id="brandcontainer")
var brand_logo_container_id = "pageFooter > #footerLogos";
var jsp_include_path = "/inc/footer-brand-logos.jsp";

lang_from_url = function()
{
	return (document.location.href.indexOf("/fr/") > -1) ? "fr" : "en";
}

if (jQuery)
{
	$(document).ready(function(){
		$.ajax({
			type: "GET",
			url: jsp_include_path,
			async: false,
			dataType: "html",
			data: { lang: lang_from_url },
			success: function(html){
				//$("#"+ brand_logo_container_id).html(html);
				writeFooterLogos(html, "#"+ brand_logo_container_id);
				try
				{
					$("#"+ brand_logo_container_id).pngFix();
					$("#logo,#headerMask,.zebra").pngFix();
					//$("#headerMask").pngFix();
					
				}
				catch (err) {}
			}
		});
	});
}

writeFooterLogos = function(html, target)
{
	var newStr = html;
	newStr = newStr.replace(/<a /gi, "<li><a ");
	newStr = newStr.replace(/<\/a>/gi, "</a></li>");
	
	$(target).html(newStr);
}

////////////
//
// start of quick meals
//



	var m_lquickmeals_track_debug = false; //set to true to see analytics in the title bar
	var m_lquickmeals_track_langfr = (window.location + "").toLowerCase().indexOf("/fr/") >= 0;
	var g_cquickmeals_track_lang = m_lquickmeals_track_langfr ? "fr" : "en";
	var g_cquickMeals_swf_iframe = "/quickmeals/" + g_cquickmeals_track_lang + "/quickmeals.html";
	var m_cquickmeals_track_langfr = m_lquickmeals_track_langfr ? "-fr" : "";
	var m_cquickmeals_track_page = "http://www.conagrafoods.ca/flash/quickmeals" + m_cquickmeals_track_langfr + "/quickmealsanalytics.html";
	var m_cquickmeals_track_dom = window.location.host + "";
	var m_oquickmeals_track_iframe = null;
	var m_oquickmeals_cleartimer = null;



	function closeQuickMeals(){
		$.fn.colorbox.close();
	}



	function quickmeals_track(param1, param2) {
		var curl;

		if (m_lquickmeals_track_debug) {
			document.title = param1 + ((param2) ? " " + param2 : "");
			if (m_oquickmeals_cleartimer != null) window.clearTimeout(m_oquickmeals_cleartimer);
			m_oquickmeals_cleartimer = window.setTimeout("document.title='---'; m_oquickmeals_cleartimer = null;", 1000);
		}
		if (m_oquickmeals_track_iframe == null) {
			m_oquickmeals_track_iframe = document.getElementById("quickmeals_track_iframe");
			if (!m_oquickmeals_track_iframe) m_oquickmeals_track_iframe = null;
			if (m_oquickmeals_track_iframe == null) return;
		}
		curl = m_cquickmeals_track_page + "?dom=" + m_cquickmeals_track_dom + "&lan=" + g_cquickmeals_track_lang + "&maj=" + escape(param1) + "&min=" + ((param2) ? escape(param2) : "") + "&rand=" + Math.random();
		m_oquickmeals_track_iframe.src = "about:blank";
		m_oquickmeals_track_iframe.contentWindow.document.writeln("<html><body><iframe src=\"" + curl + "\"></iframe></body></html>");
	}



	if ((window.location + "").toLowerCase().indexOf("//qa-") >= 0) {
		g_cquickMeals_swf_iframe = "/quickmeals/" + g_cquickmeals_track_lang + "/quickmealsStg.html";
		m_cquickmeals_track_page = "http://qa-conagrafoods-ca.conagrafoods.com/flash/quickmeals" + m_cquickmeals_track_langfr + "/quickmealsanalytics.html";
 	}
	else if ((window.location + "").toLowerCase().indexOf(".arcleo.com") >= 0) if ((window.location + "").toLowerCase().indexOf("//www.") < 0) {
		g_cquickMeals_swf_iframe = "/quickmeals/" + g_cquickmeals_track_lang + "/quickmealsDev.html";
		m_cquickmeals_track_page = "http://conagra.dev.arcleo.com/flash/quickmeals" + m_cquickmeals_track_langfr + "/quickmealsanalytics.html";
	}
	if (m_lquickmeals_track_debug) window.setTimeout("document.title='---';", 1);
	document.writeln('<link media="screen" rel="stylesheet" href="/quickmeals/css/colorbox.css" /><script src="/quickmeals/js/jquery.colorbox.js" type="text/javascript"></script>');


	$(document).ready(function(){
		$("#footerLogos")
			.prepend('<iframe src="about:blank" name="quickmeals_track_iframe" id="quickmeals_track_iframe" style="position:absolute; top:0px; left:0px; width:1px; height:1px; opacity:0.01;filter:alpha(opacity=1); border:0px; margin:0px; padding:0px;" width="1" height="1" frameborder="0" scrolling="no"></iframe>')
			.prepend('<span id="quickmeals" class="quickmeals' + g_cquickmeals_track_lang + '"><img alt="" border="0" src="/quickmeals/' + g_cquickmeals_track_lang + '/btn-quick-meals-leftline.png"/><a href="' + g_cquickMeals_swf_iframe + '"><img alt="click for quick recipes" border="0" src="/quickmeals/' + g_cquickmeals_track_lang + '/btn-quick-meals.png"/></a><img alt="" border="0" src="/quickmeals/' + g_cquickmeals_track_lang + '/btn-quick-meals-rightline.png"/></span>')
		;
		$("#quickmeals a img").hover(
			function() {
				this.src = this.src.replace("meals.png", "meals-on.png");
			},
			function() {
				this.src = this.src.replace("meals-on.png", "meals.png");
			}
		);
		$("#quickmeals a").css("outline", "0px");
		$("#quickmeals a").colorbox();
	});



//
// end of quick meals
//
////////////
