function roundTo(decimalpositions)
{
    var i = this * Math.pow(10,decimalpositions);
    i = Math.round(i);
    return i / Math.pow(10,decimalpositions);
}
Number.prototype.roundTo = roundTo;


/**********************************************************************/

function embedVideo(selector, link, w, h){
	pos = link.search(/v=(.*)/);
	vid = link.slice(pos + 2);
	$(selector).prepend('<object width="'+ w +'" height="'+ h +'"><param name="movie" value="http://www.youtube.com/v/'+ vid +'&hl=it&fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/'+ vid +'&hl=it&fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="'+ w +'" height="'+ h +'"></embed></object>')
}

function thumbVideo(link){
	pos = link.search(/v=(.*)/);
	vid = link.slice(pos + 2);	
	thumb = 'http://img.youtube.com/vi/'+ vid +'/2.jpg';
	
	return thumb;
}

// puņ essere migliorato ed esteso ad altri social video

