var winId	= $.getUrlParam("winId");
var machinestate = top.$("#"+winId).panel("options").data;

$(function(){
	initDetailTab();
});


function initDetailTab(){
	detailtab = $("#detailtab").tabs({
		onSelect:function(title,index){
//			console.log("title 和 index",title,index);
			setTimeout(function(){choseSrc(index)},500);
		}
	});
}



// 点击 左侧 查询右侧信息
function setchecked(){
	
	var choseId = $('#detailtab').tabs('getSelected').find("iframe").attr("id");
//	console.log("choseId: ===========",choseId);
	if("detailInfo" == choseId){
		choseSrc(0);
	}else if("historystate" == choseId){
		choseSrc(1);
	}
}


function choseSrc(index){
 	var machineid = machinestate.machineid;
 	var currentstateid = machinestate.currentstateid;
	if("0" == index){      // 详情
		$("#detailInfo").prop("src",'ywydpdetail.jsp?xh='+currentstateid);
		
	}else if('1' == index){			// 历史信息
		$("#historystate").prop("src",'ywydphistorystate.jsp.jsp?xh='+currentstateid);
	}
}



