/*
* $Id$
*/
var FlashHandler = {
	/*
	 * Make the html returned by IE into valid XML
	 *   - close </li> tags
	 *   - add quotes to ids and targets
	 */
	parseInnerHTML : function(html) {
		if (navigator.userAgent.match(/^.*MSIE.*$/)) {
				// make the html into one string (remove new lines)
			joinedHtml = html.split("\n");
			joinedHtml = joinedHtml.join(" ");
			
				// add quotes to ids and targets
			joinedHtml = joinedHtml.replace(/id=(\S+?)([\s>])/gim, "id=\"$1\"$2");
			joinedHtml = joinedHtml.replace(/target=(\S+?)([\s>])/gim, "target=\"$1\"$2");
			
				// find all <li> to </a> matches
			var liElements = html.match(/<li(.)*<\/a>/gi);
			
				// preserve the non list content of the html
			var nonLiElements = joinedHtml.split(/<ol(.)*<\/ol>/gim);
			
			var num = liElements.length;
			
				// add the closing </li> tags back in
			liElements = liElements.join("</LI>");
			liElements = "<OL id=\"items\" count=\"" + num + "\">" + liElements; 
			liElements += "</LI></OL>";
			
			liElements = liElements.replace(/target=(\S+?)([\s>])/gim, "target=\"$1\"$2");
			
			return nonLiElements.join(liElements);
		} else {
			return html;
		}
	},

	loadCarouselData:function() {
		var carousel = document.getElementById("carouselFlashWrapper");
		var parsedHTML = FlashHandler.parseInnerHTML(carousel.innerHTML);
		return parsedHTML;
	} 
}

