<br />
<b>Deprecated</b>:  Function ereg() is deprecated in <b>/home/webizyum/public_html/1.1/index.php</b> on line <b>101</b><br />
<br />
<b>Deprecated</b>:  Function ereg() is deprecated in <b>/home/webizyum/public_html/1.1/index.php</b> on line <b>108</b><br />
$(document).ready(function() {
	$.fn.Grid = function(action, Options) {
		var ContainerId = this.selector.replace('#', '');
		var html = '';
		Grid = {};
		if(typeof(action) == 'object') {
			Options = action;
			action = 'getdata';
		}
		
		if(action == 'getdata') {
			$.ajax({
				type: 'POST',
				dataType: 'json',
				url: Options.url,
				data: 'options=' + $.toJSON(Options),
				success: function(j) {
					if(j.result == 'ok') {
						html = '';
						html += '<tr id="header">';
						colCount = 0;
						$.each(Options.headers, function(field, title) {
							if(field == '_op') {
								html += '	<th>İŞLEMLER</th>';
							}
							else {
								html += '<th>' + (title.match('||') ? title.split('||')[0] : title) + '</th>';
							}
							colCount++;
						});
						html += '</tr>';
						if(j.count > 0) {
							$.each(j.data, function(k, item) {
								html += '<tr id="item__' + item.id + '" class="';
								if(typeof(item.expireIn) != 'undefined') {
									if(item.expireIn < 0) 		{	html += 'blackbg whitetxt bold'; }
									else if(item.expireIn < 10) {	html += 'redbg whitetxt'; }
									else if(item.expireIn < 30) {	html += 'orangebg'; }
									else if(item.expireIn < 60) {	html += 'yellowbg'; }
									else						{	html += 'whitebg'; }
								}
								else {
									html += 'whitebg';
								}
								if(typeof(Options.trClass) != 'undefined') {
									html += ' ' + Options.trClass;
								}
								html += '">';
								$.each(Options.headers, function(field, title) {
									if(field == '_op') {
										html += '	<td class="whitebg center _opcol">' + title.replace('__ISLOCKED__', item.locked).replace('__ISAREN__', item.auto_renew) + '</td>';
									}
									else {
										html += '	<td';
										if(title.match('||')) {
											html += ' class="' + title.split('||')[1] + '"';
										}
										html += '>' + item[field] + '</td>';
									}
								});
								html += '</tr>';
							});
						}
						else {
							html += '<tr>';
							html += '	<td colspan="' + colCount + '" class="center bold">Kayıt bulunamadı</td>';
							html += '</tr>';
						}
						
						html += '<tr id="footer">';
						html += '	<td>Her sayfada ' + j.postback.dpp + ', toplam ' + j.count + ' kayıt.</td>';
						html += '	<td colspan="3">';
						html += '		Sayfa: ';
						html += '		<select id="' + ContainerId + '__PageChanger' + (Options.get == 'domain2' ? '2' : '') + '">';
						for(var i = 1; i <= j.postback.totalPage; i++) {
							html += '		<option value="' + i + '"' + (j.postback.currentPage == i ? ' selected' : '') + '>' + i + '</option>';
						}
						html += '		</select>';
						html += '		 / ' + j.postback.totalPage;
						html += '	</td>';
						html += '</tr>';
						
						$('#' + ContainerId).html(html);
						$('#' + ContainerId).find('td._opcol').find('div').addClass('_gridop');
						$('#' + ContainerId).find('tr[class*=whitebg]:even').addClass('tableStripE');
						$('#' + ContainerId).find('tr[class*=whitebg]:odd').addClass('tableStripO');
						
						$(ContainerId + '__PageChanger').change(function() {
							Grid.Sort({
								url: Options.url,
								headers: Options.headers,
								page: $(this).val()
							});
						});
					}
				}
			});
		}
	}
});
