browserSelect = function() {
	var browserName = "";
	
	var ua = navigator.userAgent.toLowerCase();
	if ( ua.indexOf( "opera" ) != -1 ) {
		browserName = "opera";
	} else if ( ua.indexOf( "msie" ) != -1 ) {
		browserName = "msie";
	} else if ( ua.indexOf( "safari" ) != -1 ) {
		browserName = "safari";
	} else if ( ua.indexOf( "mozilla" ) != -1 ) {
		if ( ua.indexOf( "firefox" ) != -1 ) {
			browserName = "firefox";
		} else {
			browserName = "mozilla";
		}
	}
	
	return browserName;
};

firefoxVersion = function() {
	var agent = navigator.userAgent;
	var lastSlash = agent.lastIndexOf('/');
	var firefoxVer = agent.charAt(lastSlash + 1);
	return parseInt(firefoxVer);
}

insertVideo = function(youTubePath, oggPath, imagePath) {

	var youtube = "<object width=\"480\" height=\"385\"><param name=\"movie\" value=\"" + youTubePath + " &hl=it_IT&fs=1&rel=0&color1=0x234900&color2=0x4e9e00\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\"" + youTubePath + "&hl=it_IT&fs=1&rel=0&color1=0x234900&color2=0x4e9e00\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"480\" height=\"385\"></embed></object>";
	var oggvideo = "<video id=\"video\" src=\"" + oggPath + "\" controls=\"controls\"></video>";
	
	var useogg = false;
	var browser = navigator.appName;
	var browser2 = browserSelect();
	var useragent = navigator.userAgent;
	var brVers  = navigator.appVersion;
	var hasFlash = navigator.mimeTypes["application/x-shockwave-flash"];
	
	if (browser2 == "firefox") {
		var fVer = firefoxVersion();
		if (fVer >= 3) {
			useogg = true;
		}
	}
	
	if (useogg) {
		document.write(oggvideo);
	} else if (hasFlash) {
		document.write(youtube);
	} else {
		document.write("<img alt=\"Video placeholder image\" src=\"" + imagePath + "\"/>");
	}
	return;
}