html5 multi src javascript

hi guys,

im trying to get javascript choose a suitable src for the browser but i cant seem to get it to work.

this is what i have.


$('#slideMenu img').click (function(){

	var sourceMp4 = $('#mp4');
	var sourceOgv = $('#ogv');
	var	img = $(this);
	var mp4 = img.attr('data-mp4');
	var ogv = img.attr('data-ogv');
	//sourceMp4.attr('src', mp4);
	//sourceOgv.attr('src', ogv);
	var vid = $('video').get(0);
	vid.src = mp4;


any ideas? please?

thx in advanceā€¦