
function fbs_click()
{
    u=location.href;
    t=document.title;
    window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
    return false;
}

function twiter_click() 
{			                
    var u=location.href;			                    
    var urlLength = location.href.length;
    var documentLength = document.title.length;
    var tamanio = documentLength + urlLength;
    
    var MaxTamanio = 140;
  
    var t = document.title;
    		                   
    if (tamanio  > MaxTamanio)
    {
        t = ''; 
        var TitlePalabras  = document.title.split (" ");
        var estado = true;
        var indice = TitlePalabras.length - 1;
        var tamanioDif = tamanio - MaxTamanio;
        while (estado)
        {			                        
           var tamanioWord =  TitlePalabras[indice].length;			                           
           TitlePalabras[indice] = '';
           indice = indice - 1;
           tamanioDif= tamanioDif - tamanioWord;
           if (indice < 0)
           {
                estado= false;
           }
           else if (tamanioDif <= 0)
           {
                estado= false;
           }			                          
        }
    
        for (var ind = 0 ; ind < TitlePalabras.length ; ind++)
        {
            if (TitlePalabras[ind] != '')
            {
                var NewTitle = t + ' ' + TitlePalabras[ind] + ' ... ' + u ;
                if (NewTitle.length < MaxTamanio)
                {
                   t = t + ' ' + TitlePalabras[ind];
                }
            }
        }
        
    }
    window.open('http://twitter.com/home?status=' + t  + ' ... ' + u ,'sharer','toolbar=0,status=0,width=626,height=436');
    return false;
}

function  GetThis()
{
    
}

function GetThisDelicious()
{                            
    var T = document.title;
    var U = location.href;
    var targetUrl = 'http://del.icio.us/post?url=' + encodeURIComponent(U) + '&title=' + encodeURIComponent(T);
    window.open(targetUrl,'sharer','toolbar=0,status=0,width=626,height=436');
    return false;
}
function GetThis()
{                            
    var T = document.title;
    var C = ' ';
    var U = location.href;
    var L = ' ';
    var targetUrl = 'http://www.myspace.com/index.cfm?fuseaction=postto&' + 't=' + encodeURIComponent(T) + '&c=' + encodeURIComponent(C) + '&u=' + encodeURIComponent(U) + '&l=' + L;
    window.open(targetUrl,'sharer','toolbar=0,status=0,width=626,height=436');
    return false;
}   
document.getElementById('botonescompartir').innerHTML = "<span >Compartir: </span> <a style='cursor:pointer;padding: 0pt 5px 0pt 4px' onclick='return fbs_click()' target='_blank' title = 'Facebook' ><img src='/versiones/v1/img/Global/FaceBook.png' alt='Facebook' /></a> "
+ " <a style='cursor:pointer;padding: 0pt 5px 0pt 4pt' onclick='return twiter_click()' target='_blank' title = 'Twitter'><img src='/versiones/v1/img/Global/twiter.png' alt='Twitter' /></a> "
+ " <a style='cursor:pointer;padding: 0pt 5px 0pt 0pt' onclick='return GetThis();' target='_blank' title = 'MySpace'><img src='/versiones/v1/img/Global/post_myspace_icon.gif' border='0' alt='MySpace' /></a> "
+ " <a style='cursor:pointer;padding: 0pt 5px 0pt 0pt' onclick='return GetThisDelicious()' target='_blank' title = 'Delicious'><img src='/versiones/v1/img/Global/delicious_icon.png' alt='Delicious' /></a> " ;
