// JavaScript Document
var MeadTemplateBundleID = "111967179770";
var MeadHost = "http://www.meadonline.com";
var MeadDefaultPic = "/App_Themes/Mead/images/mead_facebook_icon.gif";
var templateBundle = new Array();


//templateBundle["/Teachers/Beta_Signin.aspx"] = new Array(
//MeadTemplateBundleID, 
//{"images":[{"src":MeadHost + MeadDefaultPic, "href":""}],"text":"Download Facebook Gear on <a href= 'http://www.meadonline.com/Students/Downloads.aspx'>the text</a>"} 
//);

//templateBundle["/Profile/ThankYou.aspx"] = new Array(
//MeadTemplateBundleID, 
//{"images":[{"src":MeadHost + MeadDefaultPic, "href":""}],"text":"Download Facebook Gear on <a href= 'http://www.meadonline.com/Students/Downloads.aspx'>the text</a>"} 
//);

function formatArrayText(firstName){
    templateBundle["/Profile/ThankYou.aspx"] = new Array(
    MeadTemplateBundleID, 
    {"images":[{"src":MeadHost + MeadDefaultPic, "href":"http://www.meadonline.com"}],"text":"just joined <a href='http://www.meadonline.com'>mead.com</a> and has already started earning Mead Money Madness&reg; rewards points and playing awesome games. Since you’re a friend, "+firstName+" is letting you in on the fun too. Join now!<br><br>Source: www.meadonline.com<br><a href='http://www.meadonline.com'><b>Mead&reg; | learn. imagine. create.</b></a>"} 
    );

    templateBundle["/CheckOut.aspx"] = new Array(
    MeadTemplateBundleID, 
    {"images":[{"src":MeadHost + "/App_Themes/Mead/images/facebook_icon_redemption.jpg", "href":"http://www.meadonline.com/Rewards/Home.aspx"}],"text":"just cashed in Mead Money Madness&reg; points for sweet <a href='http://www.meadonline.com/rewards/gallery.aspx'>rewards</a>. Since you're a friend, "+firstName+" is letting you in on the fun too. Join now to start earning your own points for awesome rewards!<br><br>Source: www.meadonline.com<br><a href='http://www.meadonline.com/Rewards/Home.aspx'><b>Mead&reg; Rewards & Offers</b></a>"} 
    );

    templateBundle["/Teachers/Beta_Signin_ThankYou.aspx"] = new Array(
    MeadTemplateBundleID, 
    {"images":[{"src":MeadHost + "/App_Themes/Mead/images/mead4teachers_facebook_icon.jpg", "href":"http://www.meadonline.com/Teachers/Beta_Signin.aspx"}],"text":"just joined the Mead4Teachers program on <a href='http://www.meadonline.com'>mead.com</a>. Since you’re a friend and fellow teacher, "+firstName+" wants you to take advantage of our special rewards and benefits, too. Join our exclusive community now!<br><br>Source: www.meadonline.com<br><a href='http://www.meadonline.com/Teachers/Beta_Signin.aspx'><b>Become a Mead partner in education</b></a>"} 
    );
	
	templateBundle["/App/FiveStarBeats/index.aspx"] = new Array(
    MeadTemplateBundleID, 
    {"images":[{"src":MeadHost + "/App_Themes/Mead/images/facebook_icon_bofb.jpg", "href":"http://www.meadonline.com/Students/Play.aspx"}],"text":"just mastered some awesome drum riffs in Battle of the Beats. Can you keep up? Play the game to show off your skills and see if you can get a better score.<br><br>Source: www.meadonline.com<br><a href='http://www.meadonline.com/Students/Play.aspx'><b>Play Now</b></a>"} 
    );
	
	templateBundle["/App/ClassRoom_Chaos/index.aspx"] = new Array(
    MeadTemplateBundleID, 
    {"images":[{"src":MeadHost + "/App_Themes/Mead/images/facebook_icon_classroom_chaos.jpg", "href":"http://www.meadonline.com/Students/Play.aspx"}],"text":"just wreaked a ton of havoc in class without getting caught! Play the game to show off your skills and see if you can get a better score.<br><br>Source: www.meadonline.com<br><a href='http://www.meadonline.com/Students/Play.aspx'><b>Play Now</b></a>"} 
    );

	templateBundle["/App/MazeOMadness/index.aspx"] = new Array(
    MeadTemplateBundleID, 
    {"images":[{"src":MeadHost + "/App_Themes/Mead/images/facebook_icon_maze.jpg", "href":"http://www.meadonline.com/Students/Play.aspx"}],"text":"just dodged angry teachers and collected school supplies to make it out of the maze alive! Play the game to show off your skills and see if you can get a better score.<br><br>Source: www.meadonline.com<br><a href='http://www.meadonline.com/Students/Play.aspx'><b>Play Now</b></a>"} 
    );
	
	templateBundle["/App/GearGrabGame/index.aspx"] = new Array(
    MeadTemplateBundleID, 
    {"images":[{"src":MeadHost + "/App_Themes/Mead/images/facebook_icon_gear_grab.jpg", "href":"http://www.meadonline.com/Students/Play.aspx"}],"text":"just grabbed a ton of Five Star&reg; gear in under two minutes! Think you can beat the bell? Play the game to show off your skills and see if you can get a better score.<br><br>Source: www.meadonline.com<br><a href='http://www.meadonline.com/Students/Play.aspx'><b>Play Now</b></a>"} 
    );
	
	templateBundle["/App/Vocab/default.aspx"] = new Array(
    MeadTemplateBundleID, 
    {"images":[{"src":MeadHost + "/App_Themes/Mead/images/facebook_icon_vocab.jpg", "href":"http://www.meadonline.com/Students/Play.aspx"}],"text":"solved a tough word puzzle. Play Vocabularious to show off your skills and see how your performance stacks up. "} 
    );
}

function publish2Facebook(firstName, bundleArrayKey){
	formatArrayText(firstName);
	if (bundleArrayKey == null){
		bundleArrayKey = location.pathname;
	   //alert(location.pathname);
	}
	if (templateBundle[bundleArrayKey] != null){
		var template_bundle_id = templateBundle[bundleArrayKey][0];
		var template_data = templateBundle[bundleArrayKey][1];
		
		//alert("URL Before: " + template_data.images[0].href);
		if (template_data.images[0].href == ""){
			template_data.images[0].href = MeadHost + bundleArrayKey;
		}
		//alert("URL After: " + template_data.images[0].href);
		
		FB.ensureInit(function() {
			FB.Connect.showFeedDialog(template_bundle_id, template_data);
		});
	} else {
		//alert("Error: Bundle Key Not Found");
	}
}




