define(function(require){
	var $ = require('jquery');
	require('uriTemplate')($);
	require('dialog')($);
	require("../../../styles/cim/jquery-ui-1.8.14.custom.css");
	$(function(){
		$('#nightserviceStatus').bind('click',changeStatus);
	});
		function changeStatus(){
			if(document.getElementById("nightserviceStatus")==null){
				return false;
			}
			var str =i18n['Page.changeToNormal'];
			if(serviceStatus=="ON"){
				str =i18n['Page.changeToNightservice'];
			}
			$.msg.confirm(i18n['Page.title.dialogshow.title'],str,function(result){
				if(result)
					{
					var jsonData={"nightserviceStatus":serviceStatus,'_method':'PUT'};
					var url = $('#nightServiceUpdateUrl').val();
					$.ajax({url:url+'.json',type:'post',data:jsonData,
							success:function(response){ 
								serviceStatus=response.newStatus;
								document.getElementById("nightserviceStatus").innerHTML=response.currentStatus;
					}});				
					}
			});

		}
});