 	 var datauser = 'FX168'
	 ddd=new Date();
     var datarow='';
	 var currdate=ddd.getFullYear()+'-'+(ddd.getMonth()+1)+'-'+((ddd.getDate()<10)?'0'+ddd.getDate():ddd.getDate());
	 var dataurl = 'http://service.fx168.com'
	 function ShowDetail(obj, CountryCode, columnCode, table, objrowindex) { 
		if($("#d1"+objrowindex).length>0){
			if($("#d1"+objrowindex).is(":hidden")){
			$("#d1"+objrowindex).show();
			}else $("#d1"+objrowindex).hide();
			return ;
		}
	    datarow=objrowindex;
        strDetail = "<tr id='d1"+objrowindex+"' class='xtrcon'>";
        strDetail += "<td colspan=\"6\" class=\"yjl_caijingyueli_detelBox_td\" width=\"100%\">";
        strDetail += "<div class=\"yjl_caijingyueli_detelBox\">";
        strDetail += "<div class=\"yjl_caijingyueli_detelBox_head\">";
        strDetail += "<div class=\"head_l\">";
        strDetail += "<div>";
        strDetail += "<p><span>公布值：</span><span>" + obj.cells[5].innerHTML + "</span></p>";
        strDetail += "<p><span>预测值：</span><span>" + obj.cells[4].innerHTML + "</span></p>";
        strDetail += "<p><span>前&nbsp;&nbsp;值：</span><span>" + obj.cells[3].innerHTML.split('<')[0] + "</span></p>";
        strDetail += "<p><span>重要性：</span><span>" + obj.cells[1].innerHTML + "</span></p>";
        strDetail += "</div></div>";
        strDetail += "<div class=\"head_t\">" + obj.cells[2].innerHTML + "</div>";
        strDetail += "<div class=\"head_r\"></div>";
        //strDetail += "<h3 id=newh3tr><a href=\"replaceurl\" target=\"_blank\" title=\"" + titltxt + "\">" + titltxt + "</a></h3>";
        //strDetail += "<h3 id=newh3tr>" + titltxt + "</h3>";
        strDetail += "</td></tr>";
        $(obj).after(strDetail);
        SetContentDetail(obj, columnCode, strDetail,objrowindex);
}
function SetContentDetail(obj, columnCode, strDetail,objrowindex) {
    $.ajax({
        type: "get",
        async: false,
        url: dataurl + "/IDataPlatform/FinancialCalendarNew/IFinancialCalendarDetial.ashx",
        data: "user=" + datauser + "&columnCode=" + columnCode + "&dataCount=10&succ_callback=CallbackContentDetail&rd=" + (new Date()).valueOf(),
        dataType: "jsonp",
        jsonp: "callbackfun",
        jsonpCallback: CallbackContentDetail,
        error: function (XMLHttpRequest, textStatus, errorThrown) {
        }
    });
}

//财经详细内容
function CallbackContentDetail(jsonObj) {
	SetDetailHtml(jsonObj);
}
function SetDetailHtml(jsonObj) {  
	if(jsonObj!=null&&jsonObj["List"].length>0){  
		$("#d1"+datarow+" td:eq(0)").find(".head_r").html(jsonObj["List"][0].Define);
	}
}
function SetContent(beginDate) { 
	currdate=beginDate;
	if($("[ty="+currdate+"]").length>0){
		$("[ty]").removeClass("tt");
		$("[ty="+currdate+"]").addClass("tt");
	}
    $.ajax({
        type: "get",
        async: true,
        url: dataurl + "/IDataPlatform/FinancialCalendarNew/IFinancialCalendarData.ashx",
        data: "user=" + datauser + "&beginDate=" + beginDate + "&rd=" + (new Date()).valueOf(),
        dataType: "jsonp",
        jsonp: "succ_callback",
        jsonpCallback: "CallbackContent",
        error: function (XMLHttpRequest, textStatus, errorThrown) {
        }
    });
}
function CallbackContent(jsonObj) {
    SetHtml(jsonObj);
}
//拼html 
function SetHtml(jsonObj) {
    if (jsonObj == null) {
        return;
    } 
    var ftable = "";
    var FinancialCalendarData = jsonObj["List"][0]["FinancialCalendarData"];
    var x_str = "";
    if (FinancialCalendarData != null) {
		var dd=[];
        if (FinancialCalendarData.length > 0) {
            for (var i = 0; i < FinancialCalendarData.length; i++) {
				if(i>6)break;
                var Predict = FinancialCalendarData[i]["Predict"] == "" ? "无" : FinancialCalendarData[i]["Predict"];
                var CurrentValue = FinancialCalendarData[i]["CurrentValue"] == "" ? "无" : FinancialCalendarData[i]["CurrentValue"];
                dd.push("<div style='height:15px;line-height:18px;padding:0px 0px 5px 0px;font-size:12px;color:#ccc;'><div class=title>"+ FinancialCalendarData[i]["CountryName"] + "&nbsp;" + FinancialCalendarData[i]["Content"]+"</div>");
				dd.push("<span class=yuji>预计:" + Predict + "</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=shiji>实际:" + CurrentValue + "</span>");
				dd.push("</div>");  
            }
            $("#list").html(dd.join(""));
        }else
        	{
        	$("#list").html("今日无重要预告公布！");
        	} 
        
    }
}
$(function(){
	
	var ttttt=function(){
		SetContent(currdate);
		setTimeout(function(){ttttt();},60000); 
	}
	ttttt();
	
});