define(function(require){
	var $ = require('jquery');
	var IFA = require('util');
	require('uriTemplate')($);
	require('validation')($);
	require('dialog')($);
	require('jqueryCSS');
	
	$("#btnReDispatch").bind('click',reDispatch);
	$("#btnContinue").bind('click',continueDispatch);
	$("#btnClose").bind('click',close);
	$("#return").bind("click",function(){window.close();});
	function reDispatch(){
		
		$.msg.confirm(i18ns("JS.workOrder.system.tips"),i18ns("JS.workOrder.afterRedisVehicle"),function(result){
			if(result){
				$(this).dialog("close");
			//	var urlStr = new $.Template($("#redispatchUrl").val());
				var urlStr = new $.Template($("#continuedispatchUrl").val());
				var segmentId = $("#reservationId").val();
				var params = {'reservationId':segmentId,"type":1};
				var url = urlStr.expand(params);
				location.href = url;
			}else{
				$(this).dialog("close");
			}
		});
	}
	
	function continueDispatch(){
		var urlStr = new $.Template($("#continuedispatchUrl").val());
		var segmentId = $("#reservationId").val();
		var params = {'reservationId':segmentId};
		
		var url = urlStr.expand(params);
		location.href = url;
	}
	
	function close(){
		this.close();
	}


});