
var IndexObject = new Object();

 
/******************************************************************************
* FUNCTION    : loadActivityList
* DESCRIPTION : 获取活动公告列表
* PARAMETER   : num 获取列表的条数
* RETURNS     :  
******************************************************************************/
IndexObject.loadActivityList=function(errMsg,num){ 
	var newsUrl = "RS"+app.ACTIVITY_URL+"/"+num; 
	var ul = $("#activeList"); 
	app.proxy({
		url: newsUrl,
		type: "GET",
		dataType: 'json',
	    timeout: app.timeout, 
	    error: function(data){   
	           ul.append(errMsg);
	           return;
	        }, 
		success: function(data, textStatus, jqXHR){  
            	$.each(data,function(entryIndex,entry){   
            		var li = $("<li></li>"); 
            		li.append("<a href=\"actService/"+entry['id']+"\" title=\""+entry['title']+"\" target=\"_blank\">"+entry['title']+"</a>");
                	ul.append(li);  
             	 });    
		}
	}); 
}    
/******************************************************************************
* FUNCTION    : loadLeftActivityList
* DESCRIPTION : 获取资讯左侧的活动公告列表
* PARAMETER   : num 获取列表的条数
* RETURNS     :  
******************************************************************************/
IndexObject.loadLeftActivityList=function(num){
	var newsUrl = "RS"+app.ACTIVITY_URL+"/"+num; 
	var ul = $("#activityList");   
	app.proxy({
		url: newsUrl,
		type: "GET",
		dataType: 'json',
        timeout: app.timeout, 
        error: function(data){  
           ul.append("获取数据错误。");
           return;
        }, 
        success: function(data){   
            	$.each(data,function(entryIndex,entry){  
            		
            		var li = $("<dd></dd>"); 
            		li.append("<a href=\"actService/"+entry['id']+"\">"+entry['title']+"</a>");
                	ul.append(li);  
             	 });   
        }
	});
} 

IndexObject.loadLoginfo = function(){
	var phone =  app.user.phone.substring(app.user.phone.length - 4);
	var srv = app.user.srv;
	var x = ["星期日", "星期一", "星期二", "星期三","星期四", "星期五", "星期六"];
	var d = new Date();
	var dateStr = d.getFullYear() + "年" + (d.getMonth() + 1) + "月" + d.getDate() + "日，" + x[d.getDay()];
	
	$("#welcomeName").html(phone);
	$("#webcomeDate").html(dateStr);
	$("#welcomeSrv").html(srv);
	
	$("#phone_index_log").val("");
	$("#pwd_index_log").val("");
	$("#loginBox").hide(); 
	$("#welcomeBox").show(); 
}

//初始化页面数据
IndexObject.init=function(){     
 	//IndexObject.loadLoginfo();


	IndexObject.loadActivityList('',2);
	
//	var newsArray =new Array(['newsAList',68026368],['newsFundList',404160512]);
//	for(i=0;i<newsArray.length;i++){
//		NewsObject.loadNewList('获取数据错误..',newsArray[i][0],newsArray[i][1],9);
//	}   
//	HotStockObject.loadIndexHotStock('获取数据错误..',5);
//	NewsObject.loadNewEList('',0,1,10);
//	TradeObject.loadTradeList('',8);
//	TradeObject.loadTrade('',4);
//	changePro('dx');
//	setTimeout("IndexObject.loadActivityList('',1)",300);
//	setTimeout("NewsObject.loadNewEList('',0,1,10)",300);
//	setTimeout("TradeObject.loadTradeList('',8)",300);
//	setTimeout("TradeObject.loadTrade('',4)",300); 
   setTimeout("changePro('dx')",10); 
}
