function GetYouTubeCode(cLink, cLinkType, cWidth, cHeight){
    //http://youtu.be/KsxSxF3JKeU
    //<iframe width="560" height="349" src="http://www.youtube.com/embed/KsxSxF3JKeU" frameborder="0" allowfullscreen></iframe>
    //var newLink = cLink.substring(cLink.lastIndexOf("/") + 1);
		
    var newLink = '';
	
    var url = cLink;
    matches = url.match(/^http:\/\/(?:www\.)?youtube.com\/watch\?(?=.*v=([\w\-_]+))(?:\S+)?$/i);
    if( matches ) {
        newLink = matches[1];
    }
    matches = url.match(/^http:\/\/youtu.be\/([\w\-_]+)$/i);
    if( matches ) {
        newLink = matches[1];
    }
    
    var thumbYT = 'http://i1.ytimg.com/vi/'+newLink+'/hqdefault.jpg';
		
    //newLink = "http://www.youtube.com/embed/" + newLink;
    //http://www.youtube.com/v/KsxSxF3JKeU
    //alert(newLink);
    var codeToReturn = [];
    var codeToInsert = ''; 
    if(cLinkType == 'iFrame'){
        newLink = "http://www.youtube.com/embed/" + newLink;
        codeToInsert = '<iframe width="' + cWidth + '" height="' + cHeight + '" src="' + newLink +'" frameborder="0" allowfullscreen></iframe>';
    }
    if(cLinkType == 'object'){
        newLink = "http://www.youtube.com/v/" + newLink;
        //alert(newLink);
        codeToInsert = '<object width="' + cWidth + '" height="' + cHeight + '"><param name="movie" value="' + newLink +'?version=3&amp;hl=es_ES"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param name="wmode" value="transparent" /><embed src="' + newLink +'?version=3&amp;hl=es_ES" type="application/x-shockwave-flash" width="' + cWidth +'" height="' + cHeight +'" allowscriptaccess="always" allowfullscreen="true"></embed></object>';
    }
		
    codeToReturn[0]=thumbYT;
    codeToReturn[1]=codeToInsert;
    return codeToReturn;
    
}
