﻿/*
	 *
	 *      Copyright 2007 Azer Koçulu <http://azer.kodfabrik.com>
	 *		16.09.2007 10:53:55
	 * 
*/
var data = [];
var date = new Date().get();
var garaj = {
	a: { module:0, lang:"tr", target:null, groups:{} },
	lang: { "tr":{ weekDay:["Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"] } },
	init: function()
	{
		with(garaj)
		{
			document.on("mousemove",doo.listen);
			
			lib.e("id","header_content").style.display = "block";
			
			for(x in data)
			{
				var key0 = data[x].date[2];
				var key1 = data[x].date[3];
				var key2 = data[x].key;
				if(typeof a.groups[key0]=="undefined")a.groups[key0] = {};
				if(typeof a.groups[key0][key1]=="undefined")a.groups[key0][key1] = {};
				if(typeof a.groups[key0][key1][key2]=="undefined")a.groups[key0][key1][key2] = [];
				a.groups[key0][key1][key2].push(data[x]);
			}
				
			part.init();
			
		}
	},
	part: {
		init: function()
		{
			if(garaj.a.module==0)
				with(garaj.part)
				{
					nav.init(lib.e("id","subnav_0"),lib.e("id","subnav_0_link"),lib.e("id","subnav_detailer"));
					nav_destekciler.init(lib.e("id","subnav_1"),lib.e("id","subnav_1_link"));
					nav_garaj.init(lib.e("id","subnav_2"),lib.e("id","subnav_2_link"));
					nav_basin.init(lib.e("id","subnav_3"),lib.e("id","subnav_3_link"));
					//thisWeek.init(lib.e("id","thisWeek_container"),lib.e("id","thisWeek_date"));
					if(prtm){
						thisMonth.init(lib.e("id","thisMonth_calendar"),lib.e("id","thisMonth_title"),lib.e("id","thisMonth_subTitle"),lib.e("id","thisMonth_bg"),lib.e("id","thisMonth_container"));
					}
					//soon.init(lib.e("id","soon"));
				}
			else
				with(garaj.part)
				{
					nav.init(lib.e("id","subnav_0"),lib.e("id","subnav_0_link"),lib.e("id","subnav_detailer"));
					nav_destekciler.init(lib.e("id","subnav_1"),lib.e("id","subnav_1_link"));
					nav_garaj.init(lib.e("id","subnav_2"),lib.e("id","subnav_2_link"));
					nav_basin.init(lib.e("id","subnav_3"),lib.e("id","subnav_3_link"));
				}
		},
		static :{
			destekciler: {
				elm: {},
				init: function()
				{
					with(garaj.part.static.destekciler)
					{
						elm.a = lib.e("id","popup");
					}
				},
				doo: {
					
					openPopup: function(node,img)
					{
						with(garaj.part.static.destekciler)
						{
							
							elm.a.style.left = lib.i(node).x-(Math.round(elm.a.offsetWidth/2)-Math.round(node.offsetWidth/2))+"px";
							elm.a.style.top = lib.i(node).y-elm.a.offsetHeight+"px";
							elm.a.innerHTML="<img src='_img/destekciler/"+img+"' />";
						}
					},
					closePopup: function()
					{
						with(garaj.part.static.destekciler)
						elm.a.style.top = "-1200px"
					}	
				
				}
				
			},
			iletisim: {
				a: { effect:[], opened:[] },
				init:function()
				{
					
				},
				doo: {
					clear: function(elm)
					{
						if(typeof elm.sizer=="object")
							clearInterval(elm.sizer.a.animation.a.interval);
					},
					mouseover: function(elm,width,margin)
					{
						
						with(garaj.part.static.iletisim)
						{
							if(elm.getAttribute("sized")=="true")return 0;
							doo.clear(elm);
							width = typeof width=="undefined"?230:width+50;	
							if(elm.getAttribute("sized")=="true")return 0;					
							a.effect.push(new sizer(elm,{ "width":width, "margin":{ "width":0, "height":0 } },8,null,function(){
								elm.setAttribute("sized","true");
								a.opened.push([elm,margin]);
								a.effect.push(new sizer(elm,{ "width":width-50, "margin":{ "width":margin, "height":0 }  }, 3,10,function(){
									
									if(garaj.a.module==5)
									{
										if(elm==lib.e("id","garajistanbul_0") || elm==lib.e("id","garajistanbul_1"))
											a.effect.push(new sizer(elm,{ height:elm==lib.e("id","garajistanbul_1")?500:465 }));
									}
										
									if(elm==lib.e("id","iletisim_4"))
										a.effect.push(new sizer(elm,{ height:425 }));
									
									
									
								}));
								
							}));
							
						}	
					},
					mouseout: function(elm,margin)
					{
						
						with(garaj.part.static.iletisim)
						{
							
							setTimeout(function(){
								doo.close(elm,margin)
							},100);
							
						}
					},
					close: function(elm,margin)
					{
						
						with(garaj.part.static.iletisim)
						{
							
							if( garaj.a.target.parentNode==elm || garaj.a.target.parentNode.parentNode==elm  || garaj.a.target==elm)return 0;	
							doo.clear(elm);
							
							a.effect.push(new sizer(elm,{ width:0, "margin":{ "width":margin, "height":0 } },25,null,function(){
								elm.setAttribute("sized","false");
								if(garaj.a.module==5)
								{
									if(elm==lib.e("id","garajistanbul_0") || elm==lib.e("id","garajistanbul_1"))
										a.effect.push(new sizer(elm,{ height:23 }));
								}
								if(elm==lib.e("id","iletisim_4"))
								{
									a.effect.push(new sizer(elm,{ height:23 }));
									
								}
								
							}));
							
						}
					}
				}
			}
		},
		typePage: {
			a: { title:["müzik","tiyatro","dans","edebiyat","festival","sergi"], type:0, openedDate:-1 },
			elm: {  },
			init: function(layer)
			{
				with(garaj.part.typePage)
				{
					elm.a = layer;
					elm.a.make("h1::"+a.title[a.type]);
					
					var x = 0;
					var s2008 = 0;
					for(var i=0; i<data.length; i++)
					{

						if(data[i].type!=a.type || typeof data[i]["photo"]["ofTypePage"]=="undefined" || ((data[i].date[4]<=date.year && data[i].date[2]<(date.month.ofYear+1)) || ((data[i].date[4]==date.year && data[i].date[2]==(date.month.ofYear+1)) && data[i].date[3]<(date.day.ofMonth)) ))continue;
						if(data[i].date[4]==2008 && s2008==0)
						{
							elm.a.make("h2::2008");
							s2008=1;
						}
						var y = "link_"+i;
						elm[y] = elm.a.make("a",{ att: { "class":"link", "typePage_key":i, href:"etkinlik.php?id="+data[i].id }  });
						elm[y+"_a"] = elm[y].make("div",{ att:{ "class":"left" }, css:{ "height":(lib.n.ff?66:70)+"px", backgroundImage:"url(_img/"+data[i].photo.ofTypePage+")" } });
						elm[y+"_b"] = elm[y].make("i::"+data[i].title, { att:{ "typePage_key":i } });
						elm[y].make("br");
						elm[y+"_c"] = elm[y].make("span::"+data[i].subTitle, { att:{ "typePage_key":i } });
						
						elm[y+"_d"] = elm[y+"_a"].make("div", { att:{ "class":"date", "typePage_key":i } });
						elm[y+"_d"].make("div",{ css:{ height:lib.n.ie?"30px":"24px", "background":"url(_img/numbers_"+garaj.doo.fixZero(data[i].date[3]).substring(0,1)+".gif) no-repeat" } });
						elm[y+"_d"].make("div",{ css:{ height:lib.n.ie?"30px":"24px", "background":"url(_img/numbers_"+garaj.doo.fixZero(data[i].date[3]).substring(1,2)+".gif) no-repeat" } });
						
						elm[y+"_d"].make("span",{ css:{ display:"block", "clear":"both" } });
						elm[y+"_d"].make("div",{ css:{ marginTop:(lib.n.ie?-20:0)+"px", "background":"url(_img/numbers_"+garaj.doo.fixZero(data[i].date[2]).substring(0,1)+".gif) no-repeat" } });
						elm[y+"_d"].make("div",{ css:{ marginTop:(lib.n.ie?-20:0)+"px", "background":"url(_img/numbers_"+garaj.doo.fixZero(data[i].date[2]).substring(1,2)+".gif) no-repeat" } });
						elm[y+"_d"].make("span",{ css:{ display:"block", "clear":"both" } });
						
						elm[y].style.width = 100+(elm[y+"_b"].offsetWidth>elm[y+"_c"].offsetWidth?elm[y+"_b"].offsetWidth:elm[y+"_c"].offsetWidth)+"px";
						if(lib.n.ff)elm[y].style.paddingBottom = "8px";
						
						x++;
					}
				}
			},
			doo:{
				displayDate: function(key)
				{
					with(garaj.part.typePage)
					{
						if(a.openedDate>-1)
							doo.hideDate();
						elm["link_"+key+"_d"].style.visibility = "visible";
						a.openedDate = key;
					}
				},
				hideDate: function(key)
				{
					with(garaj.part.typePage)
					{
						elm["link_"+a.openedDate+"_d"].style.visibility = "hidden";
						a.openedDate = -1;
					}
				}
			}
		},
		thisWeek: {
			a: { data:[], t:["muzik","tiyatro","dans","edebiyat","festival","sergi"] },
			elm:{ },
			init: function(container,dt)
			{
				with(garaj.part.thisWeek)
				{
					elm.a = container;
					elm.b = dt;
					
					var xy = 0;
					for(x in data)
					{
						if(typeof data[x]["photo"]["ofWeek"]=="undefined" || data[x].date[2]!=date.month.ofYear || (data[x].date[3] < date.week.firstDay || data[x].date[3] > date.week.lastDay) || data[x].date[4]!=date.year || xy>5)continue;
						if(x==0)doo.viewDate(garaj.doo.fixZero(data[x].date[2]+1)+"."+garaj.doo.fixZero(data[x].date[3])+"."+garaj.doo.fixZero(data[x].date[4]));
						var intDate = new Date();
						intDate.setFullYear(data[x].date[4],data[x].date[2],data[x].date[3]);
						
						elm.a.innerHTML += "<a style='"+(xy==0?"margin-top:0;":"")+" background:#A8A6A7; overflow:hidden' href='etkinlik.php?id="+data[x].id+"' onmouseout='this.style.backgroundColor = \"#A8A6A7\"; /*this.childNodes["+(lib.n.ie?1:0)+"].style.marginTop = \"-1300px\";*/' onmouseover='/*this.childNodes["+(lib.n.ie?1:0)+"].style.marginTop = \"-13px\";*/ this.style.backgroundColor = \"#F90735\"; garaj.part.thisWeek.doo.viewDate(\""+garaj.doo.fixZero(data[x].date[2]+1)+"."+garaj.doo.fixZero(data[x].date[3])+"."+data[x].date[4]+", "+garaj.lang[garaj.a.lang]["weekDay"][intDate.getDay()]+", "+data[x].date[0]+":"+data[x].date[1]+"\")'><div class='"+a.t[data[x].type]+"'></div><img align='left' style='margin-right:5px' src='_img/"+data[x]["photo"]["ofWeek"]+"' /><i style='margin-top:12px'>"+data[x].title+"</i>"+data[x].subTitle+"</a>"
						xy++;
					}
				}
			},
			doo: {
				viewDate: function(value)
				{
					with(garaj.part.thisWeek)
					{
						
						elm.b.innerHTML = value;
					}
				}
			}
		},
		thisMonth: {
			
			a:{ cursor:-1, data:[], effect:[] },
			elm:{},
			init: function(content,title,subTitle,bg,container)
			{
				with(garaj.part.thisMonth)
				{
					elm.a = container;
					elm.b = content;
					elm.c = title;
					elm.d = subTitle;
					elm.e = bg;
					
					var weekDays = {};
					for(var i=date.week.firstDay; i<date.week.lastDay; i++)
						weekDays[i]=i;
					
					elm.link = {};
					
					for(i in garaj.a.groups[date.month.ofYear])
					{
						for(k in garaj.a.groups[date.month.ofYear][i])
						{
							var node = garaj.a.groups[date.month.ofYear][i][k];
							for(p in node)
							{
								if(typeof node[p]["photo"]["ofMonth"]!="undefined")
									elm.link[node[p].date[3]] = node[p];
							}
						}
					}
					
					for(var i=0; i<date.month.length; i++)
					{
						elm["day_"+i] = elm.b.make((typeof elm.link[i+1]=="undefined"?"span":"a")+"::"+garaj.doo.fixZero(i+1)+" ",{ att:(typeof elm.link[i+1]=="undefined"?{}:{ link:"etkinlik.php?id="+elm.link[i+1].id, key:elm.link[i+1].date[3] }), on:(typeof elm.link[i+1]=="undefined"?{}:{ click:doo.select, dblclick:doo.go }) });
						if(typeof weekDays[i]!="undefined")
							elm["day_"+i].att("class","weekDay");
					}
					a.effect.push(new sizer(elm.e, { height:elm.b.offsetHeight },1,10,function(){
						with(garaj.part.thisMonth)
						{
							a.effect.push(new fader(elm.b));
						}
					}));
					var randomKey = -1;
					while(typeof elm.link[randomKey]=="undefined")
						randomKey = Math.round(Math.random()*(date.month.length-1));
					doo.select(randomKey);
				}
			},
			doo: {
				select: function(fact)
				{
					with(garaj.part.thisMonth)
					{
						
						if(a.cursor>-1)
							elm["day_"+(elm.link[a.cursor].date[3]-1)].att("class","selected",1);
						
						try { 
							a.cursor = parseInt(fact.srcElement.getAttribute("key"));
						
						} catch(e){
							if(typeof fact=="number")
								a.cursor = fact;
						};
						
						var node = elm.link[a.cursor];
						elm["day_"+(node.date[3]-1)].att("class","selected");
						elm.a.style.backgroundImage = "url(_img/"+node["photo"]["ofMonth"]+")";
						
						lib.e("id","thisMonth_link").setAttribute("href","etkinlik.php?id="+node.id); 
						
						elm.c.innerHTML = node.title;
						elm.d.innerHTML = node.subTitle;
						
						return 0;
					}
				},
				go: function(fact)
				{
					with(garaj.part.thisMonth)
					{
						if(typeof fact=="object" &&  fact.srcElement &&  fact.srcElement.getAttribute && fact.srcElement.getAttribute("key"))
							a.cursor = fact.srcElement.getAttribute("key");
						else if(typeof fact=="number")
							a.cursor = fact;
						
						var node = data[a.cursor];
						node = elm["day_"+(node.date[3]-1)];
						
						document.location.href = node.att("link");
					}
				}
			}
		},
		soon: {
			
			a: { data:[], titles:{}, cursor:[-1,0] },
			elm: {},
			init: function(container)
			{
				with(garaj.part.soon)
				{
					elm.a = container;
					var i = -1;
					for(var x=0; x<data.length; x++)
					{
						if(typeof a.titles[data[x].title]!="undefined" || typeof data[x]["photo"]["ofSoon"]=="undefined" || (data[x].date[2]<(date.month.ofYear+1) && data[x].date[4]<=(date.year)))continue;
						i++;
						
						a.titles[data[x].title]=0;
						
						elm["item"+x] = elm.a.make("div::<i>"+data[x].title+"</i><u>"+data[x].subTitle+"</u>"+data[x].shortDescription,{ att:{ rel:"etkinlik.php?id="+data[x].id } });
						
						eval('elm["item"+x].on("mouseover",function(){ elm["item"+'+x+'].style.backgroundColor = "#F90735"; elm["item"+'+x+'].style.color = "#fff"; elm["item"+'+x+'].childNodes[0].style.color="#fff"; elm["item"+'+x+'].childNodes[1].style.color="#fff" }); elm["item"+x].on("mouseout",function(){ elm["item"+'+x+'].style.backgroundColor = "#A8A6A7"; elm["item"+'+x+'].style.color = "#000"; elm["item"+'+x+'].childNodes[0].style.color="#F70736"; elm["item"+'+x+'].childNodes[1].style.color="#444" }); elm["item"+x].onclick = function(){ document.location.href = elm["item"+'+x+'].getAttribute("rel") }');
						elm["item"+x].style.backgroundImage = "url(_img/"+data[x].photo.ofSoon+")";
						if(i>2)break;
					}
				}
			},
			doo: {
				update: function()
				{
					
				}
			}
		
		},

		nav_basin:{
			a: { keys:["bultenler","gorseller"], effect:[], status:0 },
			elm: {},
			init: function(container,link){
				with(garaj.part.nav_basin)
				{
					elm.a = container;
					elm.b = link;
					elm["lines"] = [lib.e("id","navLine3_0"),lib.e("id","navLine3_1")];
					
					
					
					for(var i=0; i<elm.lines.length; i++)
					{
						var txt='';
						txt+='elm.lines[i].on("mouseover",function(fact){ if(fact.srcElement!=garaj.part.nav_basin.elm.lines['+i+'] && fact.srcElement!=garaj.part.nav_basin.elm.lines['+i+'].link)return 0; garaj.part.nav_basin.elm.lines['+i+'].style.background = "#F90735 url(_img/'+a.keys[i]+'_1.jpg) no-repeat"; }); ';
						txt+='elm.lines[i].on("mouseout",function(fact){ garaj.part.nav_basin.elm.lines['+i+'].style.background = "#F90735 url(_img/'+a.keys[i]+'_0.jpg) no-repeat"; }); ';
						eval(txt);
						
						var node = elm.lines[i];
						node.link = node.make("a::&nbsp;",{ att:{ "class":"link", "href":"basin_"+a.keys[i]+".php" } });
						
					}
					elm.b.on("mouseover",doo.display);
				}
			},
			doo: {
				
				display: function()
				{
					with(garaj.part.nav_basin)
					{
						
						a.effect.push(new fader(lib.e('id','subnav_3')));
						a.effect.push(new sizer(lib.e('id','subnav_3'),{ height:100 }));
						elm.b.att("class","selected");
						a.status = 1;
					}
				},
				hide: function(fact)
				{
					with(garaj.part.nav_basin)
					{
						if(fact.srcElement == elm.a || fact.srcElement.parentNode == elm.a || fact.srcElement.parentNode.parentNode == elm.a || fact.srcElement.parentNode.parentNode.parentNode == elm.a || fact.srcElement == elm.b)return;
						a.status = 0;
						elm.b.att("class","selected",1);
						a.effect.push(new sizer(lib.e('id','subnav_3'),{ height:0 }));
						a.effect.push(new fader(lib.e('id','subnav_3'),-1));
					}
				}

			}
		},
		nav_garaj:{
			a: { keys:["manifesto","yeniye_birak","hikayemiz","sahipleri","gecen_yili"], effect:[], status:0 },
			elm: {},
			init: function(container,link){
				with(garaj.part.nav_garaj)
				{
					elm.a = container;
					elm.b = link;
					elm["lines"] = [lib.e("id","navLine2_0"),lib.e("id","navLine2_1"),lib.e("id","navLine2_2"),lib.e("id","navLine2_3"),lib.e("id","navLine2_4")];
					
					
					
					for(var i=0; i<elm.lines.length; i++)
					{
						var txt='';
						txt+='elm.lines[i].on("mouseover",function(fact){ if(fact.srcElement!=garaj.part.nav_garaj.elm.lines['+i+'] && fact.srcElement!=garaj.part.nav_garaj.elm.lines['+i+'].link)return 0; garaj.part.nav_garaj.elm.lines['+i+'].style.background = "#F90735 url(_img/'+a.keys[i]+'_1.jpg) no-repeat"; }); ';
						txt+='elm.lines[i].on("mouseout",function(fact){ garaj.part.nav_garaj.elm.lines['+i+'].style.background = "#F90735 url(_img/'+a.keys[i]+'_0.jpg) no-repeat"; }); ';
						eval(txt);
						
						var node = elm.lines[i];
						node.link = node.make("a::&nbsp;",{ att:{ "class":"link", "href":"garaj_"+a.keys[i]+".php" } });
						
					}
					elm.b.on("mouseover",doo.display);
				}
			},
			doo: {
				
				display: function()
				{
					with(garaj.part.nav_garaj)
					{
						
						a.effect.push(new fader(lib.e('id','subnav_2')));
						a.effect.push(new sizer(lib.e('id','subnav_2'),{ height:154 }));
						elm.b.att("class","selected");
						a.status = 1;
					}
				},
				hide: function(fact)
				{
					with(garaj.part.nav_garaj)
					{
						if(fact.srcElement == elm.a || fact.srcElement.parentNode == elm.a || fact.srcElement.parentNode.parentNode == elm.a || fact.srcElement.parentNode.parentNode.parentNode == elm.a || fact.srcElement == elm.b)return;
						a.status = 0;
						elm.b.att("class","selected",1);
						a.effect.push(new sizer(lib.e('id','subnav_2'),{ height:0 }));
						a.effect.push(new fader(lib.e('id','subnav_2'),-1));
					}
				}

			}
		},

		nav_destekciler:{
			a: { keys:["bireysel","kurumsal","sponsor"], effect:[], status:0 },
			elm: {},
			init: function(container,link){
				with(garaj.part.nav_destekciler)
				{
					elm.a = container;
					elm.b = link;
					elm["lines"] = [lib.e("id","navLine1_0"),lib.e("id","navLine1_1"),lib.e("id","navLine1_2")];
					
					
					
					for(var i=0; i<elm.lines.length; i++)
					{
						var txt='';
						txt+='elm.lines[i].on("mouseover",function(fact){ if(fact.srcElement!=garaj.part.nav_destekciler.elm.lines['+i+'] && fact.srcElement!=garaj.part.nav_destekciler.elm.lines['+i+'].link)return 0; garaj.part.nav_destekciler.elm.lines['+i+'].style.background = "#F90735 url(_img/'+a.keys[i]+'_1.jpg) no-repeat"; }); ';
						txt+='elm.lines[i].on("mouseout",function(fact){ garaj.part.nav_destekciler.elm.lines['+i+'].style.background = "#F90735 url(_img/'+a.keys[i]+'_0.jpg) no-repeat"; }); ';
						eval(txt);
						
						var node = elm.lines[i];
						node.link = node.make("a::&nbsp;",{ att:{ "class":"link", "href":"destekciler_"+a.keys[i]+".php" } });
						
					}
					elm.b.on("mouseover",doo.display);
				}
			},
			doo: {
				
				display: function()
				{
					with(garaj.part.nav_destekciler)
					{
						
						a.effect.push(new fader(lib.e('id','subnav_1')));
						a.effect.push(new sizer(lib.e('id','subnav_1'),{ height:93 }));
						elm.b.att("class","selected");
						a.status = 1;
					}
				},
				hide: function(fact)
				{
					with(garaj.part.nav_destekciler)
					{
						if(fact.srcElement == elm.a || fact.srcElement.parentNode == elm.a || fact.srcElement.parentNode.parentNode == elm.a || fact.srcElement.parentNode.parentNode.parentNode == elm.a || fact.srcElement == elm.b)return;
						a.status = 0;
						elm.b.att("class","selected",1);
						a.effect.push(new sizer(lib.e('id','subnav_1'),{ height:0 }));
						a.effect.push(new fader(lib.e('id','subnav_1'),-1));
					}
				}

			}
		},
		nav: {
			a: { keys:["muzik","tiyatro","dans","edebiyat","festival","sergi"], year:date.year, effect:[], status:0 },
			elm: {},
			init: function(container,link,detailer)
			{
				with(garaj.part.nav)
				{
					elm.a = container;
					elm.b = link;
					elm.c = detailer;

					elm["lines"] = [lib.e("id","navLine_0"),lib.e("id","navLine_1"),lib.e("id","navLine_2"),lib.e("id","navLine_3"),lib.e("id","navLine_4"),lib.e("id","navLine_5")];
					
					
					
					for(var i=0; i<elm.lines.length; i++)
					{
						var txt='';
						txt+='elm.lines[i].on("mouseover",function(fact){ if(fact.srcElement!=garaj.part.nav.elm.lines['+i+'] && fact.srcElement!=garaj.part.nav.elm.lines['+i+'].link)return 0; garaj.part.nav.elm.lines['+i+'].style.background = "#F90735 url(_img/'+a.keys[i]+'_01.jpg) no-repeat"; }); ';
						txt+='elm.lines[i].on("mouseout",function(fact){ garaj.part.nav.elm.lines['+i+'].style.background = "#F90735 url(_img/'+a.keys[i]+'_00.jpg) no-repeat"; }); ';
						eval(txt);
						
						var node = elm.lines[i];
						node.link = node.make("a::&nbsp;",{ att:{ "class":"link", "href":"disiplin.php?id="+i } });
						node.content = node.make("div",{ att:{ "class":"content" } });
						
						for(var f=0; f<31; f++)
							node["content_"+f] = node.content.make("a::"+garaj.doo.fixZero(f+1));
						
						node.type = i;
						node.updown = node.make("div",{ att:{ "class":"updown" } });
						node.down = node.updown.make("a::&lt;",{ att:{ "href":"javascript:garaj.part.nav.doo.controlMonth("+(i)+",-1);" } });
						node.span = node.updown.make("span");
						node.up = node.updown.make("a::&gt;",{ att:{ "href":"javascript:garaj.part.nav.doo.controlMonth("+(i)+",1);" } });
						node.month = date.month.ofYear;
						
						doo.setMonth(i);
					}
					elm["yearPicker"] = { "a":lib.e("id","yearPicker_container"), "b":lib.e("id","yearPicker_value"), "c":lib.e("id","yearPicker_down"), "d":lib.e("id","yearPicker_up") };
					doo.setYear(0,1);
					
					elm.b.on("mouseover",doo.display);
				}
			},
			doo: {
				
				display: function()
				{
					with(garaj.part.nav)
					{
						
						a.effect.push(new fader(lib.e('id','subnav_0')));
						a.effect.push(new sizer(lib.e('id','subnav_0'),{ height:210 }));
						
						elm.b.att("class","selected");
						a.status = 1;
					}
				},
				hide: function(fact)
				{
					with(garaj.part.nav)
					{
						if(fact.srcElement == elm.a || fact.srcElement.parentNode == elm.a || fact.srcElement.parentNode.parentNode == elm.a || fact.srcElement.parentNode.parentNode.parentNode == elm.a || fact.srcElement == elm.b || fact.srcElement.parentNode==elm.yearPicker.a || fact.srcElement==elm.c)return;
						a.status = 0;
						elm.b.att("class","selected",1);
						a.effect.push(new sizer(lib.e('id','subnav_0'),{ height:0 }));
						a.effect.push(new fader(lib.e('id','subnav_0'),-1));
					}
				},
				setDetailer: function(fact)
				{
					with(garaj.part.nav)
					{
						var node = data[fact.srcElement.getAttribute("key")];
						var element = elm.lines[fact.srcElement.getAttribute("line")]["content_"+(node.date[3]-1)];
						element.att("class","selected");
						
						a.cursor = element;
						elm.c.style.top = lib.n.ie?(fact.srcElement.offsetParent.offsetParent.offsetTop+135):(fact.srcElement.offsetTop+fact.srcElement.offsetParent.offsetTop-260)+"px"
						elm.c.style.left = lib.n.ie?(lib.i(fact.srcElement).x-60):(fact.srcElement.offsetLeft+fact.srcElement.offsetParent.offsetLeft-61)+"px"
						
						var weekDay = new Date();
						weekDay.setFullYear(node.date[4],node.date[2],node.date[3]);
						weekDay = weekDay.get();
						
						var hours = garaj.doo.returnDates(node);
						var hours_text = "";
						for(var t=0; t<hours.length; t++)
							hours_text += (t>0?"<br />":"")+garaj.doo.fixZero(hours[t][0])+":"+garaj.doo.fixZero(hours[t][1]);
									
						
						elm.c.style.background = "#000 url(_img/"+node["photo"]["ofPopUp"]+") no-repeat center 20px";
						elm.c.innerHTML = "<span>"+node.title+"</span><i>"+node.subTitle+"</i>"+(garaj.lang[garaj.a.lang].weekDay[weekDay.day.ofWeek])+"<br />"+hours_text;
						elm.c.style.display = "block";
					}
				},
				hideDetailer: function(fact)
				{
					with(garaj.part.nav)
					{
						if(fact.srcElement==elm.c)return;
						elm.c.style.display = "none";
						a.cursor.att("class","selected",1)
					}
				},
				setYear: function(num,leaveMonth)
				{
					with(garaj.part.nav)
					{
						a.year+=num;
						elm.yearPicker.b.innerHTML = (a.year);
						
						for(var i=0; i<elm.lines.length; i++)
						{
							if(leaveMonth!=1)
								elm.lines[i].month = 0;
							doo.setMonth(i);
						}
					}
				},
				setMonth: function(key)
				{
					with(garaj.part.nav)
					{
						var node = elm.lines[key];
						node.span.innerHTML =  garaj.doo.fixZero(node.month+1);
						
						var idate = new Date();
						idate.setFullYear(a.year);
						idate.setMonth(node.month);
						idate = idate.get();
						
						for(var i=0; i<31; i++)
							node["content_"+i].style.visibility = "hidden";
							
						for(var i=0; i<data.length; i++)
						{
							if(data[i].date[4]==a.year && node.type==data[i].type && data[i].date[2]==node.month)
							{
								node["content_"+(data[i].date[3]-1)].setAttribute("line",key);
								node["content_"+(data[i].date[3]-1)].setAttribute("key",i);
								node["content_"+(data[i].date[3]-1)].setAttribute("href","etkinlik.php?id="+data[i].id);
								node["content_"+(data[i].date[3]-1)].style.visibility = "visible";
								node["content_"+(data[i].date[3]-1)].on("mouseover",doo.setDetailer);
								node["content_"+(data[i].date[3]-1)].on("mouseout",doo.hideDetailer);
								
							}
						}
					}

				},
				controlMonth: function(key,val)
				{
					with(garaj.part.nav)
					{
						var node = elm.lines[key];
						if(node.month+val<0 || node.month+val>11)return;
						node.month+=val;
						doo.setMonth(key);
					}
				}
			}
		}
	},
	doo: {
		listen: function(fact)
		{
			with(garaj)
			{
				a.target = fact.srcElement;
				if(part.nav.a.status)
					part.nav.doo.hide(fact);
				if(part.nav_destekciler.a.status)
					part.nav_destekciler.doo.hide(fact);
				if(part.nav_garaj.a.status)
					part.nav_garaj.doo.hide(fact);
				if(part.nav_basin.a.status)
					part.nav_basin.doo.hide(fact);
				if(a.module==1 && fact.srcElement.getAttribute && fact.srcElement.getAttribute("typePage_key"))
					part.typePage.doo.displayDate(Number(fact.srcElement.getAttribute("typePage_key")));
				else if(a.module==1 && part.typePage.a.openedDate>-1)
					part.typePage.doo.hideDate();

			}
		},
		fixTr: function(text)
		{
			
		},
		fixZero: function(text)
		{
			return (String(text).length>1?String(text):("0"+String(text)));
		},
		returnDates: function(obj,format)
		{
			with(garaj)
			{
				var key0 = obj.date[2];
				var key1 = obj.date[3];
				var key2 = obj.key;
			
				var dates = [];
				
				for(var i=0; i<a.groups[key0][key1][key2].length; i++)
					dates.push(a.groups[key0][key1][key2][i].date);
				return dates;
			}	
		}
	}	
	
};

