//Global, is Accessible Site Set?
//Flag to turn off/set DHTML features
//to fire in accessible way.
//Set via Cookie found at EOF
var bAccessibleSet = 0;

var miscFuncContent = new Array();
miscFuncContent[0] = "addthis.html";
miscFuncContent[1] = "sharethis.html";

function callContentMiscFunc(i,parentId,targetId) {
	if ($("#placeHolder").length <= 0) {
		$("<div id=\"placeHolder\"></div>").insertAfter($("ul#" + parentId + " li a#" + targetId));
		$("ul#" + parentId + " li" + " div").load(miscFuncContent[i] + " .SmallPopUp",'',loadShareThisContent);
	}
}

function loadShareThisContent () {
    //Path to be updated:w
	var URI = "http:\/\/www.menactra.com\/"
    var iMktNum = "#";
	
	var sharedContent = $("<div></div>");
	sharedContent.html($("div#mainContent").clone());
	sharedContent.find("ul#miscFuncBox").remove();
	sharedContent.find("a.StyledLink1").remove();
	
	/* Elements */
	var wrapElement = sharedContent.find("div#mainContent");
	var h3Title = sharedContent.find("h3");
	var h3TitleSpan = sharedContent.find("h3 span");
	var h4Title = sharedContent.find("h4");
	var h4TitleSpan = sharedContent.find("h4 span");
	var pElement = sharedContent.find("p");
	var ulElement = sharedContent.find("ul");
	var liElement = sharedContent.find("ul li");
	var aLinkElement1 = $("<a></a>");
	var aLinkElement2 = sharedContent.find("a.StyledLink2");
	var downloadLink = sharedContent.find("ul.DownloadLink li a")
	var supElement = sharedContent.find("sup a");
	var allLink = sharedContent.find("a");
	
	var logoElement = $("<a href=\"http://www.menactra.com\" target=\"_blank\"><img src=\"" + URI + "images\/logo-share.gif\" width=\"104\" height=\"59\" alt=\"Menactra Logo\" border=\"0\" /></a>")
	var footerElement = $("<div></div>");
    //var mktNumElement=$("<div style=\"font-size: 12px; font-family: Arial,Tahoma,san-serif;color:#8f8f8f;\">MKT14930-"+iMktNum+"</div>");	


	/* Make href becomes absolute path */
	var ie = document.all;
	if (!ie) {
		allLink.attr("href", function () { 
								   return URI + $(this).attr("href");
								   })
	}
	/* Change alink content and attribute*/
	aLinkElement1.text("Learn More");
	aLinkElement1.attr("title", "Learn More");
	aLinkElement1.attr("href", window.location);
	aLinkElement1.appendTo(footerElement);
	/* Append Logo */
	logoElement.appendTo(footerElement);
	
	/* Append Footer */
	footerElement.appendTo(wrapElement)

    /* Append Market Number */
    //mktNumElement.appendTo(wrapElement);
	
	/* Styling */
	wrapElement.css({ width: "520px", overflow: "hidden", border: "1px solid #bdd8f2", position: "relative", padding: "20px" });
	h3Title.css({ color: "#0053A0", fontWeight: "normal", fontSize: "24px", fontFamily: "Helvetica, Arial, Tahoma,san-serif", margin: "0px", padding: "0px" });
	h3TitleSpan.css({ fontWeight: "bolder" })
	h4Title.css({ color: "#0053A0", fontWeight: "normal", fontSize: "16px", fontFamily: "Helvetica, Arial, Tahoma,san-serif", margin: "20px 0px 5px 0px", padding: "0px" });
	h4TitleSpan.css({ fontWeight: "bolder" })
	pElement.css({ color: "#505050", fontSize: "12px", fontFamily: "Arial, Tahoma,san-serif", margin: "5px 0px 5px 0px", padding: "0px" });
	ulElement.css({ margin: "5px 0px 15px 0px", padding: "0px", listStyle: "none" });
		liElement.css({ color: "#505050", fontSize: "12px", fontFamily: "Arial, Tahoma,san-serif", background: "url(" + URI + "images\/bullet1.gif) no-repeat left 6px", paddingLeft: "8px" });
	aLinkElement1.css({ color: "#0053A0", fontSize: "12px", fontWeight: "bolder", fontFamily: "Arial, Tahoma,san-serif", textDecoration: "none", textTransform: "uppercase" });
	aLinkElement2.css({ color: "#0053A0", fontSize: "12px", fontWeight: "bolder", fontFamily: "Arial, Tahoma,san-serif", textDecoration: "none" });
	downloadLink.css({ color: "#0053A0", fontSize: "12px", fontWeight: "bolder", fontFamily: "Arial, Tahoma,san-serif", textDecoration: "none" })
	supElement.css({ color: "#0053A0", fontSize: "10px", fontFamily: "Arial, Tahoma,san-serif", textDecoration: "none" });
	footerElement.css({ overflow: "hidden", width: "100%", marginTop: "25px" })
	logoElement.css({ "float": "right" })
	
	/* Add share this content */
	$("div#sharedContent").text(sharedContent.html());
}

function hideSmallPopUp(i) {
	$("div#placeHolder").remove();
}
