$(document).ready(function() {
	$("#smsDetail1").bind("click",smsServices);
});

function smsServices(event) {
 var idreg = $(this).attr("idreg");
 var svr = $(this).attr("svr");
 var currentPage = $(this).attr("currentPage");
 var ctgr = $(this).attr("ctgr");
 var key = $(this).attr("key");
 var sdate = $(this).attr("sdate");
 var edate = $(this).attr("edate");
 var jumpPage = $(this).attr("jumpPage");
 var totalPages = $(this).attr("totalPages");
 var input = $(this).siblings("@name=pageNum").val();
 
	if(jumpPage == '1')
	{
		var currentPage = input*1;

		if(currentPage != 0)
		{
			if (currentPage > totalPages)
				alert("Halaman Terakhir adalah "+totalPages);
// alert ("teytre");
			else
				getsmsModule(idreg,svr,currentPage,sdate,edate,jumpPage);
		}
	}
	else
		getsmsModule(idreg,svr,currentPage,sdate,edate,jumpPage);

}

function getsmsModule(idreg,svr,currentPage,sdate,edate,jumpPage){
	
		var fopts ="";
		var showsfilters="";
		var judul ="SMS"; 
		//showsfilters=true;
		fopts = { id: idreg };
		var url  = "modules/";	
		var pctgr = function() {
			  $("a[@class=newPage]").bind("click",smsServices);
			  $("input[@class=searchButton]").bind("click",smsServices);
			  $("#smsDetail1").bind("click",smsServices);
			  $("a[@class=newPage]").bind("click",smsServices);
			  //$("div#cont-submenu").empty();
		  }
		var idreg = idreg;	
		var options = {title : judul, url: url, filterOptions : fopts, id : idreg, showfilter : false};
		var pars = {id : idreg, idreg : idreg, svr : svr, sdate:sdate, edate:edate, currentPage :currentPage}; 
		Container.displayOnView(options,pars, function( ) {
			$("a[@class=newPage]").bind("click",smsServices);
			$("input[@class=searchButton]").bind("click",smsServices);	
			$("#smsDetail1").bind("click",smsServices);
			$("a[@class=newPage]").bind("click",smsServices);
			$("#cont-submenu").empty();
		         });
}

function reportError(request){
  	alert('Sorry. There was an error.');
}

function menusmsServices(){
getsmsModule("sms","s12");
}

