var htpObj = null;

function bindListClickEvent()
{
    var list = $$("ul.list > li");
    for (var i = 0; i < list.length; i++) 
    {
        if (!hasClass(list[i], "date")) 
        {
            list[i].onClick = function()
            {
                for (var a = 0; a < list.length; a++) 
                    list[a].attributes.removeClass("selected");
                this.attributes.addClass("selected");
            };
        }
    }
}

//for c++
function initPage(dataLength, pageSize)
{
    var temp = [];
    for (var i = 0; i < dataLength; i++) 
        temp.push("");
    
    htpObj = new TurnPage2();
    htpObj.pageSize = pageSize;
    htpObj.actionType = -1;
    htpObj.showCount = true;
    htpObj.goCallback = function(page, data)
    {
        view.showResult(page);
        bindListClickEvent();
    };
    htpObj.init(temp, $("div.pageNav"), "htpObj");
	
    bindListClickEvent();
}

self.ready = function()
{
    view.onLoadhtmlComplete();
};