function myVideoViews() {
	var url = $('#videoUrl').text();
	var isYoutube = false;
	if (url.indexOf('youtube.com')> -1){
		isYoutube = true;
	}
	var allUrlValues = url.split('/');
	
	
	var myId = allUrlValues[allUrlValues.length -1]; 
	var num = 0;
	
	if (isYoutube == true){
		
		$.get( 'https://gdata.youtube.com/feeds/api/videos/'+myId+'?v=2&alt=json',
		function(resp){
			num = resp.entry.yt$statistics.viewCount;
			num = (""+num).replace(/\B(?=(\d{3})+(?!\d))/g, " ");
			
			showP(num);
		});
	}
	
	else{
		$.get( 'http://vimeo.com/api/v2/video/'+myId+'.json', 
		function(resp){ 
			num= resp[0].stats_number_of_plays;
			num = (""+num).replace(/\B(?=(\d{3})+(?!\d))/g, " ");
			
			showP(num);
		});
	}
}

function showP(num){ 
	$('#vues').text(num +' '+ $('#vueWebLabel').text());
	
	$('#vues').show();			
}

myVideoViews();
