
Ext.form.Field.prototype.msgTarget = 'qtip';
Ext.BLANK_IMAGE_URL="../resources/images/default/s.gif";
turuncu = function(){
	return {
		init:function(){
			Ext.QuickTips.init();
		},
		newsGroup:function(noemailtitle,noemailmsg,islem){
			var email = Ext.get("email").getValue();
			if(email=="" || email=="E-posta Adresiniz"){
				Ext.Msg.alert(noemailtitle,noemailmsg);
			}else{
				this.updater('../main/functions.asp?islem=addmaillist&i2='+islem+'&email='+email);
			}
			if(islem=="remove"){
				document.getElementById("email").value="E-posta Adresiniz";
			}
		},
		makeBtn:function(el,text,fn){
			var btn = new Ext.Button({
					renderTo:el,
					text:text,
					handler:function(){
						eval(fn);
					}
				})
		},
		openMap:function(title,el){
			var win= Ext.getCmp("map");
			if(!win){
				win = new Ext.Window({
					id:'map',
					autoScroll:false,
					width:820,
					height:640,
					title:title,
					bodyStyle:'text-align:center'
					
				});
			}
			win.show(el);
			win.on('show',function(){
				Ext.DomHelper.append(Ext.get(Ext.getCmp('map').body).id,{
					tag:'iframe',
					src:'../modules/kroki.html',
					style:'width:808px;height:605px;',
					border:0,
					frameborder:0
				})
			});
			
		},
		openWin:function(title,el,url){
			var win= Ext.getCmp("wind");
			if(!win){
				win = new Ext.Window({
					id:'wind',
					autoScroll:false,
					width:450,
					height:500,
					title:title,
					bodyStyle:'padding:5px;background:white;text-align:center;',
					autoScroll:true,
					autoLoad:url,
					shadow:false,
					modal:true
					
				});
			}else{
				win.setTitle(title);
				win.load({url:url,text:'Yükleniyor..'});
			}
			win.show(el);
			win.on("show",function(){
				win.center();
			})
		},
		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();
			});
		},
		goTo:function(url){
			if(Ext.isIE){
				window.location.href=url;
			}else{
				window.location.href(url);
			}
		},
		iletisimForm: function(){
			var myForm= new Ext.form.FormPanel({
				renderTo:'iletisimform',
				labelWidth: 80,
				monitorValid :true,
				style:{'padding':'10 10 10 10'},
				border:false,
				defaultType: 'textfield', 
				items: [
					{
						fieldLabel: strLang1,
						name: 'yazar',
						allowBlank:false,
						width:200,
						blankText :strLang2,
						id:'adi'
					},{
						fieldLabel:strLang3,
						name: 'email',
						width:200,
						allowBlank:false,
						blankText :strLang4,
						id:'sehir',
						vtype:'email'
					},{
						fieldLabel: strLang5,
						name: 'baslik',
						width:200,
						allowBlank:false,
						blankText :strLang6
					}, new Ext.form.TextArea({
						fieldLabel: strLang7,
						name: 'metin',
						height :50,
						width:200,
						allowBlank:false,
						blankText :strLang8
					})
				],
				buttons: [
				{
					disabled:true,
					id:'submitBtn',
					text: strLang9,
					handler:function(n) {
							myForm.form.submit({
								url:'../main/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="../resources/images/main/tamam.gif" 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>');
					
				}
			});
		},
		uyar:function(baslik,msg){
			Ext.Msg.alert(baslik,msg);
		},
		openResim:function(resm,el){
			var resim= new Image();
			resim.src=resm;
			rGen= resim.width;
			rYuk= resim.height;
			if (Ext.isIE==true)
			{
				Pyuk = document.body.clientHeight*1;
			}
			else
			{
				Pyuk = window.innerHeigth*1;
			}
			
			if (rYuk>Pyuk)
			{
				rYuk=Pyuk-40;
				
			}
			
			var win = Ext.getCmp("resimwin");
			if(!win){
				win = new Ext.Window({
					width:rGen,
					height:rYuk,
					id:'resimwin',
					html:'<img src=\''+resim.src+'\' id=\"yresim\" height='+(Pyuk-75)+'>',
					bodyStyle:'padding:10px;text-align:center;',
					plain:true,
					frame:true,
					closeAction:'close'
				});
			}
			win.show(el);
			win.on('show',function(){
				var gen= Ext.get('yresim').getWidth()
				win.setWidth((gen*1)+36);
			});
		}
	}
}();
Ext.onReady(turuncu.init,turuncu,this);
