
	function Right(str, n){
		if (n <= 0)
		   return "";
		else if (n > String(str).length)
		   return str;
		else {
		   var iLen = String(str).length;
		   return String(str).substring(iLen, iLen - n);
		}
	}


	// Update the video list
	xVideoDiv = document.getElementById('mhVideos');
	xNodes = xVideoDiv.getElementsByTagName('A');
	for (var i = 0;  i < xNodes.length; i++) {
		xNode = xNodes[i];
		if (xNode.href.indexOf('youtube') > 0) {
			xYouTubeID = Right(xNode.href, 11);
			xTitle = xNode.innerHTML.replace("'", "&acute;");
			xNode.href = "javascript:mhShowVideo('" + xYouTubeID + "','" + xTitle + "','yt')";
			newImg = document.createElement('img');
			newImg.setAttribute('src', 'http://i.ytimg.com/vi/' + xYouTubeID + '/2.jpg');
			xNode.insertBefore(newImg, xNode.firstChild);
		};
		if (xNode.href.indexOf('.wmv') > 0) {
			xTitle = xNode.innerHTML.replace("'", "&acute;");
			xNode.href = "javascript:mhShowVideo('" + xNode.href + "','" + xTitle + "','wmv')";
			newImg = document.createElement('img');
			newImg.setAttribute('src', '/skin/frontend/default/maupinhouse/images/Listen.gif');
			xNode.insertBefore(newImg, xNode.firstChild);
		}
		if (xNode.href.indexOf('.mp3') > 0) {
			xTitle = xNode.innerHTML.replace("'", "&acute;");
			xNode.href = "javascript:mhShowVideo('" + xNode.href + "','" + xTitle + "','wmv')";
			newImg = document.createElement('img');
			newImg.setAttribute('src', '/skin/frontend/default/maupinhouse/images/Listen.gif');
			xNode.insertBefore(newImg, xNode.firstChild);
		}
	};
