<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() {
	
	Validation = {};
	Validation.Functions = {};
	
	Validation.Patterns = {};
	/**
	 * dom: Domain
	 * num: Number
	 * str: String
	 * dt: Date
	 * un: Username
	 * ns: Nameserver
	 * ma: Mail
	 */
	Validation.Patterns.dom	= /^[a-zA-Z0-9-]+(([\'\,\.\- ][a-zA-Z])?[a-zA-Z]*)*$/;
	Validation.Patterns.num	= /^[0-9]+$/;
	Validation.Patterns.str	= /^[a-zA-ZğüşıöçĞÜŞİÖÇ ]+$/;
	Validation.Patterns.dt	= /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/;
	Validation.Patterns.un	= /^[a-zA-Z0-9_]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
	Validation.Patterns.ns	= /^[a-z0-9-.]+$/;
	Validation.Patterns.ma	= /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
	Validation.Patterns.ph	= /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
	
	Validation.value = '';
	Validation.pattern = '';
	Validation.result = false;
	
	Validation.Counter = 0;
	
	Validation.Check = function(e) {
		$('div[id^=errorBox__]').hide();
		elements = e.find('*');
		Validation.result = 1;
		$.each(elements, function() {
			if($(this).hasClass('_val')) {
				if($(this).hasClass('_req') && $(this).val().length == 0) {
					Validation.result = 0;
					Validation.ShowBox($(this).attr('id'), 'Bu alan boş bırakılamaz!', 'error');
				}
				else if($(this).hasClass('_ma')		&& Validation.Functions.Mail($(this))		== 0) { Validation.result = 0; }
				else if($(this).hasClass('_dom')	&& Validation.Functions.Domain($(this))		== 0) { Validation.result = 0; }
				else if($(this).hasClass('_num')	&& Validation.Functions.Number($(this))		== 0) { Validation.result = 0; }
				else if($(this).hasClass('_str')	&& Validation.Functions.String($(this))		== 0) { Validation.result = 0; }
				else if($(this).hasClass('_dt')		&& Validation.Functions.Date($(this))		== 0) { Validation.result = 0; }
				else if($(this).hasClass('_un')		&& Validation.Functions.Username($(this))	== 0) { Validation.result = 0; }
				else if($(this).hasClass('_ns')		&& Validation.Functions.Nameserver($(this))	== 0) { Validation.result = 0; }
				else if($(this).hasClass('_ph')		&& Validation.Functions.Phone($(this))		== 0) { Validation.result = 0; }
			}
		});
		return Validation.result;
	};
	
	// Validation Functions
	Validation.Functions.Mail = function(e) {
		if(!e.val().match(Validation.Patterns.ma)) {
			Validation.ShowBox(e.attr('id'), 'Geçersiz mail adresi girdiniz.', 'error');
			return 0;
		}
	};
	Validation.Functions.Domain = function(e) {
		if(!e.val().match(Validation.Patterns.dom)) {
			Validation.ShowBox(e.attr('id'), 'Geçersiz domain girdiniz.', 'error');
			return 0;
		}
	};
	Validation.Functions.Nameserver = function(e) {
		if(!e.val().match(Validation.Patterns.dom)) {
			Validation.ShowBox(e.attr('id'), 'Geçersiz nameserver girdiniz.', 'error');
			return 0;
		}
	};
	Validation.Functions.Number = function(e) {
		if(!e.val().match(Validation.Patterns.num)) {
			Validation.ShowBox(e.attr('id'), 'Geçersiz sayı girdiniz.', 'error');
			return 0;
		}
	};
	Validation.Functions.String = function(e) {
		if(!e.val().match(Validation.Patterns.num)) {
			Validation.ShowBox(e.attr('id'), 'Geçersiz yazı girdiniz.', 'info');
			return 0;
		}
	};
	
	Validation.ShowBox = function(Id, text, type) {
//		console.log(type + ': (' + Id + ') ' + text);
		
		id = 'errorBox__' + ++Validation.Counter;
		
		gObj = window.document.createElement('div');
		gObj.setAttribute('id', id);
		gObj.setAttribute('class', 'errorBox box-' + type);
		window.document.body.appendChild(gObj);
		e = $('#' + id);
		
		
		t = $('#' + Id);
		e.css('left', t.position().left + t.width() + 60);
		e.css('top', t.position().top);
		e.html(text);
	};
	
});