function pixbox_alb_link_render(c, album) {
    var a_title = c.firstChild;

    while(a_title.nodeType != 1)
        a_title = a_title.nextSibling;

    var title = pixbox_trim( a_title.firstChild.nodeValue );

    var content = '';

    var pageHostname        = 'www.pixbox.se';
    var indexpicHostname    = 'archive.pixbox.se';

    var pageUriBase     = '/alb_show_id[ALB_ID]_page0.html';
    var indexpicUriBase = '/images/indexpics/generate.php?alb_id=[ALB_ID]&acc_level=0&ts=';

    var pageUri     = pageUriBase.replace('[ALB_ID]', album);
    var indexpicUri = indexpicUriBase.replace('[ALB_ID]', album);

    var pageUrl = 'http://'+pageHostname+pageUri;
    var indexpicUrl = 'http://'+indexpicHostname+indexpicUri;

    
        c.style.position = 'relative';
        c.style.backgroundColor = '#000000';
        c.style.margin = '0';
        c.style.padding = '10px';
        c.style.width = '544px';
        c.style.height = '120px';

    var c_tmp = document.createElement('div');

        var div_home = document.createElement('div');
            div_home.style.position = 'absolute';
            div_home.style.top      = '5px';
            div_home.style.right    = '5px';
            div_home.style.margin   = '0';
            div_home.style.padding  = '0';

            var a_home = document.createElement('a');
                a_home.href = 'http://www.pixbox.se/';

                var img_home = document.createElement('img');
                img_home.src = 'http://www.pixbox.se/alb/img/alb_link_logo.gif';
                img_home.width  = 51;
                img_home.height = 25;
                img_home.title = 'Pixbox';
                img_home.style.borderStyle = 'none';

            a_home.appendChild( img_home );
        div_home.appendChild( a_home );
    c_tmp.appendChild( div_home );

        //var div_title = document.createElement('div');
            a_title.style.position = 'absolute';
            a_title.style.top      = '20px';
            a_title.style.left     = '140px';
            a_title.style.margin   = '0';
            a_title.style.padding  = '0';
                while(a_title.firstChild)
                    a_title.removeChild(a_title.firstChild);
                a_title.href = pageUrl;
                
                    a_title.style.color = '#FFFFFF';
                    a_title.style.fontFamily = 'arial, verdana, helvetica, \'sans serif\'';
                    a_title.style.fontSize = '22px';
                    a_title.style.fontWeight = 'bold';
                    a_title.style.textDecoration = 'none';
                var text_title = document.createTextNode( pixbox_truncate(title, 30) );
            a_title.appendChild( text_title );
        //div_title.appendChild( a_title );
    c_tmp.appendChild( a_title );

        var a_indexpic = document.createElement('a');
            a_indexpic.href = pageUrl;

            var img_indexpic = document.createElement('img');
                img_indexpic.src = indexpicUrl;
                img_indexpic.width = 544;
                img_indexpic.height = 120;
                img_indexpic.style.borderStyle = 'none';

        a_indexpic.appendChild( img_indexpic );
    c_tmp.appendChild( a_indexpic );



    while(c.firstChild)
        c.removeChild(c.firstChild);
    c.appendChild( c_tmp );
    return true;
}

function pixbox_escapeHtml(text) {
    var container = document.createElement('div');
    container.appendChild( document.createTextNode(text) );

    return container.innerHTML;
}

function pixbox_unescapeHtml(text) {
    var container = document.createElement('div');
    container.innerHTML = text;

    return container.firstChild.nodeValue; //childNodes[0]
}

function pixbox_truncate(text, max_len) {
    if(text.length > max_len)
        return pixbox_trim( text.substring(0, max_len-2) )+"...";
    else
        return text;
}

function pixbox_trim(text) {
    return text.replace(/^\s+|\s+$/g,"");
}


