function buildVideoHTML(video_id) { 
	var html = "<object width='300' height='250'>" +
	  			"<param name='movie' value='http://www.youtube.com/v/" + video_id + "&rel=1&color1=0x2b405b&color2=0x6b8ab6&border=0&fs=1'></param>" +
	  			"<param name='wmode' value='transparent'></param>" +
	  			"<param name='allowFullScreen' value='true'></param>" +
	  			"<embed src='http://www.youtube.com/v/" + video_id + "&rel=1&color1=0x2b405b&color2=0x6b8ab6&border=0&fs=1'" +
	    		"type='application/x-shockwave-flash' wmode='transparent' allowfullscreen='true' width='300' height='250'></embed>" +
			"</object>";
			
	if(video_id === undefined || video_id === "None") html = "";
	return html;
}

function buildMarkerHTML(solar_object) { 
	var html = "";
	if(solar_object.has_visited === "True") {
		html = "<strong><a href='/planet/" + solar_object.id + "/' />" + solar_object.city_name + "</a></strong>" + "<br>" + 
				"<strong>" + solar_object.date_visited + "</strong>" + "<br>";
				
		if(solar_object.description !== "None") {
			html += "" + unescapeHTML(solar_object.description) + "" + "<br>";
		}
		
		if(solar_object.youtube_id !== "None") { 
			html += buildVideoHTML(solar_object.youtube_id);
		}
	}
	else {
		html = "<strong>" + solar_object.city_name + "</strong>" + "<br>" +
				"<strong>" + solar_object.date_visited + "</strong>" + "<br>" +
				"<strong>No. of Votes:</strong>" + solar_object.votes + "<br>" +
				"<a href=\"javascript:submitVote(" + solar_object.id + ")\" class=\"vote-link\">Vote</a>";
	}
	return "<div class=\"bubble-content\">" + html + "</div>";
}

function unescapeHTML(html) { 
	html = html.replace(/&amp;/g,'&');
	html = html.replace(/&lt;/g,'<');
	html = html.replace(/&gt;/g,'>');
	html = html.replace(/&quot;/g,'"');
	html = html.replace(/&#39;/g,"\'");
	return html;
}

