var windowId,proName = window.location.pathname.split("/")[1],sysUrl = "http://"+window.location.host+"/"+proName,toEdit;
var alarmruleid = $.getUrlParam("alarmruleid");
$(function(){
	initDetailTab();
	
	setTimeout(function(){choseSrc(1)},500);
	//choseSrc(1);
});


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



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


function choseSrc(index){
	console.log("choseSrc：",index);
	console.log("alarmruleid: ",alarmruleid);	
	if("0" == index){      // 客户端联动
		$("#clientlink").prop("src",'../../machinemanage/machinecpu/ywmachinecpu.jsp?machineid='+machineid);		
	}else if('1' == index){			// 短信联动

		$("#msglink").prop("src",'ywalarmrulelinksms_show.jsp?alarmruleid='+alarmruleid);			
	}else if('2' == index){			// 邮件联动
		$("#emaillink").prop("src",'../../machinemanage/machineharddisk/ywmachineharddisk.jsp?machineid='+machineid);		
	}
}



