// returns true if string contains any of the strings in strings_to_find 
function string_contains_one_of (string, strings_to_find) { 
	for (var i=0; i < strings_to_find.length; i++) {  
		if (string.indexOf(strings_to_find[i]) != -1) { 
    		return true;     
		}  		
	}  
	return false; 
} 

// returns true if the browser can play h264 in a <video> tag 
function browser_supports_html5_h264() { 
	var user_agent = navigator.userAgent.toLowerCase() 
	return string_contains_one_of (user_agent, ["iphone", "ipod", "ipad", "chrome"]);    
} 

// replaces the contents of player_div_id with the contents  
// of html5_player_div_id if the browser supports playing h264 in  
// an HTML5 <video> tag 

function use_html5_player_if_supported (player_div_id, html5_player_div_id) { 
	if (browser_supports_html5_h264()) { 
		document.getElementById(player_div_id).innerHTML = document.getElementById(html5_player_div_id).innerHTML;  
	}          
}   

