	
	/* 

			azer koculu
			hello.azer@gmail.com
			http://azer.kodfabrik.com


			31.01.2007 02:04


			Bu ürün GPL lisansi ile korunmaktadir.
			Ayrintilar icin LICENCE.TXT ve LISANS.TXT dosyalarini okuyabilirsiniz.

	*/

	var dict = {
		events: {},
		element: {},
		timer: null,
		init: function()
		{
			with(dict)
			{
				if($n.msie)
				{
					$$style('#content { width:300px; margin:39px 0 0 -304px; }');
					$$style('#sound { margin:15px 0 0 -22px; }');
				}
				element.loading = new $element(null,$('header'),{ position:'absolute', display:'none', width:10, height:10, background:'url(images/loading.gif) no-repeat' });
				element.counter = new $element(null,$('header'),{ position:'absolute', display:'none', width:105, height:105, font:'50px Tahoma,Arial', weight:'bold', color:'#808080', padding:'12px 21px' });
				element.cancel  = new $element(null,$('header'),{ position:'absolute', display:'none', width:16, height:16, background:'url(images/arrow_down.gif) no-repeat', cursor:'pointer' },null,{ click:dict.close });
				element.title1  = new $element(null,$('header'),{ font:'10px Arial', align:'left', display:'none', color:'#aaa' },null,{},'Translate');
				
				/**/
				dict.element.loading.style.set({ margin:'30px 0px 0px 287px' }); 
				dict.element.counter.style.set({ margin:'-22px 0px 0px 287px' }); 
				dict.element.cancel.style.set({ margin:'16px 0px 0px 280px' }); 
				/**/
				
				events.inputkDown = new $event($('key'),'keydown',function()
				{
					try{ dict.timer.kill(); }catch (e){}; 
					dict.element.title1.style.set({ display:'block' }); 
					dict.element.loading.style.set({ margin:'30px 0px 0px 287px' }); 
					dict.element.counter.style.set({ margin:'-10px 0px 0px 287px' }); 
					dict.element.cancel.style.set({ margin:'29px 0px 0px 280px' }); 
					dict.setPositions();
				});
				events.inputkUp = new $event($('key'),'keyup',dict.counter);
				dict.setPositions();
				
				$('key').focus();
				$('wait').style.display='none';
			}
			$('container').style.left = ((document.body.offsetWidth/2)-($('container').offsetWidth/2))+'px';
		},
		setPositions: function()
		{
			//$('container').style.top = ((document.body.offsetHeight/2)-($('container').offsetHeight/2))+'px';
			//$('container').style.left = ((document.body.offsetWidth/2)-($('container').offsetWidth/2))+'px';
			$('container').style.top = '200px';
		},
		counter: function()
		{
			loops = 2;
			dict.element.loading.style.set({ display:'none' });
			dict.element.cancel.style.set({ display:'none' });
			$('sound').style.display='none';
			try{ dict.timer.kill(); }catch (e){};
			dict.timer = new $timer({ loop:loops, interval:1000, onComplete:dict.call },function(){ 
				dict.element.counter.element.innerHTML = loops-(dict.timer.counter+1);
			});
			dict.element.counter.style.set({ display:'block' });
		},
		call: function()
		{
			dict.element.counter.style.set({ display:'none' });
			dict.element.cancel.style.set({ display:'none' });
			dict.element.loading.style.set({ display:'block' });
			$('sound').style.display='none';
			$include('engine.php?key='+$('key').value);
		},
		put: function(data)
		{
			dict.element.loading.style.set({ display:'none' });
			dict.element.cancel.style.set({ display:'block' });
			$('sound').style.display='none';
			$('content').innerHTML = '';
			
			for(x in data)
				eval("dict.element.link"+x+" = new $element('a',$('content'),{ backgroundImage:'url("+data[x].flag+")' },{ href:'#' },{ click:data[x].onclick },data[x].word)");
			
			if(data.length==0) {
				var nll = new $element('a',$('content'),null,{ href:'#' },null,"No result. - Kayıt bulunamadı.");
				$('key').style.background='url(images/not_found.gif) no-repeat 3px center';
			} else {
				$('key').style.background='url(images/found.gif) no-repeat 3px center';
			}
			$('content').style.display = 'block';
			var fi = new $manipulation({ element:$('content'), opacity:[1,0.2], interval:30 });
		},
		src: function(word,lang)
		{
			dict.close();
			$('text').innerHTML = 'Please wait. - Lütfen bekleyin.';
			$('key').value = word;
			$include('text.php?key='+word+'&lang='+lang);
		},
		close: function()
		{
			var fo = new $manipulation({ element:$('content'), opacity:[0,0.2], interval:30, onComplete:function(){ 
				dict.element.cancel.element.style.display = 'none'; $('content').style.display = 'none'; 
				$('key').style.background='url(images/arrow_right.gif) no-repeat 3px center';
			}  });
		}
	}
	
	window.onload = dict.init;
	var data = null;