/**
 * @abstract  Webim Framework
 * @author    Orhan POLAT
 * @copyright Masters 2009
 * @version   6.2
 */

(function(){
	var webim = window.webim = window.$ = function (selector){
		return new webim.builtin.init(selector);
	};
	
	webim.builtin = webim.prototype = {
	 selectors: 0,
	 patterns: {
	  'id': /^\#([a-zA-Z0-9_-]+)$/,
	  'tag': /^\>([a-zA-Z0-9|]+)$/i,
	  'create': /^\$([a-zA-Z]+)$/,
	  'class': /^\.([a-zA-Z0-9_-]+)$/
	 },
		init: function (selector){
		 var obj = this;
		 selector = selector || document;
		 
		 if (selector.selectors){
		  webim.each(selector, function(n, v){
		   obj[n] = v;
		   obj.selectors++;
		  });
		  return obj;
		 }

		 if (selector.nodeType){
		  obj[0] = selector;
		  obj.selectors = 1;
		  return obj;
		 }
		 
		 if (typeof(selector) === 'string'){
		  var arr = selector.split(' '), match, i = 0, k;
		  var el, els = [], tags = [], tag;
		  
		  webim.each(arr, function(){
		   //#Id
		   match = obj.patterns['id'].exec(this);
		   
		   if (match && match[1] && document.getElementById(match[1])){
		    obj[obj.selectors] = document.getElementById(match[1]);
		    obj.selectors++;
		   }
		   
		   //>Tag
		   match = obj.patterns['tag'].exec(this);
		   
		   if (match && match[1]){
		    els = [];

		    if (!obj[0]){
		     obj[0] = document;
		     obj.selectors = 1;
		    }
		    
		    tags = match[1].split('|');
		    
		    for (i=0; i < tags.length; i++){
 		    webim.each(obj.getEls([tags[i]]), function(k, el){
	       els.push(el);
 		    });
		    }
		    
 	    for (i=0; i < els.length; i++){
 	     obj[i] = els[i];
 	     obj.selectors = i+1;
 	    }
		   }

		   //$Create
		   match = obj.patterns['create'].exec(this);
		   
		   if (match && match[1]){
	     tag = document.createElement(match[1]);
      
	     if (!obj[0]){
      	el = tag;
      }else{
       el.appendChild(tag);
       el = tag;
      }
		    
      obj[obj.selectors] = el;
      obj.selectors++;
		   }
		   
		   //.Class
		   match = obj.patterns['class'].exec(this);
		   
		   if (match && match[1]){		    
		    webim.each(webim('>body').getEls(['*']), function(k, el){
	      if (el.className && (el.className == match[1])){
        obj[obj.selectors] = el;
        obj.selectors++;
	      }
		    });
		   }
		   		   
		   match = null;
		  });
		  
		  return obj;
		 }
		 	  
		 return this;
		},
		each: function (callback, args){
			return webim.each(this, callback, args);
		},
		getEl: function (n){
		 n = n || 0;
		 return (this[n] ? this[n] : null);
		},
		getEls: function (tags, n){
		 n = n || 0;
		 tags = tags || [];
		 var arr = [];
		 
		 if ((typeof(n) !== 'undefined') && this[n]){
		  arr = webim.getSubElements(this[n], tags);
		 }else{
		  this.each(function(){
		   arr.push(webim.getSubElements(this, tags));
		  });
		 }
		 
		 return arr;
		},
		getFormElements: function (withButtons){
		 var obj = this, i = 0;
		 this.each(function(){
		  webim.each(webim.getFormElements(this, withButtons), function (){
		   obj[i] = this;
		   i++;
		  });
		 });
		 obj.selectors = i;
		 return this;
		},
		getParams: function (){
		 var params = [], els = [], obj = this;
		 this.each(function(n){
		  if (this.name && !webim.inArray(this.name, els)){
		   els.push(this.name);
		   params.push(encodeURIComponent(this.name) +'='+ encodeURIComponent(obj.getValue('',n)));
		  }
		 });
		 return params.join('&');
		},
		getSize: function (n){
		 n = n || 0;
		 return ((this[n] && this[n].offsetWidth)
		  ? 
		 {width: this[n].offsetWidth, height: this[n].offsetHeight}
		  :
		 {width:-1, height:-1});
		},
		getPosition: function (n){
		 n = n || 0;
		 return this[n] ? webim.getPosition(this[n]) : {x:-1, y:-1};
		},
		remove: function (n){
		 if ((typeof(n) !== 'undefined') && this[n]){
		  if (this[n].parentNode){
 		  this[n].parentNode.removeChild(this[n]);
		  }
		  return this;
		 }else{
 		 return this.each(function(){
 		  if (this.parentNode){
  		  this.parentNode.removeChild(this);
 		  }
 		 });
		 }
		},
		append: function (targetEl, n){
		 n = ((typeof(n) !== 'undefined') && this[n]) ? n : 0;
		 if ((typeof(targetEl) === 'object') && targetEl){
		  targetEl.appendChild(this[n]);
		 }else if (typeof(targetEl) === 'string'){
		  document[targetEl].appendChild(this[n]);
		 }
		 return this;
		},
		appendIn: function (targetEl, n){
		 n = ((typeof(n) !== 'undefined') && this[n]) ? n : (this.selectors - 1);
		 if ((typeof(targetEl) === 'object') && targetEl){
		  this[n].appendChild(targetEl);
		 }else if (typeof(targetEl) === 'string'){
		  this[n].appendChild(document[targetEl]);
		 }
		 return this;
		},
		prepend: function (targetEl, n){
		 n = ((typeof(n) !== 'undefined') && this[n]) ? n : 0;
		 if ((typeof(targetEl) === 'object') && targetEl){
		  targetEl.insertBefore(this[n], targetEl.firstChild);
		 }else if (typeof(targetEl) === 'string'){
		  document[targetEl].insertBefore(this[n], document[targetEl].firstChild);
		 }
		 return this;
		},
		prependIn: function (targetEl, n){
		 n = ((typeof(n) !== 'undefined') && this[n]) ? n : (this.selectors - 1);
		 if ((typeof(targetEl) === 'object') && targetEl){
		  this[n].insertBefore(targetEl, this[n].firstChild);
		 }else if (typeof(targetEl) === 'string'){
		  this[n].insertBefore(document[targetEl], this[n].firstChild);
		 }
		 return this;
		},
		after: function (targetEl, n){
		 n = ((typeof(n) !== (undefined)) && this[n]) ? n : 0;
		 if ((typeof(targetEl) === 'object') && targetEl){
		  targetEl.parentNode.insertBefore(this[n], targetEl.nextSibling);
		 }else if (typeof(targetEl) === 'string'){
		  document[targetEl].parentNode.insertBefore(this[n], document[targetEl].nextSibling);
		 }
		 return this;
		},
		afterIn: function (targetEl, n){
		 n = ((typeof(n) !== 'undefined') && this[n]) ? n : (this.selectors - 1);
		 if ((typeof(targetEl) === 'object') && targetEl){
		  this[n].parentNode.insertBefore(targetEl, this[n].nextSibling);
		 }else if (typeof(targetEl) === 'string'){
		  this[n].parentNode.insertBefore(document[targetEl], this[n].nextSibling);
		 }
		 return this;
		},
		before: function (targetEl, n){
		 n = ((typeof(n) !== 'undefined') && this[n]) ? n : 0;
		 if ((typeof(targetEl) === 'object') && targetEl){
		  targetEl.parentNode.insertBefore(this[n], targetEl);
		 }else if (typeof(targetEl) === 'string'){
		  document[targetEl].parentNode.insertBefore(this[n], document[targetEl]);
		 }
		 return this;
		},
		beforeIn: function (targetEl, n){
		 n = ((typeof(n) !== 'undefined') && this[n]) ? n : (this.selectors - 1);
		 if ((typeof(targetEl) === 'object') && targetEl){
		  this[n].parentNode.insertBefore(targetEl, this[n]);
		 }else if (typeof(targetEl) === 'string'){
		  this[n].parentNode.insertBefore(document[targetEl], this[n]);
		 }
		 return this;
		},
		clone: function (n, withContent){
		 n = ((typeof(n) !== 'undefined') && this[n]) ? n : 0;
		 var node = this[n].cloneNode(withContent ? true : false);
		 this[n].parentNode.appendChild(node);
		 this[this.selectors] = node;
		 this.selectors++;
		 return this;
		},
		getAttr: function (attr, n){
		 n = n || 0;
		 return (this[n] ? this[n].getAttribute(attr) : null);
		},
		setAttr: function (attrs, n){
		 attrs = attrs || {};
		 if ((typeof(n) !== 'undefined') && this[n]){
 		 var obj = this;
		  webim.each(attrs, function(a, b){
		   obj[n].setAttribute(a, b);
		  });
		  return obj;
		 }else{
 		 return this.each(function(n, v){
 		  webim.each(attrs, function(a, b){
 		   v.setAttribute(a, b);
 		  });
 		 });
		 }
		},
		getCSS: function (styleName, n){
		 n = n || 0;
		 return ((this[n] && this[n].style[styleName]) ? this[n].style[styleName] : null);
		},
		setCSS: function (styles, n){
		 styles = styles || {};
		 if ((typeof(n) !== 'undefined') && this[n]){
 		 var obj = this;
		  webim.each(styles, function(a, b){
		   obj[n].style[a] = b;
		  });
		  return obj;
		 }else{
 		 return this.each(function(n, v){
 		  webim.each(styles, function(a, b){
 		   if (v.style){
  		   v.style[a] = b;
 		   }
 		  });
 		 });
		 }
		},
		getValue: function (defaultValue, n){
		 n = n || 0;
		 return webim.getValue(this[n], defaultValue);
		},
		getText: function (n){
		 n = n || 0;
		 return ((this[n] && this[n].options && (this[n].selectedIndex > -1)) ? this[n].options[this[n].selectedIndex].text : null);
		},
		getType: function (n){
		 n = n || 0;
		 var elType = null;
		 if (this[n] && this[n].tagName){
 		 elType = this[n].tagName.toLowerCase();
    if (this[n].type){
     elType = this[n].type.toLowerCase();
    }
		 }
   return elType;
		},
		setValue: function (val, n){
		 if ((typeof(n) !== 'undefined') && this[n]){
 		 var obj = this;
		  webim.setValue(this[n], val);
		  return obj;
		 }else{
 		 return this.each(function(){
 		  webim.setValue(this, val);
 		 });
		 }
		},
		focus: function (n){
		 n = n || 0;
		 (this[n] && this[n].focus) ? this[n].focus() : this;
		 return this;
		},
		select: function (n){
		 n = n || 0;
		 (this[n] && this[n].select) ? this[n].select() : this;
		 return this;
		},
		reset: function (){
		 return this.each(function(){
		  if (this.method || this.getAttribute('method') || (this.tagName && (this.tagName == 'form'))){
		   this.reset();
		   //Hidden Elements
		   webim.each(webim(this).getEls(['input']), function(){
		    if (this.type && (this.type == 'hidden')){
		     this.value = !isNaN(parseInt(this.value)) ? 0 : '';
		    }
		   });
		  }
		 });
		},
		clear: function (n){
		 if ((typeof(n) !== 'undefined') && this[n]){
		  webim.clear(this[n]);
		  return this;
		 }else{
 		 return this.each(function(){
		  	webim.clear(this);
 		 });
		 }
		},
		setClass: function (clName, n){
		 if ((typeof(n) !== 'undefined') && this[n]){
		  webim.classes.set(this[n], clName);
		  return this;
		 }else{
		  return this.each(function(){
		   webim.classes.set(this, clName)
		  });
		 }
		},
		addClass: function (clName, n){
		 if ((typeof(n) !== 'undefined') && this[n]){
		  webim.classes.add(this[n], clName);
		  return this;
		 }else{
		  return this.each(function(){
 		  webim.classes.add(this, clName);
		  });
		 }
		},
		removeClass: function (clName, n){
		 if ((typeof(n) !== 'undefined') && this[n]){
		  webim.classes.remove(this[n], clName);
		  return this;
		 }else{
		  return this.each(function(){
 		  webim.classes.remove(this, clName);
		  });
		 }
		},
		hasClass: function (clName, n){
		 n = n || 0;
		 return webim.inArray(clName, this[n].className.split(' '), true);
		},
		getHTML: function (n){
		 n = n || 0;
	  return this[n] ? this[n].innerHTML : '';
		},
		setHTML: function (htmlText, n){
		 if (typeof(n) === 'undefined'){
		  n = this.selectors - 1;
		 }
		 
	  if (this[n]){
	   this[n].innerHTML = htmlText;
	  }else{
	   this.each(function(){
	    this.innerHTML = htmlText;
	   });
	  }
	  return this;
		},
		addEvent: function (evType, fn, n){
		 if (typeof(n) !== 'undefined'){
		  if ((typeof(n) === 'number') && this[n]){
		   webim.addEvent(this[n], evType, fn);
		  }else if (typeof(n) == 'object'){
		   for (var k in n){
		    if (this[n[k]]){
		     webim.addEvent(this[n[k]], evType, fn);
		    }
		   }
		  }
		  return this;
		 }else{
 		 return this.each(function(){
 		  webim.addEvent(this, evType, fn);
 		 });
		 }
		},
		removeEvent: function (evType, fn, n){
		 if (typeof(n) !== 'undefined'){
		  if ((typeof(n) === 'number') && this[n]){
		   webim.removeEvent(this[n], evType, fn);
		  }else if (typeof(n) == 'object'){
		   for (var k in n){
		    if (this[n[k]]){
		     webim.removeEvent(this[n[k]], evType, fn);
		    }
		   }
		  }
		  return this;
		 }else{
 		 return this.each(function(){
 		  webim.removeEvent(this, evType, fn);
 		 });
		 }
		},
		fillOptions: function (options, n){
		 options = options || {};
		 if ((typeof(n) !== 'undefined') && this[n]){
		  webim.fillOptions(this[n], options);
		  return this;
		 }else{
 		 return this.each(function(){
 		  webim.fillOptions(this, options);
 		 });
		 }
		},
		clearOptions: function (n){
		 if ((typeof(n) !== 'undefined') && this[n]){
		  webim.clearOptions(this[n]);
		  return this;
		 }else{
 		 return this.each(function(){
 		  webim.clearOptions(this);
 		 });
		 }
		},
		toUpper: function (n){
		 if ((typeof(n) !== 'undefined') && this[n]){
		  webim.to.upper(this[n]);
		  return this;
		 }else{
 		 return this.each(function(){
 		  webim.to.upper(this);
 		 });
		 }
		},
		toLower: function (n){
		 if ((typeof(n) !== 'undefined') && this[n]){
		  webim.to.lower(this[n]);
		  return this;
		 }else{
 		 return this.each(function(){
 		  webim.to.lower(this);
 		 });
		 }
		}
	};
	
	webim.builtin.init.prototype = webim.builtin;
	
 var userAgent = navigator.userAgent.toLowerCase();

 webim.browser = {
  version: (userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [0,'0'])[1],
  msie: /msie/.test(userAgent) && !/opera/.test(userAgent),
  mozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent),
  safari: /webkit/.test(userAgent),
  opera: /opera/.test(userAgent)
 };
	
	webim.each = function (obj, callback, args){
	 var key, i=0, length = obj.selectors;
	 
	 if (args){
 	 if (typeof(length) === 'undefined'){
  	 for (key in obj){
  	  if (callback.apply(obj[key], args) === false){
  	   break;
  	  }
  	 }
 	 }else{
 	  for (; i < length;){
 	   if (callback.apply(obj[i++], args) === false){
 	    break;
 	   }
 	  }
 	 }
	 }else{
	  if (typeof(length) === 'undefined'){
	   for (key in obj){
	    if (callback.call(obj[key], key, obj[key]) === false){
	     break;
	    }
	   }
	  }else{
	   for (var v = obj[0]; (i < length && (callback.call(v, i, v) !== false)); v = obj[++i]){}
	  }
	 }
	 
	 return obj;
	};
 
 webim.trim = function (text){
  return (text || '').replace(/^\s+|\s+$/g, '');
 };
 
 webim.inArray = function (needle, haystack, strict){
  var found = false, key, strict = !!strict;
 
  for (key in haystack){
   if ((strict && (haystack[key] === needle)) || (!strict && (haystack[key] == needle))){
    found = true;
    break;
   }
  }
 
  return found;
	};
	
	webim.removeFromArray = function (needle, haystack, strict){
	 var arr = [], key, strict = !!strict;
	 
	 for (key in haystack){
   if ((strict && (haystack[key] !== needle)) || (!strict && (haystack[key] != needle))){
    arr[key] = haystack[key];
   }
	 }
	 
	 return arr;
	};
	
	webim.getValue = function (obj, defaultValue){
	 var defaultValueType = webim.inArray((typeof(defaultValue)), 'object string number'.split(' '))
 		                 ? typeof(defaultValue) 
 		                 : 'string';
 	var defaultReturnValue = '', elValue = null, i = 0, elType = webim(obj).getType();
 	
 	switch (defaultValueType){
 	 case 'object':
 	  for (key in defaultValue){
 	   defaultReturnValue = defaultValue[key];
 	   break;
 	  }
 	  break;
 	 case 'number':
 	 case 'string':
 	  defaultReturnValue = ((typeof(defaultValue) !== 'undefined') ? defaultValue : '');
 	  break;
 	}

  switch (elType){
   case 'select-one':
    elValue = ((obj.options.length > 0) && (obj.selectedIndex > -1)) ? obj.options[obj.selectedIndex].value : null;
    break;
   case 'select-multiple':
    var arr = [];
    if (obj.options.length > 0){
     for (i=0; i < obj.options.length; i++){
      if (obj.options[i].selected){
       arr.push(obj.options[i].value);
      }
     }
    }
    elValue = arr.length > 0 ? arr.join(',') : null;
    break;
   case 'radio':
   case 'checkbox':
	   nm = webim(obj).getAttr('name');
	   arr = document.getElementsByName(nm);
	   for (i=0; i < arr.length; i++){
	    if (arr[i].checked){
	     elValue = arr[i].value;
	     break;
	    }
	   };
    break;
   case 'text':
   case 'hidden':
   case 'password':
   case 'textarea':
   case 'file':
    elValue = obj.value;
    break;
  }

  if (defaultValueType === 'object'){
   if (!webim.inArray(elValue, defaultValue)){
    elValue = defaultReturnValue;
   }
  }else if (defaultValueType === 'number'){
   elValue = (elValue && (elValue.length > 0) && !isNaN(elValue)) ? parseFloat(elValue) : defaultReturnValue;
  }else if (!elValue || (elValue.length < 1)){
   elValue = defaultReturnValue;
  }
	  
	 return elValue;
	};
	
	webim.setValue = function (obj, val){
	 var elType, i = 0, arr = [], tmp = [], nm = '';
	 
  if (webim.inArray(obj.tagName.toLowerCase(), 'textarea file'.split(' '))){
   elType = obj.tagName.toLowerCase();
  }else if (obj.type){
   elType = obj.type.toLowerCase();
  }
	  
  switch (elType){
   case 'select-one':
	   for (i=0; i < obj.options.length; i++){
	    if (obj.options[i].value == val){
	     obj.options[i].selected = true;
	     break;
	    }
	   }
	   break;
   case 'select-multiple':
    tmp = val.split(',');
    arr = [];
    webim.each(tmp, function(){
     arr.push(webim.trim(this));
    });
	   for (i=0; i < obj.options.length; i++){
     obj.options[i].selected = webim.inArray(obj.options[i].value, arr);
	   }
	   break;
	  case 'radio':
	  case 'checkbox':
	   nm = webim(obj).getAttr('name');
	   arr = document.getElementsByName(nm);
	   for (i=0; i < arr.length; i++){
	    arr[i].checked = (arr[i].value.toString() == val.toString());
	   };
	   break;
	  default:
	   obj.value = val;
	  break;
  }
	};
	
	webim.events = {
	 _list: {},
	 add: function (obj, evType, fn){
   if (obj.addEventListener) {
    obj.addEventListener(evType, fn, false);
   }else if (obj.attachEvent) {
    obj.attachEvent('on' + evType, fn);
   }
   if (!obj.id){
    obj.id = 'webim_'+ Math.random().toString().substr(2);
   }
   if (!this._list[obj.id]){
    this._list[obj.id] = {};
   }
   this._list[obj.id][evType] = fn;
	 },
	 remove: function (obj, evType, fn){
	  obj.id = obj.id ? obj.id : 'webim_'+ Math.random().toString().substr(2);
   if (obj.removeEventListener) {
    obj.removeEventListener(evType, (typeof(fn) === 'function' ? fn : ((this._list[obj.id] && this._list[obj.id][evType]) ? this._list[obj.id][evType] : arguments.callee)), false);
   }else if (obj.detachEvent) {
    obj.detachEvent('on'+ evType, (typeof(fn) === 'function' ? fn : ((this._list[obj.id] && this._list[obj.id][evType]) ? this._list[obj.id][evType] : arguments.callee)));
   }
   if (this._list[obj.id]){
    delete this._list[obj.id][evType];
   }
	 }
	};
	
	webim.addEvent = function (obj, evType, fn){
	 webim.events.add(obj, evType, fn);
	};
	
	webim.removeEvent = function (obj, evType, fn){
	 webim.events.remove(obj, evType, fn);
	};
	
	webim.classes = {
	 add: function (obj, clName){
	  var cls = obj.className.split(' '), tmp = [], i;
	  for (i in cls){
	   if (cls[i].length > 0){
	    tmp.push(cls[i]);
	   }
	  }
	  if (!webim.inArray(clName, tmp)){
	   tmp.push(clName);
	  }
	  obj.className = tmp.join(' ');
	 },
	 remove: function (obj, clName){
	  var cls = obj.className.split(' '), tmp = [], i;
	  for (i in cls){
	   if (cls[i] != clName){
	    tmp.push(cls[i]);
	   }
	  }
	  obj.className = tmp.join(' ');
	 },
	 set: function (obj, clName){
	  obj.className = clName;
	 }
	};
	
 webim.getWinW = function (){
  if (document.documentElement && (document.documentElement.clientWidth > 0)){
   return document.documentElement.clientWidth;
  }else if (window.innerWidth){
   return window.innerWidth;
  }else{
   return document.body.clientWidth;
  }
 };
 
 webim.getWinH = function (){
  if (window.innerHeight){
   return window.innerHeight;
  }else if (document.documentElement && (document.documentElement.clientHeight > 0)){
   return document.documentElement.clientHeight;
  }else{
   return document.body.clientHeight;
  }
 };
 
 webim.getScrollLeft = function (){
  if (window.pageXOffset){
   return window.pageXOffset;
  }else if (document.documentElement && (document.documentElement.scrollLeft > 0)){
   return document.documentElement.scrollLeft;
  }else{
   return document.body.scrollLeft;
  }
 };
 
 webim.getScrollTop = function (){
  if (window.pageYOffset){
   return window.pageYOffset;
  }else if (document.documentElement && (document.documentElement.scrollTop > 0)){
   return document.documentElement.scrollTop;
  }else{
   return document.body.scrollTop;
  }
 };
 
 webim.getScrollWidth = function (){
  if (document.documentElement && (document.documentElement.scrollWidth > 0)){
   return document.documentElement.scrollWidth;
  }else{
   return document.body.scrollWidth;
  }
 };
 
 webim.getScrollHeight = function (){
  if (document.documentElement && (document.documentElement.scrollHeight > 0)){
   return document.documentElement.scrollHeight;
  }else{
   return document.body.scrollHeight;
  }
 };
 
 webim.getPosition = function (obj){
  var pos = {
   x: obj.offsetLeft,
   y: obj.offsetTop
  };
  
  if (obj.offsetParent) {
   var tmp = webim.getPosition(obj.offsetParent);
   pos.x += tmp.x;
   pos.y += tmp.y;
  }
  
  return pos;
 };
 
 webim.getMousePosition = function (e){
  e = e || window.event;
  
  return {
   x: e.clientX,
   y: e.clientY
  };
 };
 
 webim.getFormElements = function (obj, withButtons){
	 var tags = ['input','select','textarea'];
	 
	 if (withButtons){
	  tags.push('button');
	 }
	 
	 return webim.getSubElements(obj, tags);
 };
 
 webim.getSubElements = function (obj, tags){
	 var els = [], tmp = [], i = 0;
	 tags = tags || [];
	 
	 obj = ((typeof(obj) === 'object') ? obj : webim('#'+ obj).getEl());
	 
  webim.each(tags, function(n, v){
   tmp = obj.getElementsByTagName(v);
   for (i=0; i < tmp.length; i++){
    els.push(tmp[i]);
   }
  });
	 
	 return els;
 };
 
 webim.fillOptions = function (obj, options){
  if (obj.options){
   var newOption;
   
   webim.each(options, function (n, v){
    newOption = webim('$option').getEl();
    newOption.value = n;
    newOption.text = v;
    
    try {
     obj.add(newOption, null);
    }catch(e){
     obj.add(newOption);
    }
   });
  }
 };
 
 webim.clearOptions = function (obj){
  if (obj.options){
   while (obj.options.length > 0){
    obj.remove(0);
   }
  }
 };
 
 webim.getLength = webim.getCount = function (obj){
  var i = 0;
  
  for (var k in obj){
   i++;
  }
  
  return i;
 };
 
 webim.clear = function (obj){
 	while (obj.childNodes.length > 0){
 		obj.removeChild(obj.firstChild);
 	}
 };
	
	//AJAX listesi
	webim.ajaxRequests = {
	 _list: {},
	 running: function (id){
	  return this._list[id];
	 },
	 add: function (obj){
	  this._list[obj.id] = obj;
	 },
	 remove: function (id){
	  var tmp = {};
	  
	  webim.each(this._list, function(n, v){
	   if (id != n){
	    tmp[n] = v;
	   }
	  });
	  
	  this._list = tmp;
	 },
	 cancel: function (id){
	  if (typeof(id) !== 'undefined'){
	   if (this._list[id]){
	    try {
 	    this._list[id].aborted = true;
 	    this._list[id].xhr.abort();
	     webim.ajaxRequests.remove(id);
	    }catch (e){}
	   }
	  }else{
	   webim.each(this._list, function(){
	    try {
	     this.aborted = true;
	     this.xhr.abort();
	     webim.ajaxRequests.remove(this.id);
	    }catch (e){}
	   });
	  }
	 }
	};
	
	//AJAX ayarları
	webim.ajaxSettings = function (){
	 return {
 		debug: false,
 		timeout: 30,
 		method: 'post',
 		url: location.href,
 		params: '',
 		onIdle: function(){
 		 if (typeof(this.idleStatus) !== 'undefined'){
  		 switch (this.type){
  		  case 'DIALOG':
  		   
  		   var dialog = webim.dialogs.running(this.dialog), obj = this;
  		   
  		   if (dialog){
   		   if (this.idleStatus == 'start'){
   		    dialog.mask(true);
   		    dialog.loadingPoint = webim('$div')
   		    .append(dialog.content)
   		    .setCSS({
    		     position:'absolute',
    		     top:0,
    		     right:0,
    		     backgroundColor:'#ff0000',
    		     color:'#ffffff',
    		     padding:'1px 8px',
    		     opacity:1.0,
    		     filter:'alpha(opacity=100)',
           border:'1px solid #ff0000',
           borderRadius:'3px',
           MozBorderRadius:'3px',
           webkitBorderRadius:'3px'
    		    })
   		    .setHTML(this.loadingMessage);
   		    webim.each(dialog.buttons, function(){
   		     this.obj.disabled = true;
   		    });
   		    dialog.onBeforeHideBackUp = dialog.onBeforeHide;
   		    dialog.onBeforeHide = function(){
   		     obj.confirmation = webim.message({
   		      type: 'confirm',
   		      text: (LANGUAGE['cancelRequest'] || 'İptal etmek istediğinize emin misiniz?'),
   		      onConfirm: function (d){
   		       webim.ajaxRequests.cancel(obj.id);
   		       d.hide();
   		       dialog.hide();
   		      }
   		     });
   		     return false;
   		    };
   		   }else{
   		    dialog.mask(false);
   		    dialog.loadingPoint.remove();
   		    webim.each(dialog.buttons, function(){
   		     this.obj.disabled = false;
   		    });
   		    dialog.onBeforeHide = dialog.onBeforeHideBackUp;
   		    if (obj.confirmation){
   		     obj.confirmation.hide();
   		     obj.confirmation = null;
   		    }
   		   }
  		   }
  		  
  		   break;
  		  case 'LIST':
  		  
  		   var lst = ((typeof(this.list) === 'string') ? webim('#'+ this.list).getEl() : this.list);
  		  
  		   if (lst){
   		   if (this.idleStatus == 'start'){
   		    webim(lst).setHTML(webim('$div $div').setCSS({color:'#ff0000',textAlign:'center'},1).addClass((CLASSES['loadingMessage'] || 'loadingMessage'),1).setHTML(this.loadingMessage).getHTML());
   		   }else{
   		    webim(lst).setHTML('');
   		   }
  		   }
  		  
  		   break;
  		  case 'MESSAGE':
  		  
  		   if (this.idleStatus == 'start'){
  		    this.point = webim('$div')
              		    .setCSS({
              		     position:'fixed',
              		     top:0,
              		     right:0,
              		     backgroundColor:'#ff0000',
              		     padding:'3px 10px',
              		     color:'#ffffff',
              		     textAlign:'center',
              		     zIndex:100000
              		    })
              		    .addClass(CLASSES['loadingPoint'] || 'loadingPoint')
              		    .setHTML(this.loadingMessage)
              		    .append('body')
  		   }else if (this.point){
  		    this.point.remove();
  		   }
  		  
  		   break;
  		  case 'LOADER':
  		  
  		   if (this.idleStatus == 'start'){
  		    var con = webim('$div')
  		             .getEl();
  		    var img = webim('$div $img')
 		              .setCSS({
		                textAlign:'center',
		                margin:'5px auto'
		               },0)
 		              .setCSS({
		                vAlign:'middle'
		               },1)
 		              .setAttr({
		                'src':webim.dialogSettings().path +'loader.gif',
 		               'width':'32',
 		               'height':'32',
 		               'alt':''
		               },1)
 		              .append(con)
 		              .getEl();
  		    var mes = webim('$div')
 		              .setCSS({
		                textAlign:'center',
		                fontWeight:'bold',
		                overflow:'hidden'
		               },0)
 		              .setHTML(this.loadingMessage)
 		              .append(con)
 		              .getEl();

   		   this.loader = webim.dialog({
   		    width:250,
   		    html:con.innerHTML,
   		    closeButton:false
   		   });
  		   }else if (this.loader){
  		    this.loader.hide();
  		    this.loader = null;
  		   }
  		   
  		   break;
  		 }
 		 }
 		},
 		onSuccess: function(){},
 		onError: function(){
 		 webim.message({
 		  type: 'error',
 		  text: (LANGUAGE[this.errorStatus] || this.errorStatus)
 		 });
 		},
 		onTimeOut: function(){
 		 webim.message({
 		  type: 'warning',
 		  text: (LANGUAGE['timeout'] || 'İstek zamanaşımına uğradı, tekrar deneyin!')
 		 });
 		},
 		onMultiRequest: function(){},
 		onDebug: function(){
 		 webim.message({
 		  title: 'Debugging - AJAX Request',
 		  text: this.debugStatus
 		 });
 		},
 		strict: false,
 		onUnload:function(){},
 		type: 'NONE',
 		loadingMessage: (LANGUAGE['loadingMessage'] || 'Yükleniyor, lütfen bekleyin...'),
 		dialog: 0,
 		list: 'list'
	 };
	};
	
	//AJAX işlemi
	webim.ajax = function () {
	 var config = arguments[0] || {};
	 var ajax = new webim.ajaxSettings();
	 ajax.id = 'webim_'+ Math.random().toString().substr(2);
	 
	 webim.each(config, function (n, v){
	  if (typeof(ajax[n]) !== 'undefined'){
	   ajax[n] = v;
	  }
	 });
	 
	 if (webim.ajaxRequests.running(ajax.id)){
	  ajax.onMultiRequest();
	  return null;
	 }
	 
	 var request = function (){
 	 var http = null;
  	
 	 if (typeof(XMLHttpRequest) !== 'undefined'){
  		http = new XMLHttpRequest();
 		}else	if (window.ActiveXObject){
 			try	{
 				http = new ActiveXObject("Msxml2.XMLHTTP");
 			}catch (e){
 				try {
 					http = new ActiveXObject("Microsoft.XMLHTTP");
 				}catch (e){
 				}
 			}
  	}
  	
 	 return http;
	 };
	 
	 ajax.xhr = new request();
	 
	 if (ajax.xhr){	  
	  //Listeye ekleyelim
	  webim.ajaxRequests.add(ajax);
	  
	  if (ajax.strict){
	   webim.addEvent(window, 'beforeunload', function(){
	    ajax.onUnload();
	   });
	  }
	  
	  //Ayarlar
	  ajax.running = true;
 	 var params = [], mSec = 0;

 	 ajax.idleStatus = 'start';
 	 ajax.onIdle();
 	 
 	 ajax.runTime = window.setInterval(function(){
 	  mSec++;
 	 }, 100);
 	 
 	 try	{
   	//Durum
  		ajax.xhr.onreadystatechange = function(){
  		 if (ajax.running){
      if ((ajax.xhr.readyState == 4) || (ajax.xhr.readyState == 'complete')){
       ajax.running = false;
       ajax.idleStatus = 'stop';
       ajax.onIdle();
       
    	  //Listeden çıkaralım
    	  webim.ajaxRequests.remove(ajax.id);
    	  
    	  if (ajax.strict){
    	   webim.removeEvent(window, 'beforeunload', function(){
    	    ajax.onUnload();
    	   });
    	  }
       
       if (typeof(ajax.timer) !== 'undefined'){
        window.clearTimeout(ajax.timer);
       }
       
       window.clearInterval(ajax.runTime);
     
       if (ajax.debug){
        ajax.debugStatus = 'Status: '+ ajax.xhr.status;
        ajax.onDebug();
       }
     		
     		if (ajax.xhr.status == 200){
     		 ajax.time = mSec;
     		 ajax.text = ajax.xhr.responseText;
     		 ajax.xml  = (ajax.xhr.responseXML ? ajax.xhr.responseXML : null);
     		 ajax.onSuccess();
     		}else if (!ajax.aborted){
     		 ajax.errorStatus = 'status';
     		 ajax.onError();
     		}
      }
  		 }
  		};
  		
  		//Timeout
  		if (ajax.timeout > 0){
  		 ajax.timer = window.setTimeout(
  		  function(){
  		   if (ajax.xhr){
  		    try {
  		     ajax.aborted = true;
    		   ajax.xhr.abort();
   		    ajax.running = false;
      		 ajax.onTimeOut();
  		    }catch (e){}
  		   }
  		  }, (ajax.timeout * 1000)
  		 );
  		}
  		
  		if (ajax.params){
   		webim.each(ajax.params.split('&'), function(){
   		 if (this.length > 0){
    		 params.push(this);
   		 }
   		});
  		}
  		
  		if (ajax.debug){
  		 ajax.debugMessage = 'Method: '+ ajax.method +'\n'
   		 + 'URL: '+ ajax.url +'\n'
   		 + 'Parameters: '+ params.join('&');
  		}
   	  		
    if (ajax.method && (/post/i.test(ajax.method))) {
   		var uri = (/\?/.test(ajax.url)) ? ajax.url +'&rnd='+ Math.random() : ajax.url +'?rnd='+ Math.random();
   		ajax.xhr.open('POST', uri, true);
   		ajax.xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
   		ajax.xhr.setRequestHeader('Content-Length', (params.length > 0 ? params.join('&').length : 0));
   		ajax.xhr.setRequestHeader('Cache-control', 'no-cache');
   		ajax.xhr.setRequestHeader('Connection', 'close');
   		ajax.xhr.send(params.join('&'));
   	}else{
   		var uri = (/\?/.test(ajax.url)) ? ajax.url + (params.length > 0 ? '&'+ params.join('&') : '') +'&rnd='+ Math.random() : ajax.url +'?'+ (params.length > 0 ? params.join('&') +'&' : '') +'rnd='+ Math.random();
   		ajax.xhr.open('GET', uri, true);
   		ajax.xhr.send(null);
   	}
  	}catch (e)	{
    if (typeof(ajax.timer) !== 'undefined'){
     window.clearTimeout(ajax.timer);
    }
  	 window.clearInterval(ajax.runTime);
  	 ajax.running = false;
  	 ajax.idleStatus = 'stop';
 		 ajax.errorStatus = 'fatal';
  	 ajax.onIdle();
 		 ajax.onError();
  	}
	 }else{
		 ajax.errorStatus = 'support';
	  ajax.onError();
	 }
	 
	 return ajax;
	};
		
	//Dialog listesi
	webim.dialogs = {
	 _list: {},
	 running: function (id){
	  return this._list[id];
	 },
	 add: function (obj){
	  this._list[obj.id] = obj;
	  this.lastZIndex++;
	 },
	 remove: function (id){
	  var tmp = {};
	  
	  webim.each(this._list, function(n, v){
	   if (id != n){
	    tmp[n] = v;
	   }
	  });
	  
	  this._list = tmp;
	 },
	 num: function (id){
	  var n = 0;
	  
	  for (i in this._list){
	   n++;
	   if ((typeof(id) !== 'undefined') && (id == i)){
	    break;
	   }
	  }
	  
	  return n;
	 },
	 get: function (n){
	  var id, i = 0;
	  
	  for (id in this._list){
	   if ((typeof(n) !== 'undefined') && (n == i)){
	    break;
	   }
	   i++;
	  }
	  
	  return id;
	 },
  showHideBehinds: function (){
   webim.showHideBehinds(document, (this.get() ? this._list[this.get()].box : document));
  },
	 lastZIndex: 10000
	};
	
	webim.dialogSettings = function (){
	 return {
 		path: (webim.path ? webim.path : 'objects/icons/dialog/'),
 		modal: true,//true: model, false: window
 		position: ['center','center'],//[horizontal,vertical] top, left, center, right, bottom
 		width: 350,
 		height: 0,//0=Auto
 		title: '',
 		html: '',
 		onBeforeShow: function(){ return true; },
 		onAfterShow: function(){},
 		onBeforeHide: function(){ return true; },
 		onAfterHide: function(){},
 		onResize: function(){},
 		onAfterResize: function(){},
 		autoHideAfter: 0,
 		autoHideAfterFunc: function(){},
 		autoFocus: true,
 		showOnCreate: true,
 		resizable: false,
 		maxWidth: 0,
 		maxHeight: 0,
 		minWidth: 0,
 		minHeight: 0,
 		showCloseButton: true,
 		buttons: [],
 		buttonsPosition: 'right',//left, center, right
 		useBuiltInStyles: (webim.useBuiltInStyles ? true : false)
	 };
	};
	
	webim.dialog = function (){
	 var config = arguments[0] || {};
	 var dialog = new webim.dialogSettings();
	 dialog.id = 'webim_'+ Math.random().toString().substr(2);
	 
	 webim.each(config, function (n, v){
	  if (typeof(dialog[n]) !== 'undefined'){
	   dialog[n] = v;
	  }
	 });

  dialog.show = new Function();
  dialog.hide = new Function();
 	
	 //Değerler
	 var curW = 0, curH = 0, maxX = null, maxY = null, maxW = null, maxH = null, left = 0, top = 0;
	 
	 //Varsa onBeforeShow
	 if (!dialog.onBeforeShow()){
	  return dialog;
	 }
	 
	 dialog.init = function (){
	  if (this.modal){
  	 var veil = webim('$div')
   	           .setCSS({
  	             display:'none',
  	             position:'fixed',
  	             top:0,
  	             left:0,
  	             width:(webim.getWinW() +'px'),
  	             height:(webim.getWinH() +'px'),
  	             zIndex:webim.dialogs.lastZIndex,
  	             opacity:(webim.dialogs.num() > 0 ? 0.01 : 0.5),
  	             filter:'alpha(opacity='+ (webim.dialogs.num() > 0 ? 1 : 50) +')',
  	             cursor:'not-allowed'
  	            })
  	            .append('body');

  	 if (this.useBuiltInStyles){
  	  veil.setCSS({
      backgroundColor:'#ffffff'
  	  });
  	 }else{
  	  veil.addClass(CLASSES['dialogVeil'] || 'dialogVeil');
  	 }
  	 
  	 this.veil = veil.getEl();
	  }
	  
 	 var box = webim('$div')
 	           .setCSS({
	             display:'none',
 	            position:'fixed',
 	            zIndex:(webim.dialogs.lastZIndex+1)
 	           })
 	           .append('body');
 	            	      
 	 if (this.useBuiltInStyles){
 	  box.setCSS({
     border:'1px solid #aaaaaa',
     borderRadius:'5px',
     MozBorderRadius:'5px',
     webkitBorderRadius:'5px',
     backgroundColor:'#ffffff',
     padding:'5px',
     textAlign:'left'
 	  });
 	 }else{
 	  box.addClass(CLASSES['dialogBox'] || 'dialogBox');
 	 }
 	 
 	 this.box = box.getEl();
 	 
 	 var body = webim('$table $tbody $tr $td')
	            .setAttr({
              'border':0,
              'cellPadding':0,
              'cellSpacing':0
             }, 0)
	            .clone(2,true)
	            .clone(2,true)
	            .append(this.box);
 	            
 	 var tHead = body.getEl(3), tBody = body.getEls(['td'],4)[0], tFoot = body.getEls(['td'],5)[0];

 	 webim(tHead).setCSS({
                   	    height:'25px'
                   	   });
                      	   
   webim(tBody).setCSS({
          	             padding:'5px',
          	             height:'100%',
          	             verticalAlign:'top'
          	            });

   webim(tFoot).setCSS({
          	             height:'11px',
          	             textAlign:'right'
          	            });

 	 if (this.useBuiltInStyles){
  	 webim(tHead).setCSS({
                         background:'#60a9e1 url('+ this.path +'head.png) repeat-y',
                         borderRadius:'5px 5px 0 0',
                         MozBorderRadius:'5px 5px 0 0',
                         webkitBorderRadius:'5px 5px 0 0'
                    	   });
                       	   
    webim(tBody).setCSS({
           	             background:'url('+ this.path +'background.png) repeat-x'
           	            });

    webim(tFoot).setCSS({
           	             borderRadius:'0 0 5px 5px',
           	             MozBorderRadius:'0 0 5px 5px',
           	             webkitBorderRadius:'0 0 5px 5px'
           	            });
 	 }else{
 	  webim(tHead).addClass(CLASSES['dialogHead'] || 'dialogHead');
 	  webim(tBody).addClass(CLASSES['dialogBody'] || 'dialogBody');
 	  webim(tFoot).addClass(CLASSES['dialogFoot'] || 'dialogFoot');
 	 }
 	 
 	 this.body = tBody;
                      	   
   this.head = webim('$table $tbody $tr $td')
  	            .setAttr({
                'width':'100%',
                'border':0,
                'cellPadding':0,
                'cellSpacing':0
 	             }, 0)
 	             .append(tHead)
 	             .getEl(3);
 	 
 	 if (this.title.length > 0){
  	 var titleBar = webim('$div')
     	            .setCSS({
     	             height:'25px',
     	             lineHeight:'25px',
     	             overflow:'hidden',
     	             textIndent:'10px',
     	             cursor:'move'
     	            })
     	            .append(this.head)
     	            .setHTML(this.title);

 	  if (this.useBuiltInStyles){
 	   titleBar.setCSS({
      color:'#ffffff',
      fontWeight:'bold'
 	   });
 	  }else{
 	   titleBar.addClass(CLASSES['dialogTitle'] || 'dialogTitle');
 	  }
 	  
 	  this.titleBar = titleBar.getEl();

  	 this.topButtons = webim('$td')
  	                  .setCSS({
 	                    padding:'0 5px',
 	                    verticalAlign:'middle',
 	                    textAlign:'center',
 	                    width:'20px'
  	                  })
  	                  .after(this.head)
  	                  .getEl(0);
  	 
  	 if (this.showCloseButton){
   	 this.closeButton = webim('$div')
         	             .setCSS({
         	              margin:'auto',
         	              width:'16px',
         	              height:'16px',
         	              cursor:'pointer',
         	              background:'url('+ this.path +'close.png) no-repeat 0 0'
         	             })
         	             .addEvent('mouseover',function(e){
         	              e = e || window.event;
         	              var t = e.target ? e.target : e.srcElement;
         	              t.style['backgroundPosition'] = '0 -16px';
         	             })
         	             .addEvent('mouseout',function(e){
         	              e = e || window.event;
         	              var t = e.target ? e.target : e.srcElement;
         	              t.style['backgroundPosition'] = '0 0';
         	             })
         	             .addEvent('click',function(){
        	               dialog.hide();
         	             })
         	             .append(this.topButtons)
         	             .getEl();

   	 webim.addEvent(document,'keydown',function(e){
      e = e || window.event;
      var k = e.keyCode || e.charCode;
      if ((k == 27) && (webim.dialogs.get() === dialog.id)){
       webim.dialog({id: dialog.id}).hide();
       webim.removeEvent(document,'keydown',arguments.callee);
      }
   	 });
  	 }
 	 }else{
 	  webim(tHead).remove();
 	 }

 	 this.content = webim('$div')
    	            .setCSS({
    	             position:'relative',
 	                width: (this.width) +'px',
    	             height:(this.height > 0 ? this.height +'px' : 'auto'),
    	             overflow:'hidden'
    	            })
     	           .append(tBody)
    	            .getEl();

   if (typeof(this.html) === 'undefined'){
    webim(this.content).setHTML('Hedef içerik hatası!!');
   }else if (typeof(this.html) === 'object'){
    webim(this.html).setCSS({display:'block'});
    webim(this.html).append(this.content);
   }else{
    webim(this.content).setHTML(this.html);
   }
	  
 	 //Sıfırlayalım
 	 webim.each(webim(this.box).getEls(['form']), function(){
 	  webim(this).reset();
 	 });

   if (webim.getLength(this.buttons)){
    this.buttonsBar = webim('$div')
                     .setCSS({
                      textAlign:dialog.buttonsPosition
                     })
                     .addClass(CLASSES['dialogButtons'] || 'dialogButtons')
                     .after(this.content)
                     .getEl();

    var button, style;

    webim.each(this.buttons, function(n, v){
     cls = this.className || '';
     
     style = {margin:'0 2px'};
     if (this.style){
      for (prop in this.style){
       style[prop] = this.style[prop];
      }
     }
     
     button = webim('$button')
     .setClass(cls)
     .setCSS(style)
     .addEvent('click', function(){
       if (v.onClick){
        v.onClick(dialog);
       }
      })
     .append(dialog.buttonsBar).getEl();
          
     if (this.icon){
      webim('$img').setAttr({
       'src':dialog.path + this.icon,
       'alt':''
      }).setCSS({
       verticalAlign:'middle',
       paddingRight:'5px'
      }).append(button);
     }
     
     webim('$span').setHTML(this.label || (LANGUAGE['ok'] || 'Tamam')).append(button);
     
     button.disabled = this.disabled;
     this.obj = button;
    });
   }
   
 	 if (this.resizable){
  	 this.resizer = webim('$img')
  	               .setAttr({
  	                src:this.path +'resize.png',
  	                width:'11px',
  	                height:'11px',
  	                alt:''
  	               })
  	               .setCSS({
  	                left:webim(this.box).getSize()['width']+'px',
  	                top:webim(this.box).getSize()['height']+'px',
  	                cursor:'se-resize',
  	                border:'0',
  	                padding:'0'
  	               })
  	               .append(tFoot)
  	               .getEl();
	  
  	 if (this.minWidth < 1){
  	  this.minWidth = this.width;
  	 }
 	 }else{
 	  webim(tFoot).remove();
 	 }
	 };
	 
	 dialog.mask = function (show){
	  if (show){
	   this.maskVeil = webim('$div')
               	   .setCSS({
               	    position:'absolute',
               	    top:0,
               	    left:0,
               	    width:webim(this.content).getSize()['width']+'px',
               	    height:webim(this.content).getSize()['height']+'px',
               	    backgroundColor:'#ffffff',
                    opacity:0.01,
                    filter:'alpha(opacity=1)',
                    cursor:'progress'
               	   })
               	   .append(this.content)
                	  .getEl();

	   webim.showHideBehinds(this.box, this.maskVeil);
	  }else if (this.maskVeil){
	   webim(this.maskVeil).remove();
	   this.maskVeil = null;
	   webim.showHideBehinds(this.box, this.box);
	  }
	 };

	 dialog.show = function (){
	  webim(this.veil).setCSS({display:'block'});
	  webim(this.box).setCSS({display:'block'});
 	 webim(this.box).setCSS({
    left:((webim.getWinW() / 2) - (webim(this.box).getSize()['width'] / 2)) +'px',
    top:((webim.getWinH() / 2) - (webim(this.box).getSize()['height'] / 2)) +'px'
 	 },0);
 	 
 	 if (this.minHeight < 1){
 	  this.minHeight = webim(this.content).getSize()['height'];
 	 }
 	 
 	 //Listeye ekleyelim
	  webim.dialogs.add(dialog);
 	 
 	 //Konumlandıralım
 	 this.setAlign();
 	 this.setResizer();
 	 
 	 //Auto Hide
 	 if (this.autoHideAfter > 0){
 	  window.setTimeout(function(){
 	   dialog.hide();
 	  }, 1000 * this.autoHideAfter);
 	  this.autoHideAfterFunc();
 	 }
 	 
 	 //Görünür / Görünmez
 	 webim.dialogs.showHideBehinds();
 	 
 	 //Varsa onAfterShow
 	 if (!this.onAfterShowRunned){
 	  this.onAfterShow();
 	  this.onAfterShowRunned = true;
 	 }
 	 
 	 //Focus olalım
 	 if (this.autoFocus){
	   webim.focusIn(this.box);
 	 }
	 };
	 
	 dialog.hide = function (){
	  if (this.onBeforeHide()){
	   if (typeof(this.html) === 'object'){
	    webim(this.html).setCSS({display:'none'});
	    webim(this.html).append('body');
	   }
 	  webim(this.veil).remove();
 	  webim(this.box).remove();
 	  //Listeden çıkaralım
 	  webim.dialogs.remove(this.id);
 	  webim.removeEvent(window, 'resize', function(){
 	   dialog.setAlign();
 	  });
  	 
  	 //Görünür / Görünmez
  	 webim.dialogs.showHideBehinds();
 	  
 	  if (!this.onAfterHideRunned){
 	   this.onAfterHide();
 	   this.onAfterHideRunned = true;
 	  }
	  }
	 };
	 
	 dialog.setResizer = function (){
 	 if (this.resizer){
  	 //Değişkenler
  	 curW = webim(this.content).getSize()['width'];
  	 curH = webim(this.content).getSize()['height'];
  	 maxX = webim.getWinW() - webim(this.box).getSize()['width'];
  	 maxY = webim.getWinH() - webim(this.box).getSize()['height'];
  	 maxW = this.maxWidth > 0 ? this.maxWidth : null;
  	 maxH = this.maxHeight > 0 ? this.maxHeight : null;
  	 
  	 webim(this.resizer).setCSS({left:curW +'px',top:curH+'px'});

 	  webim.drag.init(this.resizer, null, this.minWidth, maxW, this.minHeight, maxH);
 	  
  	 this.resizer.onDrag = function (){
  	  var obj = this;
  	  
  	  webim(dialog.content).setCSS({
  	   width: (parseInt(obj.style.left) +'px'),
  	   height: (parseInt(obj.style.top) +'px')
  	  });
  	  
  	  if (dialog.maskVeil){
   	  webim(dialog.maskVeil).setCSS({
   	   width: (parseInt(obj.style.left) +'px'),
   	   height: (parseInt(obj.style.top) +'px')
   	  });
  	  }
  	  
  	  dialog.onResize(obj);
  	 };
  	 
  	 this.resizer.onDragEnd = function (){
  	  dialog.setBoxValues();
  	  dialog.onAfterResize();
  	 };
 	 }
	 };
	 
	 dialog.setAlign = function (){
	  webim(this.veil).setCSS({
	   width: webim.getWinW() +'px',
	   height: webim.getWinH() +'px'
	  });
	  
	  left = 0, top = 0;
	  
	  switch (this.position[0]){
	   case 'center':
 	   left = (webim.getWinW() / 2) - (webim(this.box).getSize()['width'] / 2);
 	   break;
	   case 'right':
 	   left = webim.getWinW() - webim(this.box).getSize()['width'];
 	   break;
 	  default:
 	   if (!isNaN(this.position[0])){
 	    left = parseFloat(this.position[0]);
 	   }
 	   break;
	  }
	  
	  switch (this.position[1]){
	   case 'center':
 	   top = (webim.getWinH() / 2) - (webim(this.box).getSize()['height'] / 2);
 	   break;
	   case 'bottom':
 	   top = webim.getWinH() - webim(this.box).getSize()['height'];
 	   break;
 	  default:
 	   if (!isNaN(this.position[1])){
 	    top = parseFloat(this.position[1]);
 	   }
 	   break;
	  }
	  
	  webim(this.box).setCSS({
	   top: top +'px',
	   left: left +'px'
	  });

	  dialog.setBoxValues();
	 };
 	 
 	dialog.setBoxValues = function (){
	  maxX = webim.getWinW() - webim(this.box).getSize()['width'];
 	 maxY = webim.getWinH() - webim(this.box).getSize()['height'];
	  
 	 if (this.titleBar){
 	  webim.drag.init(this.titleBar, this.box, 0, maxX, 0, maxY);
 	  
 	  if (!this.modal){
 	   webim(this.box).addEvent('mousedown',function(){
 	    webim(dialog.box).setCSS({zIndex:(webim.dialogs.lastZIndex+1)});
   	  webim.dialogs.remove(dialog.id);
   	  webim.dialogs.add(dialog);
 	    webim.dialogs.lastZIndex++;
    	 //Görünür / Görünmez
    	 if (dialog.maskVeil){
    	  webim.showHideBehinds(document, (dialog.maskVeil ? dialog.maskVeil : dialog.box));
    	 }else{
    	  webim.dialogs.showHideBehinds();
    	 }
 	   });
 	  }
 	 }
	 };

	 if (!webim.dialogs.running(dialog.id)){
	  dialog.init();
 	 
	  //Resize Event
 	 webim.addEvent(window, 'resize', function(){
 	  dialog.setAlign();
 	 });
	  
	  if (dialog.showOnCreate){
	   dialog.show();
	  }
	 }else{
	  dialog = webim.dialogs.running(dialog.id);
	 }
	 
	 return dialog;
	};
	
	webim.message = function (){
	 var config = arguments[0] || {};
	 var types = ['info','ok','find','error','warning','caution','forbidden','delete','question','confirm'];
	 
	 var html = webim('$div $table $tbody $tr $td')
	           .setAttr({
             'width':'100%',
             'border':0,
             'cellPadding':5,
             'cellSpacing':0
            },1)
	           .setCSS({
	            height:'80px',
	            textAlign:'center'
	           },4)
 	          .setHTML('<img src="'+ webim.dialogSettings().path + ((config.type && webim.inArray(config.type,types)) ? config.type : types[0]) +'.png" width="32" height="32" alt="" style="border:0; vertical-align:middle; padding:5px 5px" \/> '+ config.text || '', 4);

 	var buttons = [];
 	
 	if (config.type && (config.type == 'confirm')){
 	 buttons.push(
 		 {
 		  label: (LANGUAGE['yes'] || 'Evet'),
 		  onClick: config.onConfirm || function(dialog){
 		   dialog.hide();
 		  }
 		 }
 	 );
 	 buttons.push(
 		 {
 		  label: (LANGUAGE['no'] || 'Hayır'),
 		  onClick: config.onNotConfirm || function(dialog){
 		   dialog.hide();
 		  }
 		 }
 	 );
 	}else{
 	 buttons.push(
 		 {
 		  label: (LANGUAGE['ok'] || 'Tamam'),
 		  onClick: config.onOK || function(dialog){
 		   dialog.hide();
 		  }
 		 }
 	 );
 	}
	 
	 return webim.dialog({
	  id: config.id || 'webim_'+ Math.random().toString().substr(2),
	  modal: true,
 		title: config.title || (LANGUAGE['messageTitle'] || 'Mesaj'),
 		html: html.getEl().innerHTML,
 		width: 320,
 		onBeforeShow: config.onBeforeShow || function(){ return true; },
 		onAfterShow: config.onAfterShow || function(){},
 		onBeforeHide: config.onBeforeHide || function(){ return true; },
 		onAfterHide: config.onAfterHide || function(){},
 		autoHideAfter: config.onAfterHide || 0,
 		autoHideAfterFunc: config.autoHideAfterFunc || function(){},
 		buttons: buttons,
 		buttonsPosition: 'center',
 		useBuiltInStyles: config.useBuiltInStyles || webim.dialogSettings().useBuiltInStyles
	 });
	};
	
	webim.showHideBehinds = function (world, forest){
	 world = world || document;
	 forest = forest || document;
	 
  var tags = ['object','applet','iframe'], i = 0, els = [];
  
  if (webim.browser.msie && (webim.browser.version < 8)){
   tags.push('select');
  }
  
  els = webim.getSubElements(world, tags);
  
  for (i=0; i < els.length; i++){
   els[i].style['visibility'] = 'hidden';
  }
  
  els = webim.getSubElements(forest, tags);
  
  for (i=0; i < els.length; i++){
   els[i].style['visibility'] = 'visible';
  }
	};
	
	webim.drag = {
  obj: null,
  init: function (o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper){
   o.onmousedown	= webim.drag.start;
 
   o.hmode	= bSwapHorzRef ? false : true;
   o.vmode	= bSwapVertRef ? false : true;
 
   o.root = oRoot && oRoot != null ? oRoot : o;
 
   if (o.hmode && isNaN(parseInt(o.root.style.left))){
    o.root.style.left = '0px';
   }
   if (o.vmode && isNaN(parseInt(o.root.style.top))){
    o.root.style.top = '0px';
   }
   if (!o.hmode && isNaN(parseInt(o.root.style.right))){
    o.root.style.right = '0px';
   }
   if (!o.vmode && isNaN(parseInt(o.root.style.bottom))){
    o.root.style.bottom = '0px';
   }
 
   o.minX	= ((typeof(minX) !== 'undefined') ? minX : null);
   o.minY	= ((typeof(minY) !== 'undefined') ? minY : null);
   o.maxX	= ((typeof(maxX) !== 'undefined') ? maxX : webim.getWinW());
   o.maxY	= ((typeof(maxY) !== 'undefined') ? maxY : webim.getWinH());
 
   o.xMapper = fXMapper ? fXMapper : null;
   o.yMapper = fYMapper ? fYMapper : null;
 
   o.root.onDragStart	= new Function();
   o.root.onDragEnd	= new Function();
   o.root.onDrag		= new Function();
  },
  start: function (e){
   var o = webim.drag.obj = this;
   e = webim.drag.fixE(e);
   var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
   var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
   o.root.onDragStart(x, y);
 
   o.lastMouseX	= e.clientX;
   o.lastMouseY	= e.clientY;
 
   if (o.hmode) {
    if (o.minX != null){
     o.minMouseX	= e.clientX - x + o.minX;
    }
    if (o.maxX != null){
     o.maxMouseX	= o.minMouseX + o.maxX - o.minX;
    }
   }else{
    if (o.minX != null){
     o.maxMouseX = -o.minX + e.clientX + x;
    }
    if (o.maxX != null){
     o.minMouseX = -o.maxX + e.clientX + x;
    }
   }
 
   if (o.vmode){
    if (o.minY != null){
     o.minMouseY	= e.clientY - y + o.minY;
    }
    if (o.maxY != null){
     o.maxMouseY	= o.minMouseY + o.maxY - o.minY;
    }
   }else{
    if (o.minY != null){
     o.maxMouseY = -o.minY + e.clientY + y;
    }
    if (o.maxY != null){
     o.minMouseY = -o.maxY + e.clientY + y;
    }
   }
 
   document.onmousemove	= webim.drag.drag;
   document.onmouseup		= webim.drag.end;
 
   return false;
  },
  drag: function (e){
   e = webim.drag.fixE(e);
   var o = webim.drag.obj;
 
   var ey	= e.clientY;
   var ex	= e.clientX;
   var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
   var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
   var nx, ny;
 
   if (o.minX != null){
    ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX);
   }
   if (o.maxX != null){
    ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX);
   }
   if (o.minY != null){
    ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY);
   }
   if (o.maxY != null){
    ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY);
   }
 
   nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));
   ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));
 
   if (o.xMapper){
    nx = o.xMapper(y);
   }else if (o.yMapper){
    ny = o.yMapper(x);
   }
 
   webim.drag.obj.root.style[o.hmode ? 'left' : 'right'] = nx + 'px';
   webim.drag.obj.root.style[o.vmode ? 'top' : 'bottom'] = ny + 'px';
   webim.drag.obj.lastMouseX	= ex;
   webim.drag.obj.lastMouseY	= ey;
 
   webim.drag.obj.root.onDrag(nx, ny);
   return false;
  },
  end: function (){
   document.onmousemove = null;
   document.onmouseup   = null;
   webim.drag.obj.root.onDragEnd(	parseInt(webim.drag.obj.root.style[webim.drag.obj.hmode ? 'left' : 'right']),
   parseInt(webim.drag.obj.root.style[webim.drag.obj.vmode ? 'top' : 'bottom']));
   webim.drag.obj = null;
  },
  fixE: function (e){
   if (typeof(e) === 'undefined'){
    e = window.event;
   }
   if (typeof(e.layerX) === 'undefined'){
    e.layerX = e.offsetX;
   }
   if (typeof(e.layerY) === 'undefined'){
    e.layerY = e.offsetY;
   }
   return e;
  }
 };
 
 webim.focusIn = function (obj){
  var all = obj.getElementsByTagName('*'), els = [], el, i = 0, tag, focusable;
  webim.each(all, function(){
   if (this.tagName){
    tag = this.tagName.toLowerCase();

    if (((tag == 'input') && (webim.inArray(this.type, ['button','text','password']))) || (webim.inArray(tag, ['textarea','button']))){
     els.push(this);
    }
   }
  });
  
  if (els.length > 0){
   for (i in els){
    el = els[i];
    focusable = true;
    
    while (el.parentNode != obj){
     if ((el.style['display'] == 'none') || (el.style['visibility'] == 'hidden') || (el.disabled)){
      focusable = false;
      break;
     }
     el = el.parentNode;
    }
    
    if (focusable){
     els[i].focus();
     break;
    }
   }
  }
 };
	
	webim.animate = function (){
	 var config = arguments[0] || {};
  var animation = {
			_started: false,
   _value: config._value || 0,
			_stop: false,
   speed: config.speed || 30,// 15 fps
			timer: (typeof(config.timer) !== 'undefined' ? config.timer : 1),
   onStart: config.onStart || function(){},
   onAnimate: config.onAnimate || function(){},
   onEnd: config.onEnd || function(){},
   stop: function (){
    this._stop = true;
   }
  };
 	
		if (!animation._started){
		 animation.onStart();
			animation._started = true;
		}
		
		animation.onAnimate();
		
 	if (!animation._stop && ((animation.timer == 0) || (animation._value < (animation.timer * 1000)))){
		 animation._value += animation.speed;
						
 		window.setTimeout(function(){
 			webim.animate(animation);
 		}, animation.speed);
 	}else{
 	 animation.onEnd();
 	}
 	
 	return animation;
	};
 
 webim.is = {
  eMail: function (str){
   return /^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/.test(str);
  },
  date: function (str){
   var delimChar = '-';
   
   str = str.value ? str.value : str;
   str = str.replace(/\./g, delimChar);
   str = str.replace(/\//g, delimChar);
  
   var mo, day, yr;
   var entry = str;
   var re = /\b\d{1,2}[\/-]\d{1,2}[\/-]\d{4}\b/;
  
   if (entry.length == 0){
    return true;
   }
  
   if (re.test(entry)) {
    var splitted = entry.split(delimChar);
  
    if (splitted.length == 3){
     day = splitted[0];
     mo  = splitted[1];
     yr  = splitted[2];
  
     var testDate = new Date(yr, mo-1, day);
  
     if ((testDate.getDate() == day) && ((testDate.getMonth() + 1) == mo) && (testDate.getFullYear() == yr)) {
      return true;
     }
    }else{
     return false;
    }
   }
  
   return false;
  }
 };
 
 webim.only = function (e, type, specialCodes){
		e = e || window.event;
 	var codes = [], i = 0; k = e.keyCode ? e.keyCode : e.charCode;
 	
 	switch (type){
 		case 'numbers':
 			codes = [8,9,46,48,49,50,51,52,53,54,55,56,57];
 			break;
 		case 'characters':
 			codes.push(8,9,199,214,220,231,246,252,286,287,304,305,350,351);
 			for (i=65; i < 91; i++){
 				codes.push(i);
 			}
 			for (i=97; i < 123; i++){
 				codes.push(i);
 			}
 			break;
 		case 'datechars':
 			codes = [8,9,45,46,47,48,49,50,51,52,53,54,55,56,57];
 			break;
 	}
 	
 	if (typeof(specialCodes) !== 'undefined'){
 		for (i in specialCodes){
 			if (!webim.inArray(specialCodes[i], codes)){
 				codes.push(specialCodes[i]);
 			}
 		}
 	}
 	
		return webim.inArray(k, codes);
 };
 
 webim.to = {
  upper: function (obj){
   if (webim.inArray(webim(obj).getType(), ['text','textarea'])){
    webim(obj).setValue(webim.trim(webim(obj).getValue()).replace(/i/g,'İ').toUpperCase());
   }
  },
  lower: function (obj){
   if (webim.inArray(webim(obj).getType(), ['text','textarea'])){
    webim(obj).setValue(webim.trim(webim(obj).getValue()).replace(/İ/g,'i').toLowerCase());
   }
  }
 };
 
 webim.kuki = {
  get: function (name) {
   name = name +'=';
   var carray = document.cookie.split(';');
 
   for(var i=0; i < carray.length; i++) {
    var c = carray[i];
    while (c.charAt(0) == ' '){
     c = c.substring(1, c.length);
    }
    if (c.indexOf(name) == 0){
     return c.substring(name.length, c.length);
    }
   }
   return null;
  },
  set: function (name, value, seconds) {
   if (typeof(seconds) !== 'undefined') {
    var date = new Date();
    date.setTime(date.getTime() + (seconds * 1000));
    var expires = '; expires='+ date.toGMTString();
   }else{
    var expires = '';
   }
 
   document.cookie = name +'='+ value+expires +'; path=/';
  },
  del: function (name) {
   this.set(name, '', -1);
  }
 };
 
 webim.addToBookmarks = function (){
  var t = document.title, u = document.URL;
  if (window.sidebar){
   window.sidebar.addPanel(t, u, '');
  }else if (document.all){
   window.external.AddFavorite(u, t);
  }else if (window.opera && window.print) {
   return true;
  }
 };

 webim.print = function (){
	 var config = arguments[0] || {};
  var pr = window.open('about:blank', 'printPreview', 'width=800, height=600, scrollbars=yes');
  pr.document.open('text/html');
  pr.document.write('<html>');
  pr.document.write('<head>');
  pr.document.write('<title>'+ (config.title || 'Yazdır') +'</title>');
  pr.document.write('<meta http-equiv="Content-type" content="text/html; charset=utf-8" />');
  pr.document.write('<style type="text/css">');
  pr.document.write('body {font:10pt Arial;}');
  pr.document.write('td, div, p {font:10pt Arial;}');
  pr.document.write('fieldset {border:none}');
  pr.document.write('legend {font-weight:bold}');
  pr.document.write('.link-bar {margin-bottom:5px}');
  pr.document.write('table {border-collapse:collapse; border:1px solid #000000}');
  pr.document.write('.grid-title,.statTitle,.statTitle1,.statTitle2,.totalRow,.totalRow1,.totalRow2 {font-weight:bold; border:1px solid #000}');
  pr.document.write('.gridRow,.grid-right,.statRow,.statRow1,.statRow2,.statRow1_1,.statRow1_2,.statRow2,.statRow2_1,.statRow2_2 {border:1px solid #000}');
  pr.document.write('.grid-left {font-weight:bold; text-align:right; border:1px solid #000}');
  pr.document.write('.title {margin:5px 0; font-size:14px; font-weight:bold; text-align:center}');
  pr.document.write('</style>');
  pr.document.write('</head>');
  pr.document.write('<body>');
  if (config.title) {
   pr.document.write('<div class="title">'+ config.title +'</div>');
  }
  pr.document.write(config.html || '');
  pr.document.write('</body>');
  pr.document.write('</html>');
  pr.document.close();
  pr.print();
  pr.close();
 };
 
 webim.submit = function (){
	 var config = arguments[0] || {};
  var fr = webim('$form $input')
          .setAttr({
           method: 'post',
           action: config.url || 'index.php?page='+ (config.to || 'word')
          },0)
          .setAttr({
           type: 'hidden',
           name: 'HTMLContent',
           value: config.html || ''
          },0)
          .append('body');
                            
  fr.getEl().submit();
  fr.remove(0);
 };
 
 webim.tab = function (id, obj){
  var tabBar = webim('#tabs'+ id);
  var tabbingBar = webim('#tabbing'+ id);
  var tabs = [], nods, i = 0;

  if (tabbingBar.getEl()){
   nods = tabbingBar.getEl().childNodes;
   for (i=0; i < nods.length; i++){    
    if (nods[i].tagName && (nods[i].tagName.toLowerCase() == 'div') && nods[i].className && (nods[i].className == (CLASSES['tab'] || 'tab'))){
     tabs.push(nods[i]);
    }
   }
  }
  
  if (tabBar.getEl()){
   nods = tabBar.getEls(['a']);
   if (!obj && (nods.length > 0)){
    obj = nods[0];
   }
   
   for (i=0; i < nods.length; i++){
    nods[i].parentNode.className = '';
    if (tabs[i]){
     tabs[i].style.display = 'none';
    }
    if (nods[i] == obj){
     nods[i].parentNode.className = (CLASSES['here'] || 'here');
     if (tabs[i]){
      tabs[i].style.display = 'block';
     }
    }
   }
  }
 };
 
	webim.overRow = function (obj, clName){
  webim.each(webim(obj.parentNode).getEls(['td']), function(n, v){
  	webim(v).setClass(clName);
  });
	};
	
	webim.check = function (obj){
	 var el = null;
	 
	 if (typeof(obj) === 'string'){
	  el = webim('#'+ obj).getEl();
	 }else if (obj){
	  el = obj;
	 }
	 
	 if (el && (webim(el).getType() == 'checkbox') && !el.disabled){
	  el.checked = !el.checked;
	 }
	};
 
 webim.form = function (){
	 var config = arguments[0] || {};

	 this.url = config.url || 'index.php';
  this.params = config.params || {};
  this.targetDialog = config.targetDialog || 'dialog';
  this.targetForm = config.targetForm || null;
  this.targetList = config.targetList || 'list';
  this.dialogTitle = config.title || 'Kayıt';
  this.dialogWidth = config.width || 500;
  this.pagingBars = config.pagingBars || [true, true];
  this.contents = {
   'dialog'  : (config.contents && (typeof(config.contents['dialog']) !== 'undefined'))   ? config.contents['dialog']   : true,
   'editing' : (config.contents && (typeof(config.contents['editing']) !== 'undefined'))  ? config.contents['editing']  : true,
   'deleting': (config.contents && (typeof(config.contents['deleting']) !== 'undefined')) ? config.contents['deleting'] : true,
   'listing' : (config.contents && (typeof(config.contents['listing']) !== 'undefined'))  ? config.contents['listing']  : true
  };
  this.labels = {
   'save'    : config.labels && config.labels['save']     || (LANGUAGE['save'] || 'Kaydet'),
   'delete'  : config.labels && config.labels['delete']   || (LANGUAGE['del'] || 'Sil'),
   'cancel'  : config.labels && config.labels['cancel']   || (LANGUAGE['cancel'] || 'İptal'),
			'loading' : config.labels && config.labels['loading']  || (LANGUAGE['loading'] || 'Yükleniyor...'),
			'saving'  : config.labels && config.labels['saving']   || (LANGUAGE['saving'] || 'Kaydediliyor...'),
			'deleting': config.labels && config.labels['deleting'] || (LANGUAGE['deleting'] || 'Siliniyor...'),
	  'first'   : config.labels && config.labels['first']    || (LANGUAGE['first'] || 'İlk'),
	  'previous': config.labels && config.labels['previous'] || (LANGUAGE['previous'] || 'Önceki'),
	  'next'    : config.labels && config.labels['next']     || (LANGUAGE['next'] || 'Sonraki'),
	  'last'    : config.labels && config.labels['last']     || (LANGUAGE['last'] || 'Son'),
	  'total'   : config.labels && config.labels['total']    || (LANGUAGE['total'] || 'Toplam')
  };
  this.actions = {
   'list'  : config.actions && config.actions['list']   || 'list',
   'save'  : config.actions && config.actions['save']   || 'save',
   'values': config.actions && config.actions['values'] || 'values',
   'delete': config.actions && config.actions['delete'] || 'delete'
  };
  
  this.onBeforeShow = config.onBeforeShow || function (){
   return true;
  };
  
  this.onAfterShow = config.onAfterShow || function (){};
  
  this.onBeforeSave = config.onBeforeSave || function (){
   return true;
  };
  
  this.onAfterSave = config.onAfterSave || function (){};
  
  this.onBeforeList = config.onBeforeList || function (){
   return true;
  };
  
  this.onAfterList = config.onAfterList || function (){};
   
  this.onBeforeDelete = config.onBeforeDelete || function (){
   return true;
  };
  
  this.onAfterDelete = config.onAfterDelete || function (){};
  
  this.onBeforeValues = config.onBeforeValues || function (){
   return true;
  };
  
  this.onAfterValues = config.onAfterValues || function (){};
  this.onAfterLoad = config.onAfterLoad || function (){};
  
  var obj = this;
  
  webim.each(config, function (n, v){
   if (!obj[n]){
    obj[n] = v;
   }
  });
  
  this.show = function (id){
   if (obj.contents['dialog']){
    var buttons = [];
    var btnSave = {
     label: obj.labels['save'],
     className: 'submit',
     onClick: obj.save
    };
    var btnDelete = {
     label: obj.labels['delete'],
     onClick: function(){
      obj.del(id);
     }
    };
    var btnCancel = {
     label: obj.labels['cancel'],
     onClick: function (d){
      d.hide();
     }
    };
    
    if (obj.contents['editing']){
     buttons.push(btnSave);
    }
    
    if ((typeof(id) !== 'undefined') && obj.contents['deleting']){
     buttons.push(btnDelete);
    }
    
    buttons.push(btnCancel);
    
    if (webim('#'+ obj.targetDialog).getEl()){
     webim.dialog({
      id: obj.targetDialog,
      title: obj.dialogTitle,
      width: obj.dialogWidth,
      html: webim('#'+ obj.targetDialog).getEl(),
      onBeforeShow: obj.onBeforeShow,
      onAfterShow: function(){
       obj.onAfterShow();
       if (typeof(id) !== 'undefined'){
        obj.values(id);
       }else{
        obj.onAfterLoad();
       }
      },
      buttons: buttons
     }).show();
    }else{
     webim.message({
      type: 'error',
      text: (LANGUAGE['noDialog'] || 'Hedef dialog bulunamadı!')
     });
    }
   }
  };
  
  this.list = function (criterias){
   if (webim('#'+ obj.targetList).getEl()){
    if (obj.contents['listing']){
     if (obj.onBeforeList()){
      var k, params = [];
      
      if (typeof(criterias) !== 'undefined'){
       for (k in criterias){
        obj.params[k] = criterias[k];
       }
      }
      
      for (k in obj.params){
       params.push(k +'='+ encodeURIComponent(obj.params[k]));       
      }
      
      webim.ajax({
       id: obj.targetDialog,
       url: obj.url +'&act='+ obj.actions['list'],
       params: (params.length > 0 ? params.join('&') : null),
       type: 'LIST',
       loadingMessage: obj.labels['loading'],
       list: webim('#'+ obj.targetList).getEl(),
       onSuccess: function (){
        webim('#'+ obj.targetList).clear();
        var stat = this.xml.getElementsByTagName('stat'),
        xml = this.xml.getElementsByTagName('list'),
        i = 0, x = 0, y = 0, total = 0;
        
        if (stat.length > 0){
         x = parseFloat(stat.item(0).getAttribute('x'));
         y = parseFloat(stat.item(0).getAttribute('y'));
         total = parseFloat(stat.item(0).getAttribute('total'));
        }
        
        if (xml.length > 0){
         if (obj.pagingBars[0] == true){
          webim(obj.paging.show('top',x,y,total)).append(webim('#'+ obj.targetList).getEl());
         }
         for (i=0; i < xml.length; i++){
          webim(obj.parseXML(xml.item(i))).append(webim('#'+ obj.targetList).getEl());
         }
         if (obj.pagingBars[1] == true){
          webim(obj.paging.show('bottom',x,y,total)).append(webim('#'+ obj.targetList).getEl());
         }
        }else{
         webim('$div')
         .append(webim('#'+ obj.targetList).getEl())
         .addClass(CLASSES['warning'] || 'warning')
         .setHTML(LANGUAGE['noResult'] || 'Herhangi bir sonuç bulunamadı!');
        }
       }
      });
     }
    }
   }else{
    webim.message({
     type: 'error',
     text: (LANGUAGE['noTarget'] || 'İçerik bulunamadı!') +' ('+ obj.targetList +')'
    });
   }
  };
  
  this.paging = {
   x: 0,
   y: 20,
   total: 0,
   curY: 20,
   pages: {
    10:10,
    20:20,
    30:30,
    50:50
   },
   show: function (pos, x, y, total){
    this.x = x;
    this.y = this.curY = y;
    this.total = total;
    this.calculate();
    return this.create(pos);
   },
   calculate: function (){
    this.first = 0;
    this.previous = this.x - this.y;
    this.next = this.x + this.y;
    this.last = this.total - ((this.total%this.y == 0) ? this.y : (this.total%this.y));
   },
   labelFirst: function (){
    var html;
    if ((this.total > 0) && (this.first < this.x)){
     html = webim('$a')
           .setAttr({href:'javascript:void(0)'})
           .setHTML(obj.labels['first'])
           .addEvent('click',function(e){
            e = e || window.event;
            obj.list({x:0,y:obj.paging.curY});
           });
    }else{
     html = webim('$span')
          .setCSS({color:'#cccccc'})
          .setHTML(obj.labels['first']);
    }
    return html;
   },
   labelPrevious: function (){
    var html;
    if (this.x > 0){
     html = webim('$a')
           .setAttr({href:'javascript:void(0)'})
           .setHTML(obj.labels['previous'])
           .addEvent('click',function(e){
            e = e || window.event;
            obj.list({x:obj.paging.previous,y:obj.paging.curY});
           });
    }else{
     html = webim('$span')
          .setCSS({color:'#cccccc'})
          .setHTML(obj.labels['previous']);
    }
    return html;
   },
   labelNext: function (){
    var html;
    if (this.x < (this.total - this.y)){
     html = webim('$a')
           .setAttr({href:'javascript:void(0)'})
           .setHTML(obj.labels['next'])
           .addEvent('click',function(e){
            e = e || window.event;
            obj.list({x:obj.paging.next,y:obj.paging.curY});
           });
    }else{
     html = webim('$span')
          .setCSS({color:'#cccccc'})
          .setHTML(obj.labels['next']);
    }
    return html;
   },
   labelLast: function (){
    var html;
    if ((this.total > 0) && ((this.x + this.y) < this.total)){
     html = webim('$a')
           .setAttr({href:'javascript:void(0)'})
           .setHTML(obj.labels['last'])
           .addEvent('click',function(e){
            e = e || window.event;
            obj.list({x:obj.paging.last,y:obj.paging.curY});
           });
    }else{
     html = webim('$span')
          .setCSS({color:'#cccccc'})
          .setHTML(obj.labels['last']);
    }
    return html;
   },
   create: function (pos){
    var table = webim('$table $tbody $tr $td')
               .setAttr({'width':'100%','border':0,'cellPadding':0,'cellSpacing':0},0)
               .clone(3)
               .clone(3)
               .setCSS({padding:'5px 0'},3)
               .setCSS({padding:'5px 0',textAlign:'center',width:'34%'},4)
               .setCSS({padding:'5px 0',textAlign:'right',width:'33%'},5);
    
    webim('$select')
    .setAttr({'name':'pagingY'+ Math.random().toString().substr(2)})
    .fillOptions(this.pages)
    .setValue(this.curY)
    .append(table.getEl(3))
    .addEvent('change',function(e){
     e = e || window.event;
     var t = e.target ? e.target : e.srcElement;
     obj.paging.curY = t.options[t.selectedIndex].value;
     obj.list({x:0,y:obj.paging.curY});
    });
    
    if (pos == 'top'){
     webim('$span')
     .append(table.getEl(4))
     .setHTML(obj.labels['total'] +': '+ this.total +' | '+ (this.x + 1) +' - '+ (this.x + this.y));
    }else{
     var opts = {};
     
     for (var i=0; i < Math.ceil(this.total / this.y); i++){
      opts[(i*this.y)] = (i+1);
     }
     
     webim('$select')
     .setAttr({'name':'pagingPages'})
     .fillOptions(opts)
     .setValue(this.x)
     .append(table.getEl(4))
     .addEvent('change',function(e){
      e = e || window.event;
      var t = e.target ? e.target : e.srcElement;
      obj.list({x:t.options[t.selectedIndex].value,y:obj.paging.curY});
     });
    }
    
    this.labelFirst().append(table.getEl(5));
    webim('$span').append(table.getEl(5)).setHTML('&nbsp;|&nbsp;');
    this.labelPrevious().append(table.getEl(5));
    webim('$span').append(table.getEl(5)).setHTML('&nbsp;|&nbsp;');
    this.labelNext().append(table.getEl(5));
    webim('$span').append(table.getEl(5)).setHTML('&nbsp;|&nbsp;');
    this.labelLast().append(table.getEl(5));
    
    return table.getEl(0);
   }
  };
  
  this.save = function (){
   if (obj.onBeforeSave()){
    webim.ajax({
     id: obj.targetDialog,
     url: obj.url +'&act='+ obj.actions['save'],
     params: webim('#'+ (obj.targetForm ? obj.targetForm : obj.targetDialog)).getFormElements().getParams(),
     type: (obj.contents['dialog'] ? 'DIALOG' : 'LOADER'),
     loadingMessage: obj.labels['saving'],
     dialog: (obj.contents['dialog'] ? webim.dialogs.get() : null),
     onSuccess: function (){
      obj.setResult(this.xml, function(){
       if (obj.contents['listing']){
        obj.list();
        obj.onAfterSave();
        if (obj.contents['dialog']){
         webim.dialog({
          id: webim.dialogs.get(obj.targetDialog)
         }).hide();
        }
       }
      });
     }
    });
   }
  };
  
  this.del = function (id){
   if (obj.contents['deleting']){
    if (obj.onBeforeDelete()){
     webim.message({
      type:'confirm',
      text: (LANGUAGE['confirmDelete'] || 'Silmek istediğinize emin misiniz?'),
      onConfirm: function (m){
       m.hide();
       webim.ajax({
        id: obj.targetDialog,
        url: obj.url +'&act='+ obj.actions['delete'],
        params: 'id='+ (typeof(id) !== 'undefined' ? id : 0),
        type: (obj.contents['dialog'] ? 'DIALOG' : 'LOADER'),
        loadingMessage: obj.labels['deleting'],
        dialog: (obj.contents['dialog'] ? webim.dialogs.get() : null),
        onSuccess: function (){
         obj.setResult(this.xml, function(){
          if (obj.contents['listing']){
           obj.list({
            x: (obj.params.x ? obj.params.x : 0),
            y: (obj.params.y ? obj.params.y : 20)
           });
           obj.onAfterDelete();
           if (obj.contents['dialog']){
            webim.dialog({
             id: webim.dialogs.get(obj.targetDialog)
            }).hide();
           }
          }
         });
        }
       });
      }
     });
    }
   }
  };
  
  this.values = function (id){
   if (obj.onBeforeValues()){
    webim.ajax({
     id: obj.targetDialog,
     url: obj.url +'&act='+ obj.actions['values'],
     params: 'id='+ (typeof(id) !== 'undefined' ? id : 0),
     type: (obj.contents['dialog'] ? 'DIALOG' : 'LOADER'),
     loadingMessage: obj.labels['loading'],
     dialog: (obj.contents['dialog'] ? webim.dialogs.get() : null),
     onSuccess: function (){
      var err = this.xml.getElementsByTagName('error');
      var xml = this.xml.getElementsByTagName('value');
      
      if (err.length > 0){
       webim.message({
        type:'error',
        text:err.item(0).firstChild.data
       });
      }else{
       for (var i=0; i < xml.length; i++){
        if (xml.item(i).getAttribute('type')){
         if (xml.item(i).getAttribute('type') == 'eval'){
          eval(xml.item(i).firstChild.data);
         }
        }else if (xml.item(i).getAttribute('id') && webim('#'+ xml.item(i).getAttribute('id')).getEl()){
         if (webim.inArray(webim('#'+ xml.item(i).getAttribute('id')).getType(),['div','span','p','td'])){
          webim('#'+ xml.item(i).getAttribute('id')).setHTML(xml.item(i).firstChild.data);
         }else{
          webim('#'+ xml.item(i).getAttribute('id')).setValue(xml.item(i).firstChild.data);
         }
        }
       }
       obj.onAfterValues();
       obj.onAfterLoad();
      }
     }
    });
   }
  };
  
  this.setResult = function (responseXML, afterFunc){
   var xml = responseXML.getElementsByTagName('result');
   
   if (xml.length > 0){
    if (xml.item(0).getAttribute('status') == 'OK'){
     webim.message({
      type: 'info',
      text: xml.item(0).firstChild.data,
      onAfterHide: afterFunc || function(){}
     });
    }else{
     webim.message({
      type: 'warning',
      text: xml.item(0).firstChild.data
     });
    }
   }else{
    webim.message({
     type: 'error',
     text: (LANGUAGE['noReturn'] || 'Herhangi bir sonuç dönmedi!')
    });
   }
  };
  
  this.parseXML = function (xml){
   var parseCSS = function (txt){
    var css = {}, k, raw = txt.split(';'), raw2;
    
    for (k in raw){
     raw2 = raw[k].split(':');
     if (raw2.length == 2){
      css[webim.trim(raw2[0])] = webim.trim(raw2[1]);
     }
    }
    
    return css;
   };
   
   var head = xml.getElementsByTagName('head'),
   body = xml.getElementsByTagName('body'),
   titles = [], i = 0, y = 0, column;
  
   if (head.length > 0){
    titles = head.item(0).getElementsByTagName('title');
   }
   
   if (body.length > 0){
    var rows = body.item(0).getElementsByTagName('row');
    
    if (rows.length > 0){
     var table = webim('$table')
                .setAttr({
                 'width':'100%',
                 'border':0,
                 'cellPadding':5,
                 'cellSpacing':0
                })
                .addClass(CLASSES['gridTable'] || 'gridTable')
                .getEl();
     
     var node, tr, th, td, css, img;
     
     if (titles.length > 0){
      var thead = webim('$thead').append(table).getEl();
      
      tr = webim('$tr').append(thead).getEl();
      
      for (i=0; i < titles.length; i++){
       th = webim('$th').addClass(CLASSES['gridTitle'] || 'gridTitle');
       
       if (titles.item(i).getAttribute('style')){
        css = parseCSS(titles.item(i).getAttribute('style'));
        
        if (webim.getLength(css) > 0){
         th.setCSS(css);
        }
       }
       
       th.appendIn(webim('$span').setHTML(titles.item(i).firstChild.data).getEl());
       
       if (titles.item(i).getAttribute('order')){
        img = new Image(16,16);
        img.alt = '';
        img.src = webim.dialogSettings().path + titles.item(i).getAttribute('order').toLowerCase() +'.png';
        
        th.appendIn(img);
        th.setAttr({'order': titles.item(i).getAttribute('order')});
       }
       
       if (titles.item(i).getAttribute('orderby')){
        th.setAttr({'orderby': titles.item(i).getAttribute('orderby')});
        th.addEvent('mouseover', function(e){
         e = e || window.event;
         node = e.target ? e.target : e.srcElement;
         
         while (node != null){
          if (node.tagName && node.tagName.toLowerCase() == 'th'){
           break;
          }
          node = node.parentNode;
         }
        
         webim(node).setCSS({
          cursor:'pointer'
         })
         .addClass(CLASSES['gridTitleOrdering'] || 'gridTitleOrdering');
        });
        
        th.addEvent('mouseout', function(e){
         e = e || window.event;
         node = e.target ? e.target : e.srcElement;
         
         while (node != null){
          if (node.tagName && node.tagName.toLowerCase() == 'th'){
           break;
          }
          node = node.parentNode;
         }
         
         webim(node).setCSS({
          cursor:'default'
         })
         .removeClass(CLASSES['gridTitleOrdering'] || 'gridTitleOrdering');
        });
        
        th.addEvent('click', function(e){
         obj.params['orderby'] = webim(node).getAttr('orderby');
         obj.params['order'] = ((webim(node).getAttr('order') && (webim(node).getAttr('order') == 'ASC')) ? 'DESC' : 'ASC');
         obj.list();
        });
       }
       
       th.append(tr);
      }
     }
 
     var tbody = webim('$tbody').append(table).getEl();
     
     if (body.item(0).getAttribute('style')){
      css = parseCSS(body.item(0).getAttribute('style'));
      
      if (webim.getLength(css) > 0){
       webim(tbody).setCSS(css);
      }
     }
     
     for (y=0; y < rows.length; y++){
      tr = webim('$tr').append(tbody).getEl();
      column = rows[y].childNodes;
      
      for (i=0; i < column.length; i++){
       td = webim('$td').append(tr).setAttr({
        'rowid': (rows[y].getAttribute('id') ? rows[y].getAttribute('id') : y),
        'rownum': y
       });
       
       css = {};
       
       if ((titles.length > 0) && titles.item(i) && titles.item(i).getAttribute('style')){
        css = parseCSS(titles.item(i).getAttribute('style'));
       }
       
       if (rows[y].getAttribute('style')){
        css = parseCSS(rows[y].getAttribute('style'));
       }
       
       if (column[i].getAttribute('style')){
        css = parseCSS(column[i].getAttribute('style'));
       }
       
       if (webim.getLength(css) > 0){
        td.setCSS(css);
       }
       
       if (rows[y].getAttribute('onmouseover')){
        td.setAttr({
         'onmouseover': 'new Function('+ rows[y].getAttribute('onmouseover') +')'
        });
       }
       
       if (rows[y].getAttribute('onmouseout')){
        td.setAttr({
         'onmouseout': 'new Function('+ rows[y].getAttribute('onmouseout') +')'
        });
       }

       if (!column[i].getAttribute('noclick')){
        if (obj.contents['editing'] && rows[y].getAttribute('id')){
         td.addEvent('click',function(e){
          e = e || window.event;
          node = e.target ? e.target : e.srcElement;      
          
          while (node != null){
           if (node.tagName && (node.tagName.toLowerCase() == 'td')){
            break;
           }
           node = node.parentNode;
          }
          
          obj.show(webim(node).getAttr('rowid'));
         });
        }else if (rows[y].getAttribute('onclick')){
         td.addEvent('click',function(e){
          e = e || window.event;
          node = e.target ? e.target : e.srcElement;
          
          while (node != null){
           if (node.tagName && (node.tagName.toLowerCase() == 'td')){
            break;
           }
           node = node.parentNode;
          }
          
          eval(rows[webim(node).getAttr('rownum')].getAttribute('onclick'));
         });
        }
       }
 
       if (column[i].getAttribute('colspan')){
        td.addAttr({'colSpan':column[i].getAttribute('colspan')});
       }
       
       if (column[i].getAttribute('rowspan')){
        td.addAttr({'rowSpan':column[i].getAttribute('rowspan')});
       }
       
       if (column[i].getAttribute('class')){
        td.addClass(column[i].getAttribute('class'));
       }else{
        td.addClass(CLASSES['gridRow'] || 'gridRow');
       }
       
       td.setHTML(column[i] ? column[i].firstChild.data : '&nbsp;');
      }
     }
    }
    return table;
   }
  };
  
  return this;
 };
  
 webim.contextMenu = function (){
	 var config = arguments[0] || {};
	 var obj = this;
	 
	 this.ids = {};
	 
	 webim.each(config, function (n, v){
	  if (webim('#'+ n).getEl()){
	   obj.ids[n] = {
	    ids: ((typeof(v.ids) !== 'undefined') ? (typeof(v.ids) === 'object' ? v.ids : [v.ids]) : []),
	    classes: ((typeof(v.classes) !== 'undefined') ? (typeof(v.classes) === 'object' ? v.classes : [v.classes]) : []),
	    onBeforeShow: v.onBeforeShow || function (){ return true },
	    onAfterShow: v.onAfterShow || function (){},
	    preventForms: ((typeof(v.preventForms) !== 'undefined') ? v.preventForms : false),
	    preventDefault: ((typeof(v.preventDefault) !== 'undefined') ? v.preventDefault : false)
	   }
	  }
	 });
	 
	 this._init = function (){
 		if ((webim.getLength(obj.ids) > 0) && (webim.browser.msie || webim.browser.mozilla || webim.browser.safari)) {
 			document.oncontextmenu = obj._show;
 			document.onclick = obj._hide;
 		}
	 };
	 
	 this._show = function (e){
 	 e = e || window.event;
 		obj._hide();
 		
 		var id = obj._getID(e);
  
 		if (id) {
 			var m = webim.getMousePosition(e);
 			var s = {
 			 x: webim.getScrollLeft(),
 			 y: webim.getScrollTop()
 			};

 			if (obj.ids[id].onBeforeShow()){
  			webim('#'+ id).setCSS({
  			 display: 'block',
  			 left: (m.x + s.x) + 'px',
  			 top: (m.y + s.y) + 'px',
  			 zIndex: 1000000
  			});
  			
  			obj.ids[id].onAfterShow();
 			}
 			
 			return false;
 		}
  
 		return obj._getReturn(e, id);
	 };
	 
	 this._hide = function (){
	  for (var id in obj.ids){
	   webim('#'+ id).setCSS({display:'none'});
	  }
	 };
	 
	 this._getID = function (e){
 	 e = e || window.event;
 	 var t = e.target ? e.target : e.srcElement;
 	 var i = 0, id, oid, className, node = t;
  
 		while (node !== null) {
 			oid = node.id;
 			classNames = node.className;
 			  
 			if (typeof(oid) !== 'undefined'){
 			 for (id in obj.ids){
 			  if (webim.inArray(oid, obj.ids[id].ids)){
 			   return id;
 			  }
 			 }
 			}
 			
 			if (typeof(classNames) !== 'undefined') {
 				classNames = webim.trim(classNames);
 				var classArray = classNames.split(/[ ]+/g);
 				
 				for (id in obj.ids){
  				for (i = 0; i < classArray.length; i++) {
  					if (webim.inArray(classArray[i], obj.ids[id].classes)) {
  						return id;
  					}
  				}
 				}
 			}
  
 			node = (webim.browser.msie ? node.parentElement : node.parentNode);
 		}
  
 		return null;
  };
  
  this._getReturn = function (e, id) {
 	 e = e || window.event;
 	 
 		var retVal = true;
 		var prForms = obj.ids[id] ? obj.ids[id].preventForms : false;
 		var prDefault = obj.ids[id] ? obj.ids[id].preventDefault : false;
  
 		if (e.button != 1) {
 			var t = e.target ? e.target : e.srcElement;
 			var tname = t.tagName ? t.tagName.toLowerCase() : '';
  
 			if (webim.inArray(tname, ('input textarea select').split(' '))) {
 				if (!prForms) {
 					retVal = true;
 				}else{
 					retVal = false;
 				}
 			}else{
 				if (!prDefault) {
 					retVal = true;
 				} else {
 					retVal = false;
 				}
 			}
 		}
  
 		return retVal;
 	};
  
  return this._init();
 };
 
 webim.getDate = function (withTime){
  var dt = new Date();
  
  var day = dt.getDate().toString();
  var month = (dt.getMonth() + 1).toString();
  var year = dt.getFullYear().toString();
  
  day = ((day.length == 1) ? '0'+ day : day);
  month = ((month.length == 1) ? '0'+ month : month);
  
  var hour = dt.getHours().toString();
  var minute = dt.getMinutes().toString();
  var second = dt.getSeconds().toString();
  
  hour = ((hour.length == 1) ? '0'+ hour : hour);
  minute = ((minute.length == 1) ? '0'+ minute : minute);
  second = ((second.length == 1) ? '0'+ second : second);
  
  var datetime = day +'-'+ month +'-'+ year;
  
  if (withTime){
   datetime += ' '+ hour +':'+ minute +':'+ second;
  }
  
  return datetime;
 };
 
 webim.clearString = function (str){
  str = webim.trim(str);
  
  var chrs = ['ç','ğ','ı','ö','ş','ü','Ç','Ğ','İ','Ö','Ş','Ü',' '];
  var chns = ['c','g','i','o','s','u','C','G','I','O','S','U','-'];
  
  var i = y = 0, splitted;
  
  for (i=0; i < str.length; i++){
   for (y=0; y < chrs.length; y++){
    if (str[i] == chrs[y]){
     splitted = str.split(chrs[y]);
     str = splitted.join(chns[y]);
    }
   }
  }
  
  return str.toLowerCase().replace(/[^a-zA-Z0-9_-]/g, '');
 }
})();

