function loadYoutubeVideo(id,title) {
	
	// preloader content
	var preLoaderText = "<b>Please wait</b><br>while the video is loading ...";
	var videoElement = document.getElementById('youtubeVideo');
	videoElement.innerHTML = preLoaderText;
	
	// mark selected link (in playlist)
	var search = new RegExp(".*?"+id+".*?");
	var table = document.getElementById("playlist");
	for (var i = 0, row; row = table.rows[i]; i++) {
		var cell = row.cells[0];
		if (cell.getAttribute("class") == "active") { cell.setAttribute("class",""); }
		if (cell.innerHTML.match(search)) { cell.setAttribute("class","active"); }
	}
	
	// set title
	document.getElementById('videoTitle').innerHTML = title;
	
	// load video
	var content = "<object width='346' height='218'><param name='movie' value='http://www.youtube.com/v/"+id+"&autoplay=1&showinfo=0&rel=0&fs=1&color=red&color1=0xff9d2d&color2=0xffba35&border=0&loop=0'></param><param name='allowFullScreen' value='true'></param><embed src='http://www.youtube.com/v/"+id+"&autoplay=1&showinfo=0&rel=0&fs=1&color=red&color1=0xff9d2d&color2=0xffba35&border=0&loop=0' type='application/x-shockwave-flash'  allowfullscreen='true' width='346' height='218'> </embed> </object>";
	videoElement.innerHTML = content;
}

function reverse(string) { return string.split("").reverse().join(""); }
function getAt() { return "&"+"#"+reverse("46")+";"; }
function displayEmail(elementId) {
	elementId += "Mail";
	if (document.getElementById(elementId) != null) {
		var content = document.getElementById(elementId).innerHTML;
		if (content != null) {
			content = content.replace(" [at] ", getAt());
			content = "<a href='"+reverse("otl"+"iam")+":" + content + "'>" + content + "</a>";
			document.getElementById(elementId).innerHTML = content;
		}
	}
}
function displayEmails() {
	var elementIds = ['footer', 'profileP', 'profileO','profileGtalk'];
	for (var i = 0; i < elementIds.length; i++) { displayEmail(elementIds[i]); }
}

