﻿function  parseXml(xml, numberVideoParse)
	{
	  var r = 0;
	  var numberVideos = $(xml).find("video").length;
	  var allCode = "";
	  var sumCode = "";

	  var rowS = "";
	  var rowE = "";
	  //if (numberVideos%2 != 0) allCode += "<td><\/td>";

	  $(xml).find("video").each(function()
	  {
		r++;
		embed = '<object width="400" height="'+$(this).find("height").text()+'"><param name="movie" value="http:\/\/www.';
		switch ($(this).attr('portal')) {
			case "youtube": embed += 'youtube.com/v/'+$(this).attr('id')+'&amp;hl=en_EN&amp;fs=1" /><param name="allowFullScreen" value="true" \/><param name="allowscriptaccess" value="always" /><embed src="http://www.youtube.com/v/'+$(this).attr('id')+'&amp;hl=en_EN&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="400" height="'+$(this).find("height").text()+'">';
			break;

			case "vimeo": embed += 'vimeo.com/moogaloop.swf?clip_id='+$(this).attr('id')+'&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id='+$(this).attr('id')+'&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="'+$(this).find("height").text()+'">';
			break;

			case "dailymotion": embed += 'dailymotion.com/swf/'+ $(this).attr('id')+'&amp;related=0" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><embed src="http://www.dailymotion.com/swf/'+$(this).attr('id')+'&amp;related=0" type="application/x-shockwave-flash" width="400" height="'+$(this).find("height").text()+'" allowfullscreen="true" allowscriptaccess="always">';
		}
		embed += '<\/embed><\/object>';
		//rowS = (r%2 != 0) ? "\n<\/tr>" : "";
		//rowE = (r%2 == 0 && r != numberVideos) ? "<tr>\n" : "";
		rowS = "<tr>\n";
		rowE = "<\/tr>\n";

		allCode += rowS + '<td class="cl"><h2>' + $(this).find("school").text() + '<\/h2><h3>' + $(this).find("song").text() + '<\/h3>' + embed + '<\/td>\n' + rowE;
		sumCode += $(this).find("school").text() + " ||| ";
	  });
	  $("#tblSL").append(allCode);
	  //$("#footerSum").append(sumCode);
	}