_search=function(){
	return false;
}
_news=function(){
	var email=encodeURIComponent(document.getElementById('email').value);
	var http = false;

	if(navigator.appName == "Microsoft Internet Explorer") {
	  http = new ActiveXObject("Microsoft.XMLHTTP");
	} else {
	  http = new XMLHttpRequest();
	}

	http.open("GET", "ajax.php?action=addnews&email="+email);
	http.onreadystatechange=function() {
	  if(http.readyState == 4 && http.status == 200) {
		switch (http.responseText){
			case "0":
			alert('Lütfen geçerli bir e-posta adresi yazınız.');
			break;
			case "1":
			alert('E-Bülten kaydınız yapıldı.');
			break;
		}
	  }
	}
	http.send(null);
	return false;
}
_switch_language=function(e){
	if(e>0){
		var params='&language=english';
	} else {
		var params='';
	}
	if(navigator.appName == "Microsoft Internet Explorer") {
	  http = new ActiveXObject("Microsoft.XMLHTTP");
	} else {
	  http = new XMLHttpRequest();
	}

	http.open("GET", "language.php?action=switch"+params);
	http.onreadystatechange=function() {
	  if(http.readyState == 4 && http.status == 200) {
			document.location=top.location;
	  }
	}
	http.send(null);
	return false;
}
window.on("load",garaj.init);
ATSWF = function (){
	ScrollArrow('right','navigation','scroller','frame1-pane');
}
ATSWF2 = function (){
	ScrollArrow('right','navigation2','scroller2','sframe1-pane');
}
sineInOut =function (t, b, c, d)
{
	return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
}

