var request = getRequest();
var selectedTab = 0;

//初始tab的链接
var links = [{
    url: 'followup-register.html'+location.search,
    name: '随访登记',
    class: 'active'
},{
    url: 'questionaires.html'+location.search+'&pro_id=1&title=症状',
    name: '症状',
    class: ''
},{
    url: 'questionaires.html'+location.search+'&pro_id=2&title=体征',
    name: '体征',
    class: '',
},{
    url: 'questionaires.html'+location.search+'&pro_id=3&title=实验室检查',
    name: '实验室检查',
    class: ''
},{
    url: 'questionaires.html'+location.search+'&pro_id=4&title=生活方式指导',
    name: '生活方式指导',
    class: ''
},{
    url: 'questionaires.html'+location.search+'&pro_id=5&title=评价',
    name: '评价',
    class: ''
},{
    url: 'drugs.html'+location.search+'&pro_id=6&title=用药情况',
    name: '用药情况',
    class: ''
},{
    url: 'questionaires.html'+location.search+'&pro_id=7&title=控制目标',
    name: '控制目标',
    class: ''
},{
    url: 'questionaires.html'+location.search+'&pro_id=8&title=健康教育',
    name: '健康教育',
    class: ''
},{
    url: 'questionaires.html'+location.search+'&pro_id=9&title=转诊',
    name: '转诊',
    class: ''
}];

$(function(){
    
    var html = template("fv_tab_tmp", {list: links});
    $("#fv_tabs").empty().append(html);
//  parent.document.getElementById('fv_main').src = links[0].url;
    
    $("#fv_tabs").on('click', 'a', function(){
        var $this = $(this),
            $li = $this.parent();
        $li.siblings().removeClass("active");
        $li.addClass("active");
        selectedTab = $this.data('index');
//      reqLinkList.push(links[tab].url+'&from=tab&fromTabIdx='+fromTabIdx);
        var url = links[selectedTab].url;
        parent.document.getElementById('fv_main').src = url;
    })
})

top.goFollowupNextQuestionaire = function(){
    selectedTab ++;
    $("#fv_tabs a").eq(selectedTab).trigger('click');
}
