﻿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 + '' : 'prwidgetContainer';

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/prmain.aspx" title="informazione.it - Comunicati Stampa"></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 __infowidprhelper() {
    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 __infowidpr(obj, a) {
    if (!$j) setTimeout(function() { __infowidpr(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.Contact, 'target': loc_target }, '<img src="' + this.Image1 + '" width="50px" height="50px" align="left" title="' + this.WebSite + '"/>'],
                 'h3', { 'style': loc_customBody }, [
                    'a', { 'href': this.Contact, 'target': loc_target, 'style': 'color: ' + loc_customLink + ' ' }, this.Headline
                ],
                'p', {}, this.Summary,
                'span', {}, s
            ]
        ];
    };
    if (!obj) {
        $j('#' + loc_id + ' ul').html('Non è stato possibile acquisire i comunicati stampa 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 sono disponibili i comunicati richiesti.');
    }

    if (obj) {
        for (var i = 0; i < obj.length; i++) {
            s = '';
            var h = 'Pubblicato il ' + $j.formatDate(eval('(new Date(' + obj[i].ReleaseDate.replace(/@/g, '') + '))'), 'dd/MM/yy');
            //var h = 'Pubblicato il ' + eval('(new Date(' + obj[i].ReleaseDate.replace(/@/g, '') + '))').formatDate('dd/MM/yy');

            if (loc_summary == '')
                obj[i].Summary += ' - ' + h;
            else
                s = h;
            if (loc_showPics == 0 || (loc_showPics == 1 && !obj[i].HasWebThumbnail))
                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 + ')');
    }
}