$(document).ready(function(){  
	 getData(1);
	 getDataLastVideos(1);
}); 
	
function getData(pageId) {

defaultParameters = "pageId=" + pageId;
							
$.ajax({
	type: "GET",
	url: "pagerServices/HomePageProgramlar.aspx",
	data: defaultParameters,
	contentType: "application/json; charset=utf-8",
	dataType: "json",
	success: (
			function Success(data) {
				
				var dataLength=data.TotalRecords;
				var pageTotal =dataLength/6;
			   
				if( pageTotal > parseInt(pageTotal) ){ pageTotal=parseInt(pageTotal)+1 }
				
			   $("#programsAll").setTemplateURL('AjaxPage/HomePageProgramlar.html', null, { filter_data: false });
			   $("#programsAll").setParam('pageNumber', pageId);
			   $("#programsAll").processTemplate(data);
			   
			}),
	error: (function () {
		
		alert("error");
		
	})
});

}

function getDataLastVideos(pageId) {

defaultParameters = "pageId=" + pageId;
							
$.ajax({
	type: "GET",
	url: "pagerServices/HomePageLastVideos.aspx",
	data: defaultParameters,
	contentType: "application/json; charset=utf-8",
	dataType: "json",
	success: (
			function Success(data) {
				
				var dataLength=data.TotalRecords;
				var pageTotal =dataLength/6;
			   
				if( pageTotal > parseInt(pageTotal) ){ pageTotal=parseInt(pageTotal)+1 }
				
			   $("#LastVideosAll").setTemplateURL('AjaxPage/LastVideos.html', null, { filter_data: false });
			   $("#LastVideosAll").setParam('pageNumber', pageId);
			   $("#LastVideosAll").processTemplate(data);
			   
			}),
	error: (function () {
		
		alert("error");
		
	})
});

}
