	// Parse the XML 
	function parseXml(xml){
		// Read through the XML and then pull out the recipes
		$(xml).find("recipe").each(function(){
			// Keep a running count of every three (3) recipes so manage things
			if(threeOfAKind<2){
				threeOfAKind++;
				$(".output").append("<li id='" + $(this).attr("id") + "' class='listNum" + currCount + "' >" + $(this).find("title").text() + "</li>");
			} else {
				threeOfAKind = 0;
				currCount++;
				$(".output").append("<li id='" + $(this).attr("id") + "' class='listNum" + currCount + "' >" + $(this).find("title").text() + "</li>");	
			}
			$(".output li:last-child").bind("click", {theRecp: $(this).attr("id")}, alterRecp);
		});
		// Now that we are done getting the recipes we need to format them correctly
		
		for(var q = currCount; q>0; q--){
			$(".listNum"+q+"").hide();
		}
		threeOfAKind = currCount;
		currCount = 0;
		$("#prevList").hide();
		$("li").bind("mouseover", recipeOver);
		$("li").bind("mouseout", recipeOut);

	}
	function recipeOver() {
		$(this).stop().animate({backgroundColor:'#5ba31b', color: "#FFFFFF"}, 700);
	};
	function recipeOut() {
		$(this).stop().animate({backgroundColor:'#FFFFFF', color: "#2d1b09"}, 100);
	};
	// Grab the flash movie so we can communicate with it
	function getFlashMovie(movieName) {
	  var isIE = navigator.appName.indexOf("Microsoft") != -1;
	  return (isIE) ? window[movieName] : document[movieName];
	}
	// Change the currently Displayed Recipe
	function alterRecp(event) {
		if(currRecipe != null){
			$(".output li[id="+currRecipe+"]").stop().animate({backgroundColor:'#FFFFFF', color: "#2d1b09"}, 100);
			$(".output li[id="+currRecipe+"]").bind("mouseover", recipeOver);
			$(".output li[id="+currRecipe+"]").bind("mouseout", recipeOut);
			$(".output li[id="+currRecipe+"]").bind("click", {theRecp: currRecipe}, alterRecp);
		}
		// Track the click with analytics
		var trimmed = "/summer-entertaining/"+$(".output li[id="+event.data.theRecp+"]").text();
		trimmed = trimmed.replace(/\s/g, '-') ;
		trimmed = trimmed.replace(/,/g, '')
		pageTracker._trackPageview(trimmed);
		// Send the request to flash
		var fswf = getFlashMovie("communication_test");
		fswf.sendToActionscript(event.data.theRecp);
		$("#"+event.data.theRecp).unbind("hover");
		$(".output li[id="+event.data.theRecp+"]").unbind("click", alterRecp);
		$(".output li[id="+event.data.theRecp+"]").unbind("mouseover", recipeOver);
		$(".output li[id="+event.data.theRecp+"]").unbind("mouseout", recipeOut);
		currRecipe = event.data.theRecp;
	}
	// Now we need to control the recipe lists
	// -----
	// NEXT!
	function goForward(){
		$(".listNum"+currCount+"").hide();
		currCount++;
		$(".listNum"+currCount+"").fadeIn("fast");
		// Now we see if we should fire the next button out of a cannon and into the sun
		if(currCount == threeOfAKind){
			$("#nextList").hide();
		}
		if(currCount == 1){
			$("#prevList").show();
		}
	}
	
	// Please don't say Backward
	function goBackward(){
		$(".listNum"+currCount+"").hide();
		currCount--;
		$(".listNum"+currCount+"").fadeIn("fast");
		// Now we see if we should fire the prev button out of a cannon and into the sun
		if(currCount == 0){
			$("#prevList").hide();
		}
		if(currCount == (threeOfAKind-1)){
			$("#nextList").show();
		}
	}
	// Validate the soft join data and send off
	function checkEmail(strng) {
		var error=true;
		if (strng == "") {
		   error = false;
		}
		var emailFilter=/^.+@.+\..{2,3}$/;
		if (!(emailFilter.test(strng))) { 
			error = false;
		}	else {
		//test email for illegal characters
			var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
			if (strng.match(illegalChars)) {
				error = false;
			}
		}
		return error;    
	}
	
	function softJoinCheck(){
		// Lets validate out soft join form
		var invalid = false
			$('form :input').each(function() {
				;
				var type = this.type;
				var tag = this.tagName.toLowerCase(); // normalize case
				// it's ok to reset the value attr of text inputs,
				// password inputs, and textareas
				if (type == 'text'){
					switch(this.name){
						// Reset the Personal Info form
						case "firstName":
							if(this.value.length<2 || this.value == "First Name" || this.value.indexOf("http://")>=0){
								// turn the BG Color Red then fade to white and add Message
								alert("Please enter your First Name, this is a required field");
								invalid = true;
							}
							break;
						case "lastName":
							if(this.value.length<2 || this.value == "Last Name" || this.value.indexOf("http://")>=0){
								// turn the BG Color Red then fade to white and add Message
								alert("Please enter your Last Name, this is a required field");
								invalid = true;
							}
							break;
						case "email":
							if(this.value.length<2 || this.value == "Email" || this.value.indexOf("http://")>=0){
								// turn the BG Color Red then fade to white and add Message
								if(checkEmail(this.value)){
									// email is fine so lets move on
								} else {
									// email bad , bad email, no.
									alert("Please enter a valid Email address, this is a required field");
									invalid = true;
								}
							}
							break;
					}
				}
			});
			if(!invalid){
				sendForm();
			}
	}
	function sendForm(){
		var passInfo = $("input[type=text]");
		// Please change this soft join url to the proper one
		$.post("softjoinurl", { FirstName: passInfo[0].value, LastName: passInfo[1].value, Email: passInfo[2].value},
		  function(data){
		  	// There is no result so we need to just keep these blank
			switch(data){
				case "1":
					// Went through ok so clear form and instruct them it was succesfull.
					break;
				case "0":
					// Form did not go through correctly so lets tell them.
					break;
			}
		  });
	}
	// Go grab the SNIB for people to pass around and use
	function getSNIB(){
	   window.location   = '/summer-entertaining/recipe-widget'; return false;
	}