var title = new Array();
var content = new Array();
var time = new Array();

title[0] = "Beijing: 10-year Anniversary Reception of the H&auml;ger Law Firm";
time[0] = "December 11, 2009 Beijing";
content[0] = "On the Occasion of its 10th anniversary the H&auml;ger Law Firm holds a cocktail reception on December 11th at the Beijing office at 7:00 PM. RSVP: <a href=\"mailto:lobby@h-group.eu\">lobby@h-group.eu</a>";

title[1] = "Berlin: 10-year Anniversary Reception of the H&auml;ger Law Firm";
time[1] = "January 22, 2010 Berlin";
content[1] = "On the Occasion of its 10th anniversary the H&auml;ger Law Firm holds a cocktail reception on January 22nd at the Berlin office at 6:00 PM. RSVP: <a href=\"mailto:lobby@h-group.eu\">lobby@h-group.eu</a>";

title[2] = "The H&auml;ger Group participates in Beijing Outbound Investment Talks";
time[2] = "April 28, 2010 Beijing";
content[2] = "From April 26th to 28th, 2010 attorneys of the H&auml;ger Group participated in an Outbound Investment Conference in Beijing hosted by the Ministry of Comerce and supported by the Ministry of Foreign Affairs. An interview with Attorney F. Georg H&auml;ger was featured <a href=\"http://www.ibtimes.com.cn/articles/20090424/deguo-touzi.htm\" target=\"_blank\">in the Chinese media</a>.";

// add more news here, the later news with higher index number.

var itemsInHome = 3;    //show how many news in home page
var itemsPerPage = 3;   //show how many items per page in news page.

var current = 0;
var total = Math.ceil(title.length / itemsPerPage);

var homeContent;

function next()
{
    current = current + 1;
    showNews();
}

function prev()
{
    current = current - 1;
    showNews();
}

function showNews()
{
    var newsContent;
    newsContent = "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"8\" class=\"M_text_a\"><tr><td colspan=\"2\" class=\"management_line\"></td></tr>";
    for (i=current*itemsPerPage; i<Math.min((current+1)*itemsPerPage,title.length); i++)
    {
        newsContent += "<tr><td width=\"30px\" valign=\"top\">¡ö</td><td><b>" + title[title.length-i-1] + "</b>&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"time\">" + time[title.length-i-1] + "</span></tr><tr><td></td><td>" + content[title.length-i-1] + "</td></tr>";
        newsContent += "<tr><td height=\"20px\"></td></tr>";
    }
    
    if (title.length > itemsPerPage)
    {
        newsContent += "<tr><td></td><td align=\"right\" style=\"padding-right:10px\">";
        if (current < total - 1)
        {
            newsContent += "<div class=\"div_nav_enable\" onclick=\"next();\">&gt;</div>";
        }
        else
        {
            newsContent += "<div class=\"div_nav_disable\">&gt;</div>";
        }
        if (current > 0)
        {
            newsContent += "<div class=\"div_nav_enable\" onclick=\"prev();\">&lt;</div>";
        }
        else
        {
            newsContent += "<div class=\"div_nav_disable\">&lt;</div>";
        }
        newsContent += "</td></tr><tr><td></td><td align=\"right\" class=\"time\" style=\"padding-right:10px;\">Page " + (current+1) + " of " + total + "</td></tr>";
    }
    newsContent += "</table>";
    
    var td = document.getElementById("newscontent");
    td.innerHTML = newsContent;
}

function showNewsHome()
{
    var newsContent;
   
    newsContent = "<table border=\"0\" width=\"100%\" cellpadding=\"2\" cellspacing=\"2\">";
    for (i=0; i<itemsInHome; i++)
    {
        newsContent += "<tr><td>" + title[title.length-i-1] + "</b>&nbsp;&nbsp;<span class=\"time\">" + time[title.length-i-1] + "</span></td></tr>";        
    }
    newsContent += "<tr><td align=\"right\" class=\"M_text_a\"><a href=\"en/news.html\">More</a></td></tr></table>";
    
    var td = document.getElementById("newscontenthome");
    td.innerHTML = newsContent;
}

