
Ext.form.Field.prototype.msgTarget = 'qtip';
Ext.BLANK_IMAGE_URL="resources/images/default/s.gif";
turuncu = function(){
	return {
		init:function(){
			Ext.QuickTips.init();
			this.langTool();
		},
		langTool: function(){
			var langtool=Ext.get("langtool");
			langtool.on('click',function(e){
				var xy = langtool.getXY();
				var divim = document.getElementById("lang");
				if (divim.style.display=='block'){
					divim.style.display ='none';
				}else{
					divim.style.left = xy[0]+5;
					divim.style.top = xy[1]+20;
					divim.style.display ='block';
				}
			});			
		},
		updater:function(url){
			var yer = Ext.DomHelper.append(document.body,{
				tag:'div',
				style:'display:none;',
				id:'temp_updater'
			});

			var yerim= Ext.get("temp_updater").getUpdater();
			yerim.update(url);
			yerim.on('update',function(k,l){
				son = Ext.decode(l.responseText);
				Ext.Msg.alert(son.baslik,son.sonuc);
				Ext.get("temp_updater").remove();
			});
		},
		newsGroup:function(noemailtitle,noemailmsg,islem){
			var email = Ext.get("email").getValue();
			if(email==""){
				Ext.Msg.alert(noemailtitle,noemailmsg);
			}else{
				this.updater('home/functions.asp?islem=addmaillist&i2='+islem+'&email='+email);
			}
			if(islem=="remove"){
				document.getElementById("email").value="";
			}
		},
		iletisimForm: function(){
			var myForm= new Ext.form.FormPanel({
				renderTo:'iletisimform',
				labelWidth: 130,
				monitorValid :true,
				style:{'padding':'10 10 10 10'},
				border:false,
				defaultType: 'textfield', 
				items: [
					{
						fieldLabel: strLang1,
						name: 'yazar',
						allowBlank:false,
						width:260,
						blankText :strLang2,
						id:'adi'
					},{
						fieldLabel:strLang3,
						name: 'email',
						width:260,
						allowBlank:false,
						blankText :strLang4,
						id:'sehir',
						vtype:'email'
					},{
						fieldLabel: strLang5,
						name: 'baslik',
						width:260,
						allowBlank:false,
						blankText :strLang6
					}, new Ext.form.TextArea({
						fieldLabel: strLang7,
						name: 'metin',
						height :50,
						width:260,
						allowBlank:false,
						blankText :strLang8
					})
				],
				buttons: [
				{
					disabled:true,
					id:'submitBtn',
					text: strLang9,
					handler:function(n) {
							myForm.form.submit({
								url:'home/iletisimgonder.asp',
								waitMsg:strLang10,
								waitTitle:strLang11,
								method:'POST'
							});
						}
				}]
			});
			myForm.on('clientvalidation',function(k,l){
				var btn = Ext.getCmp("submitBtn");
				if(l==true){
					btn.enable();
				}else{
					btn.disable();
				}

			},this);
			myForm.on('actioncomplete',function(k,l,m){
				var sonuc=Ext.decode(l.response.responseText);
				if(sonuc.hata==false){
				var el = Ext.get("iletisimform")
					el.first().remove();
					el.update('<center><img src="images/true.jpg" border="0"><br><br><span class="baslikgri">'+strLang12+'</span> <br><br> <span class="normalText">'+strLang13+'</span></center>');
				}else{
					Ext.Msg.alert('<center> <span class="normalText">'+sonuc.metin+'</span></center>');
					
				}
			});
		},	
		openresim:function(resm,el,baslik){
			var resim = new Image();
			resim.src=resm;
			rGen= resim.width+40;
			rYuk= resim.height+40;
			if (Ext.isIE==true)
			{
				Pyuk = document.body.clientHeight*1;
			}
			else
			{
				Pyuk = window.innerHeigth*1;
			}
			
			if (rYuk>Pyuk)
			{
				rYuk=Pyuk;
				
			}
			
			var win = Ext.getCmp("resimwin");
			if(!win){
				win = new Ext.Window({
					title:baslik,
					width:rGen,		
					height:rYuk+20,
					modal:true,
					id:'resimwin',
					html:'<img src=\''+resim.src+'\' id=\"yresim\">',
					bodyStyle:'padding:10px;text-align:center;',
					plain:true,
					frame:true,
					closeAction:'close'
				});
			}
			win.show(el);
			
		},
		openResim2:function(resm,el,baslik){
			
			rGen= el.width;
			rYuk= el.height;
			if (Ext.isIE==true)
			{
				Pyuk = document.body.clientHeight*1;
			}
			else
			{
				Pyuk = window.innerHeigth*1;
			}
			
			if (rYuk>Pyuk)
			{
				rYuk=Pyuk;
				
			}
			
			var win = Ext.getCmp("resimwin");
			if(!win){
				win = new Ext.Window({
					title:baslik,
					width:rGen,					
					autoScroll:true,
					height:rYuk,
					id:'resimwin',
					html:'<img src=\''+el.src+'\' id=\"yresim\" height='+(Pyuk-75)+'>',
					bodyStyle:'padding:10px;text-align:center;',
					plain:true,
					frame:true,
					closeAction:'close'
				});
			}
			win.show(el);
			
		}
	}
}();
Ext.onReady(turuncu.init,turuncu,this);
