// 获取图文信息栏目结构化数据
// [{title: '', href: '', src: ''}]
//
function getPicNews(sourceid) {
    var results = [];
    var source = document.getElementById(sourceid);
    // 遍历所有table对象,找出id为table2的对象,并提取其内部包含的数据
    var tables = source.getElementsByTagName('table');
    for (var i = 0, j = 0; i < tables.length; i++) {
        if (tables[i].id.toLowerCase() != 'table2') continue;
        var temp;
        try {
            temp = tables[i].rows[0].cells[0].childNodes[0].childNodes[0];
            if (temp.childNodes[0].tagName.toLowerCase() == 'img') {
                results[j] = { title: temp.title, href: temp.href, img: temp.childNodes[0].src };
            }
        }
        catch (e) {
            temp = tables[i].rows[1].cells[0].childNodes[0];
            results[j] = { title: temp.title, href: temp.href, img: '' };
        }
        j++;
    }
    return results;
}

function xCreateSlideDom(source) {
    var ul = document.createElement('ul');
    ul.className = "Slides";
    try {
        var li;
        for (var i = 0; i < source.length; i++) {
            if (source[i].img == '') continue;
            li = document.createElement('li');
            li.innerHTML = '<a href="' + source[i].href + '" title="' + source[i].title + '"><img src="' + source[i].img + '" alt="' + source[i].title + '" /></a>'
            ul.appendChild(li);
        }
    }
    catch (e) {
    }
    return ul;
}

function xCreateListDom(source) {
    var ul = document.createElement('ul');        
    try {
        var li;
        for (var i = 0; i < source.length; i++) {
            li = document.createElement('li');
            li.innerHTML = '<a href="' + source[i].href + '" title="' + source[i].title + '"  >' + source[i].title + '</a>';
            ul.appendChild(li);
        }
    }
    catch (e) { }
    return ul;
}