function detectVideoSupport(){
	if( navigator.userAgent.match(/iPhone/i) ||
	navigator.userAgent.match(/iPod/i) ||
	navigator.userAgent.match(/iPad/i)
	) {
	return true;
	}
}

var replaceVideoWithObject = function (video_id){    
    if(!video_id){ return false; }
    var video = document.getElementById(video_id);
    if(video){
        var obj = video.getElementsByTagName("object")[0];
        if(obj){
            var obj_copy = obj.cloneNode(true);
            video.parentNode.insertBefore(obj_copy, video);
            //document.body.removeChild(video);
            video.parentNode.removeChild(video);
        }
    }
};

window.onload = function (){
    //Both Opera and firefox support ogg but lack MP4 support
    if(!detectVideoSupport()){
        replaceVideoWithObject("player");
    }
};

