﻿document.write('<script type="text/javascript" src="http://www.informazione.it/js/jquery.js"></script>');
document.write('<script type="text/javascript" src="http://www.informazione.it/js/jquery-dom.js"></script>');
document.write('<script type="text/javascript" src="http://www.informazione.it/js/jquery.dateFormat.js"></script>');
document.write('<link rel="stylesheet" type="text/css" media="all" href="http://www.informazione.it/css/widget.css" />');

infoit_width = typeof infoit_width == 'string' ? infoit_width : '300px';
infoit_height = typeof infoit_height == 'string' ? infoit_height : '350px';
infoit_border = typeof infoit_border == 'number' ? infoit_border : 1;
infoit_target = typeof infoit_target == 'number' ? infoit_target == 1 ? '_blank' : '': '';
infoit_showPics = typeof infoit_showPics == 'number' ? infoit_showPics : 1;
infoit_summary = typeof infoit_summary == 'number' ? infoit_summary == 0 ? 'no-infoitSummary' : '' : '';
infoit_theme = typeof infoit_theme == 'string' ? infoit_theme != 'infoit-widget-unstyled' ? 'infoit-widget ' + infoit_theme : infoit_theme : 'infoit-widget infoit-widget-theme1';
infoit_title = typeof infoit_title == 'string' ? infoit_title : 'TUTTE LE SEZIONI - ULTIME NOTIZIE';

if (infoit_theme.search(/infoit-widget-theme5/i) > -1) {
    infoit_customHeader = typeof infoit_customHeader == 'string' ? ' style="background: ' + infoit_customHeader + '"' : '';
    infoit_customTopic = typeof infoit_customTopic == 'string' ? ' style="background: ' + infoit_customTopic + '"' : '';
    infoit_customBody = typeof infoit_customBody == 'string' ? 'background: ' + infoit_customBody + ';' : '';
    infoit_customBorder = typeof infoit_customBorder == 'string' ? 'border-color: ' + infoit_customBorder + ';' : '';
    infoit_customLink = typeof infoit_customLink == 'string' ? infoit_customLink : '';
    infoit_customHoverLink = typeof infoit_customHoverLink == 'string' ? infoit_customHoverLink : '';
    infoit_customFooter = typeof infoit_customFooter == 'string' ? ' style="background: ' + infoit_customFooter + '"' : '';
}
else {
    infoit_customHeader = ''; infoit_customTopic = ''; infoit_customBody = ''; infoit_customBorder = ''; infoit_customLink = '';
    infoit_customHoverLink = '';infoit_customFooter = '';
}
infoit_id = typeof infoit_id == 'string' ? '' + infoit_id + '' : 'widgetContainer';

document.write('<div id="' + infoit_id + '" class="' + infoit_theme + '" style="width: ' + infoit_width + '; border-width: ' + infoit_border * 7 + 'px; ' + infoit_customBorder + '" align="left">');
document.write('<div class="infoit-widget-header" ' + infoit_customHeader + '><h1 ' + infoit_customHeader + '><a href="http://www.informazione.it" title="informazione.it - Aggregazione Notizie"></a></h1></div>');
document.write('<div class="infoit-widget-topic" ' + infoit_customTopic + '>' + infoit_title + '</div>');
document.write('<ul style="height: ' + infoit_height + ';'+infoit_customBody+'" class="' + infoit_summary + '"></ul>');
document.write('<div class="infoit-widget-footer"' + infoit_customFooter + '></div></div>');


function __infowidhelper() {
    var a = new Array();
    a.push(infoit_id);
    a.push(infoit_target);
    a.push(infoit_customLink);
    a.push(infoit_summary);
    a.push(infoit_showPics);
    a.push(infoit_customHoverLink);
    a.push(infoit_customBody);
    return a;
}

function __infowid(obj, a) {
    if (!$j) setTimeout(function() { __infowid(obj); }, 200);
    var loc_id=a[0];
    var loc_target=a[1];
    var loc_customLink=a[2];
    var loc_summary=a[3];
    var loc_showPics=a[4];
    var loc_customHoverLink=a[5];
    var loc_customBody = a[6];
    var loc_pics;
    $j('#' + loc_id + ' ul').html('');
    var s = '';
    var tpl = function() {
        return [
            'li', {}, [
                'div', { 'class': loc_pics }, ['a', { 'href': this.Url, 'target': loc_target }, '<img src="' + this.ImageUrl + '" width="50px" height="50px" align="left" title="Foto: ' + this.ImagePublication + '"/>'],
                'h3', { 'style': loc_customBody }, [
                    'a', { 'href': this.Url, 'target': loc_target, 'style': 'color: ' + loc_customLink + ' ' }, this.Title
                ],
                'p', {}, this.Incipit,
                'span', {}, s
            ]
        ];
    };
    if (!obj) {
        $j('#' + loc_id + ' ul').html('Non è stato possibile acquisire le notizie da Informazione.it. Suggeriamo di riprovare, riaggiornando la pagina.');
    }
    if (!obj || obj.length == 0) {
        $j('#' + loc_id + ' ul').html('Al momento, su Informazione.it non ci sono notizie nella categoria indicata.');
    }

    if (obj) {
        for (var i = 0; i < obj.length; i++) {
            s = '';
            if (obj[i].TotalNumberOfArticles > 1) {
                if (obj[i].TotalNumberOfArticles == 2)
                    obj[i].TotalNumberOfArticles = " ed un'altro articolo";
                else
                    obj[i].TotalNumberOfArticles = ' ed altri ' + (obj[i].TotalNumberOfArticles - 1) + ' articoli';
            }
            else
                obj[i].TotalNumberOfArticles = '';
            var h =' (da ' + obj[i].Source + obj[i].TotalNumberOfArticles + ' - ' +obj[i].ReleasedOn+')';
            if (loc_summary == '')
                obj[i].Incipit += h;
            else
                s=h;
            if (loc_showPics==0 || (loc_showPics==1 && obj[i].ImageUrl.length == 0))
                loc_pics = 'no-infoit-pics';
            else
                loc_pics = 'infoit-pics';
            $j('#' + loc_id + ' ul').tplAppend(obj[i], tpl);
        }
    }

    if (loc_customHoverLink != '') {
        var z = "$j('#" + loc_id + " ul h3 a').hover(function() { $j(this).css('color', '" + loc_customHoverLink + "'); }, function() { $j(this).css('color', '" + loc_customLink + "'); })";
        eval('(' + z + ')');
    }
}