define(function(require){
	var $ = require('jquery');
	require('dialog')($);
	require('uriTemplate')($);
	var IFA = require('util');
	require("../../../styles/cim/jquery-ui-1.8.14.custom.css");
	require('../../../styles/cim/cim-grid.css');
	var urlString=new $.Template($("#resHisUrl").val());
	$("a[name='showDetail']").each(function(i){
		$(this).click(function(){
			var urlParams={"hisResId":$(this).attr("hisResId")};
			var url=urlString.expand(urlParams);
			window.showModalDialog(url,window,'dialogWidth=1050px;dialogHeight=700px');
			});
	});
	//返回按钮
	$("#closeButton").bind("click",function(){
		window.close();
	});
	
	$("a[id^=emailDetail]").bind("click",function(){
		var v = $(this).attr("id");
    	var urlStr = new $.Template($("#emailDetailUrl").val());
    	var urlParam = {"id":v.substring(11,v.length)};
    	var url = urlStr.expand(urlParam);
    	 window.showModalDialog(url,window,'dialogWidth=1050px;dialogHeight=700px');
	});
	
	$("a[id^=smsDetail]").bind("click",function(){
		var v = $(this).attr("id");
    	var urlStr = new $.Template($("#smsDetailUrl").val());
    	var urlParam = {"id":v.substring(9,v.length)};
    	var url = urlStr.expand(urlParam);
    	 window.showModalDialog(url,window,'dialogWidth=1050px;dialogHeight=700px');
	});
	$("tr[id^=line]").bind("mouseover",function(){
		$(this).find("td").attr("style","background-color:#DFE8FF");
	});
	$("tr[id^=line]").bind("mouseout",function(){
		$(this).find("td").attr("style","");
	});
	
	$("table[id^='statusTitle']").bind('click',function(){
		var item = $(this);
		var itemNext =item.next();
		itemNext.toggle();
		var index = item.attr("data");
		if(itemNext.css("display")=="none"){
			$("#arrow"+index+"1").hide();
			$("#arrow"+index+"2").show();
		}else{
			$("#arrow"+index+"2").hide();
			$("#arrow"+index+"1").show();
		}
	});
});