//Classlar
if (!CLASSES || !CLASSES['']){
 var CLASSES = CLASSES || {};
 CLASSES['loadingMessage'] = 'loading-message';
 CLASSES['loadingPoint'] = 'loading-point';
 CLASSES['dialogVeil'] = 'dialog-veil';
 CLASSES['dialogBox'] = 'dialog-box';
 CLASSES['dialogHead'] = 'dialog-head';
 CLASSES['dialogBody'] = 'dialog-body';
 CLASSES['dialogFoot'] = 'dialog-foot';
 CLASSES['dialogTitle'] = 'dialog-title';
 CLASSES['dialogButtons'] = 'dialog-buttons';
 CLASSES['warning'] = 'warning';
 CLASSES['tab'] = 'tab';
 CLASSES['here'] = 'here';
 CLASSES['gridTable'] = 'grid-table';
 CLASSES['gridTitle'] = 'grid-title';
 CLASSES['gridTitleOrdering'] = 'grid-title-ordering';
 CLASSES['gridRow'] = 'grid-row';
}

//Dil Dosyası Gelmezse Default Değerler
if (!LANGUAGE || !LANGUAGE['support']){
 var LANGUAGE = LANGUAGE || {};
 LANGUAGE['support'] = 'Tarayıcınız AJAX desteklemiyor!';
 LANGUAGE['fatal'] = 'AJAX isteği reddedildi!';
 LANGUAGE['status'] = 'Sunucu isteğe cevap vermiyor!';
 LANGUAGE['timeout'] = 'İstek zamanaşımına uğradı, tekrar deneyin!';
 LANGUAGE['loading'] = 'Yükleniyor...';
 LANGUAGE['loadingMessage'] = 'Yükleniyor, lütfen bekleyin...';
 LANGUAGE['processing'] = 'İşleniyor...';
 LANGUAGE['saving'] = 'Kaydediliyor...';
 LANGUAGE['deleting'] = 'Siliniyor...';
 LANGUAGE['noResult'] = 'Herhangi bir sonuç bulunamadı!';
 LANGUAGE['confirmDelete'] = 'Silmek istediğinize emin misiniz?';
 LANGUAGE['noReturn'] = 'Herhangi bir sonuç dönmedi!';
 LANGUAGE['noResponse'] = 'Geçerli bir sonuç dönmedi!';
 LANGUAGE['unknownError'] = 'Bir hata oluştu!';
 LANGUAGE['add'] = 'Ekle';
 LANGUAGE['ok'] = 'Tamam';
 LANGUAGE['yes'] = 'Evet';
 LANGUAGE['no'] = 'Hayır';
 LANGUAGE['save'] = 'Kaydet';
 LANGUAGE['del'] = 'Sil';
 LANGUAGE['cancel'] = 'İptal';
 LANGUAGE['upload'] = 'Yükle';
 LANGUAGE['first'] = 'İlk';
 LANGUAGE['previous'] = 'Önceki';
 LANGUAGE['next'] = 'Sonraki';
 LANGUAGE['last'] = 'Son';
 LANGUAGE['total'] = 'Toplam';
 LANGUAGE['close'] = 'Kapat';
 LANGUAGE['noTarget'] = 'İçerik bulunamadı!';
 LANGUAGE['noDialog'] = 'Hedef dialog bulunamadı!';
 LANGUAGE['messageTitle'] = 'Mesaj';
 LANGUAGE['cancelRequest'] = 'İptal etmek istediğinize emin misiniz?';
};