getSize = function() {
	if (document.all) {
		myWidth  = (document.documentElement.clientWidth) ? document.documentElement.clientWidth : document.body.clientWidth;
		myHeight = (document.documentElement.clientHeight) ? document.documentElement.clientHeight : document.body.clientHeight;
		myScroll = (document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop;
	} else {
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
		myScroll = window.pageYOffset;
	}
    if (window.innerHeight && window.scrollMaxY) {	
        myScrollWidth = document.body.scrollWidth;
		myScrollHeight = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight) {
		myScrollWidth = document.body.scrollWidth;
		myScrollHeight = document.body.scrollHeight;
	} else {
		myScrollWidth = document.body.offsetWidth;
		myScrollHeight = document.body.offsetHeight;
	}
}
findElementPos = function (elemFind)
{
	var elemX = 0;
	var elemY = 0;
	do {
		elemX += elemFind.offsetLeft;
		elemY += elemFind.offsetTop;
	} while ( elemFind = elemFind.offsetParent )
	return Array(elemX, elemY);
}


var currentSection = "frame1-pane";
var h_s = "-tab";
var f_s = "-pane";

var currentSection2 = "sframe1-pane";
var h_s2 = "-tab";
var f_s2 = "-pane";

ScrollSection = function (link, scrollArea, offset){
	if (currentSection == link) {
		return;
	}
	lastSection = currentSection;
	currentSection = link;
    sectionTab = currentSection.split("-")[0] + h_s;
    document.getElementById(sectionTab).className = "selected";
    if (lastSection) {
	    lastTab = lastSection.split("-")[0] + h_s;
	    document.getElementById(lastTab).className = "normal";
	}
	theScroll = document.getElementById(scrollArea);
	position = findElementPos(document.getElementById(link));
	if (offset != "") {
		offsetPos = findElementPos(document.getElementById(offset));
		position[0] = position[0] - offsetPos[0];
	}
	scrollStart(theScroll, theScroll.scrollLeft, position[0], "horiz");
}
ScrollArrow = function (direction, toolbar, scrollArea, offset) {
	toolbarElem = document.getElementById(toolbar);
	toolbarNames = new Array();
	if (toolbarElem.hasChildNodes())
	{
		var children = toolbarElem.childNodes;
		for (var i = 0; i < children.length; i++) 
		{
			if (toolbarElem.childNodes[i].tagName == "A") {
				toolbarNames.push(toolbarElem.childNodes[i].id.split("-")[0]);
			}
		}
	}
	for (var i = 0; i < toolbarNames.length; i++) {
		if (toolbarNames[i] == currentSection.split("-")[0]) {
			if (direction == "left") {
				if (i - 1 < 0) {
					gotoTab = toolbarNames[toolbarNames.length - 1];
				} else {
					gotoTab = toolbarNames[i - 1];
				}
			} else {
				if ((i + 1) > (toolbarNames.length - 1)) {
					gotoTab = toolbarNames[0];
				} else {
					gotoTab = toolbarNames[i + 1];
				}
			}
		}
	}
	ScrollSection(gotoTab+f_s, scrollArea, offset);
}

var scrollanim = {time:0, begin:0, change:0.0, duration:0.0, element:null, timer:null};

scrollStart=function(elem, start, end)
{
	if (scrollanim.timer != null) {
		clearInterval(scrollanim.timer);
		scrollanim.timer = null;
	}
	scrollanim.time = 0;
	scrollanim.begin = start;
	scrollanim.change = end - start;
	scrollanim.duration = 25;
	scrollanim.element = elem;
	scrollanim.timer = setInterval("scrollHorizAnim();", 15);
}

scrollHorizAnim=function()
{
	if (scrollanim.time > scrollanim.duration) {
		clearInterval(scrollanim.timer);
		scrollanim.timer = null;
	}
	else {
		move = sineInOut(scrollanim.time, scrollanim.begin, scrollanim.change, scrollanim.duration);
		scrollanim.element.scrollLeft = move;
		scrollanim.time++;
	}
}
ScrollSection2 = function (link, scrollArea, offset){
	if (currentSection2 == link) {
		return;
	}
	lastSection = currentSection2;
	currentSection2 = link;
    sectionTab = currentSection2.split("-")[0] + h_s2;
    document.getElementById(sectionTab).className = "selected";
    if (lastSection) {
	    lastTab = lastSection.split("-")[0] + h_s2;
	    document.getElementById(lastTab).className = "normal";
	}
	theScroll = document.getElementById(scrollArea);
	position = findElementPos(document.getElementById(link));
	if (offset != "") {
		offsetPos = findElementPos(document.getElementById(offset));
		position[0] = position[0] - offsetPos[0];
	}
	scrollStart2(theScroll, theScroll.scrollLeft, position[0], "horiz");
}
ScrollArrow2 = function (direction, toolbar, scrollArea, offset) {
	toolbarElem = document.getElementById(toolbar);
	toolbarNames = new Array();
	if (toolbarElem.hasChildNodes())
	{
		var children = toolbarElem.childNodes;
		for (var i = 0; i < children.length; i++) 
		{
			if (toolbarElem.childNodes[i].tagName == "A") {
				toolbarNames.push(toolbarElem.childNodes[i].id.split("-")[0]);
			}
		}
	}
	for (var i = 0; i < toolbarNames.length; i++) {
		if (toolbarNames[i] == currentSection2.split("-")[0]) {
			if (direction == "left") {
				if (i - 1 < 0) {
					gotoTab = toolbarNames[toolbarNames.length - 1];
				} else {
					gotoTab = toolbarNames[i - 1];
				}
			} else {
				if ((i + 1) > (toolbarNames.length - 1)) {
					gotoTab = toolbarNames[0];
				} else {
					gotoTab = toolbarNames[i + 1];
				}
			}
		}
	}
	ScrollSection2(gotoTab+f_s2, scrollArea, offset);
}
var scrollanim2 = {time:0, begin:0, change:0.0, duration:0.0, element:null, timer:null};

scrollStart2=function(elem, start, end)
{
	if (scrollanim2.timer != null) {
		clearInterval(scrollanim2.timer);
		scrollanim2.timer = null;
	}
	scrollanim2.time = 0;
	scrollanim2.begin = start;
	scrollanim2.change = end - start;
	scrollanim2.duration = 25;
	scrollanim2.element = elem;
	scrollanim2.timer = setInterval("scrollHorizAnim2();", 15);
}

scrollHorizAnim2=function()
{
	if (scrollanim2.time > scrollanim2.duration) {
		clearInterval(scrollanim2.timer);
		scrollanim2.timer = null;
	}
	else {
		move2 = sineInOut(scrollanim2.time, scrollanim2.begin, scrollanim2.change, scrollanim2.duration);
		scrollanim2.element.scrollLeft = move2;
		scrollanim2.time++;
	}
}