﻿<!--

// Erdem Öztürk (erdemozturk@gmail.com) © Ağustos 2010 // 

	tpl_ic_bslk = defvar_etkinlik = login_hata = etkinlik_ay = uyebilgileri = loginid = '';

	// Flash embed
	;(function()
	{
		
		var $$;
		$$ = jQuery.fn.flash = function(htmlOptions, pluginOptions, replace, update) {
			
			var block = replace || $$.replace;
			pluginOptions = $$.copy($$.pluginOptions, pluginOptions);
			if(!$$.hasFlash(pluginOptions.version)) {
				if(pluginOptions.expressInstall && $$.hasFlash(6,0,65)) {
					var expressInstallOptions = {
						flashvars: {  	
							MMredirectURL: location,
							MMplayerType: 'PlugIn',
							MMdoctitle: jQuery('title').text() 
						}					
					};
				} else if (pluginOptions.update) {
					block = update || $$.update;
				} else {
					return this;
				}
			}
			
			htmlOptions = $$.copy($$.htmlOptions, expressInstallOptions, htmlOptions);
			return this.each(function(){
				block.call(this, $$.copy(htmlOptions));
			});
			
		};
	
		$$.copy = function() {
			var options = {}, flashvars = {};
			for(var i = 0; i < arguments.length; i++) {
				var arg = arguments[i];
				if(arg == undefined) continue;
				jQuery.extend(options, arg);
				if(arg.flashvars == undefined) continue;
				jQuery.extend(flashvars, arg.flashvars);
			}
			options.flashvars = flashvars;
			return options;
		};
		
		$$.hasFlash = function() {
			if(/hasFlash\=true/.test(location)) return true;
			if(/hasFlash\=false/.test(location)) return false;
			var pv = $$.hasFlash.playerVersion().match(/\d+/g);
			var rv = String([arguments[0], arguments[1], arguments[2]]).match(/\d+/g) || String($$.pluginOptions.version).match(/\d+/g);
			for(var i = 0; i < 3; i++) {
				pv[i] = parseInt(pv[i] || 0);
				rv[i] = parseInt(rv[i] || 0);
				if(pv[i] < rv[i]) return false;
				if(pv[i] > rv[i]) return true;
			}
			return true;
		};
		
		$$.hasFlash.playerVersion = function() {
			try {
				try {
					var axo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');
					try { axo.AllowScriptAccess = 'always';	} 
					catch(e) { return '6,0,0'; }				
				} catch(e) {}
				return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1];
			} catch(e) {
				try {
					if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){
						return (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1];
					}
				} catch(e) {}		
			}
			return '0,0,0';
		};
		
		$$.htmlOptions = {
			height: 240,
			flashvars: {},
			pluginspage: 'http://www.adobe.com/go/getflashplayer',
			src: '#',
			type: 'application/x-shockwave-flash',
			width: 320		
		};
		
		$$.pluginOptions = {
			expressInstall: false,
			update: true,
			version: '6.0.65'
		};
		
		$$.replace = function(htmlOptions) {
			this.innerHTML = '<div class="alt">'+this.innerHTML+'</div>';
			jQuery(this)
				.addClass('flash-replaced')
				.prepend($$.transform(htmlOptions));
		};
		
		$$.update = function(htmlOptions) {
			var url = String(location).split('?');
			url.splice(1,0,'?hasFlash=true&');
			url = url.join('');
			var msg = '<p>This content requires the Flash Player. <a href="http://www.adobe.com/go/getflashplayer">Download Flash Player</a>. Already have Flash Player? <a href="'+url+'">Click here.</a></p>';
			this.innerHTML = '<span class="alt">'+this.innerHTML+'</span>';
			jQuery(this)
				.addClass('flash-update')
				.prepend(msg);
		};
		
		function toAttributeString() {
			var s = '';
			for(var key in this)
				if(typeof this[key] != 'function')
					s += key+'="'+this[key]+'" ';
			return s;		
		};
	
		function toFlashvarsString() {
			var s = '';
			for(var key in this)
				if(typeof this[key] != 'function')
					s += key+'='+encodeURIComponent(this[key])+'&';
			return s.replace(/&$/, '');		
		};
	
		$$.transform = function(htmlOptions) {
			htmlOptions.toString = toAttributeString;
			if(htmlOptions.flashvars) htmlOptions.flashvars.toString = toFlashvarsString;
			return '<embed ' + String(htmlOptions) + '/>';		
		};
	
		if (window.attachEvent) {
			window.attachEvent("onbeforeunload", function(){
				__flash_unloadHandler = function() {};
				__flash_savedUnloadHandler = function() {};
			});
		}
	
	})();


	// blink
	(function($)
	{
		$.fn.blink = function(options)
		{
			var defaults = { delay:500 };
			var options = $.extend(defaults, options);
			
			return this.each(function()
			{
				var obj = $(this);
				setInterval(function()
				{
					if($(obj).css("visibility") == "visible")
					{
						$(obj).css('visibility','hidden');
					}
					else
					{
						$(obj).css('visibility','visible');
					}
				}, options.delay);
			});
		}
	}(jQuery))


	renkler = {
		'r0':'#01B6AD','r2':'#01C4E2','r4':'#F6712E','r6':'#F22E9C','r8':'#42BF5B',
		'r10':'#01B6AD','r12':'#01C4E2','r14':'#F6712E','r16':'#F22E9C','r18':'#42BF5B',
		'r20':'#01B6AD','r22':'#01C4E2','r24':'#F6712E','r26':'#F22E9C','r28':'#42BF5B'
	};

	// ana menu
	function init_sol_Menu()
	{
		/*$('#menu').mousewheel(function(e, d) {
			//alert('['+d+' | '+ana_menu_checked+'] \n'+$($('#menu>*').get(ana_menu_checked+(d*2))).find('a').mouseover());
			setTimeout(function()
			{
				var checkElement = $($('#menu>*').get(ana_menu_checked+(d*2))).find('a:first').next();
				if((checkElement.is('.ul')) && (checkElement.is(':visible')))
					{ return false; }
				if((checkElement.is('.ul')) && (!checkElement.is(':visible')))
				{
					ana_menu_checked = ana_menu_checked+(d*2);
					$($('#menu>*').get(ana_menu_checked+(d*2))).find('a:first').css('background-color',renkler['r' + ana_menu_checked]);
					$('#menu .ul:visible').slideUp('normal',function()
						{ $(this).prev().css('background-color','#333'); });
					checkElement.slideDown('normal');
					return false;
				}
			},50);

		});*/

		ana_menu_checked = -1;

		$('#menu .ul').hide();
		//$('#menu .ul:first').show();
		$('#menu>.li>a')
			.mouseover(function() { $(this).css('background-color',renkler['r' + $(this).parent().index()]); })
			.mouseout(function() { if(ana_menu_checked != $(this).parent().index()) $(this).css('background-color','#333'); })
			.click(function()
			{
				var checkElement = $(this).next();
				if((checkElement.is('.ul')) && (checkElement.is(':visible')))
					{ return false; }
				if((checkElement.is('.ul')) && (!checkElement.is(':visible')))
				{
					ana_menu_checked = $(this).parent().index();
					$('#menu .ul:visible').slideUp('normal',function()
						{ $(this).prev().css('background-color','#333'); });
					checkElement.slideDown('normal');
					return false;
				}
			});
	}
	
	function ana_top_menu()
	{
  		$('#topmenu .baslik').hover(
			function()
			{
				$('.icerik', this).slideDown(100);
				$(this).css('background-color',renkler['r' + $(this).index()*2]);
			},    
			function ()
			{
				$(this).css('background-color','#333');
				$('.icerik', this).slideUp(100);
			}   
		);
		$('#topmenu .sec').each(function(){ $(this).css('background-color',renkler['r' + $(this).index()*2]);  })
	}
	
	function mycarousel_initCallback(carousel)
	{
		/* Disable autoscrolling if the user clicks the prev or next button.
		carousel.buttonNext.bind('click', function() {
			carousel.startAuto(0);
		});*/
	
		carousel.buttonPrev.bind('click', function() {
			carousel.startAuto(0);
		});
	
		// Pause autoscrolling if the user moves with the cursor over the clip.
		carousel.clip.hover(function() {
			carousel.stopAuto();
		}, function() {
			carousel.startAuto();
		});
	};


	// jquery prints
	jQuery.fn.print_et = function()
	{
		if (this.size() > 1)
			{ this.eq( 0 ).print(); return; }
		else if (!this.size())
			{ return; }
		
		var jFrame = $("<iframe></iframe>")
			.attr("name","yazdir")
			.attr("id","yazdir")
			.css( "width", "1px" )
			.css( "height", "1px" )
			.css( "position", "absolute" )
			.css( "left", "-10px" )
			.appendTo($( "body:first" ));

		var objFrame	= window.frames["yazdir"];
		var objDoc		= objFrame.document;
		var jStyleDiv = $("<div>").append($("link").clone());

		objDoc.open();
		objDoc.write(
			'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'+
			'<html>'+
				'<head>'+
					'<title>'+document.title+'</title>'+
					jStyleDiv.html() +
				'</head>'+
				'<body onload="window.focus(); print();"><div style="background-color:#fff">'+this.html()+'</div></body>'+
			'</html>'
		);
		objDoc.close();
		/*objFrame.focus();
		objFrame.print();*/

		setTimeout(function()
			{ jFrame.remove(); }, (60 * 1000));
	}


	// var dump js
	function DumpObject(obj) 
	{ 
	
	 // örnek od = DumpObject(nav); erd_defact.dgebi('bura').innerHTML = od.dump;
	
	  var od = new Object; 
	  var result = ""; 
	  var len = 0; 
	 
	  for (var property in obj) 
	  { 
		var value = obj[property]; 
		if (typeof value == 'string') 
			{ value = "'" + value + "'"; }
		else if (typeof value == 'object') 
		{
		  if (value instanceof Array) 
		  { 
			value = "[ " + value + " ]"; 
		  } 
		  else 
		  { 
			var ood = DumpObject(value); 
			value = "{ " + ood.dump + " }"; 
		  } 
		} 
		result += "'" + property + "' : " + value + ", "; 
		len++; 
	  } 
	  od.dump = result.replace(/, $/, ""); 
	  od.len = len; 
	 
	  return od; 
	} 

	$(document).ready(function()
	{

		Shadowbox.init({
			displayNav:true,
			language:"tr",
			ext:{
				img:	['png', 'jpg', 'jpeg', 'gif', 'bmp'], 
				swf:	['swf'], 
				flv:	['flv', 'mp3'], 
				qt:		['dv', 'mov', 'moov', 'movie', 'mp4'], 
				wmp:	['asf', 'wm', 'wmv'], 
				qtwmp:	['avi', 'mpg', 'mpeg'], 
				iframe:	['asp', 'aspx', 'cgi', 'cfm', 'htm', 'html', 'pl', 'php', 'php3', 'php4', 'php5', 'phtml', 'rb', 'rhtml', 'shtml', 'txt', 'vbs', 'pdf'] 
			},				
			players:['img','swf','flv','wmp','html','iframe','qt']
		}); // c init
		
		
		$('#creditic').flash({
			width		: 25,
			height		: 170,
			tabindex	: 2,
			src			: '_swf/credit.swf',
			quality		: 'high',
			wmode		: 'transparent',
			flashvars	: { 
				tn : ''
			}

		}); // c fls
		
		init_sol_Menu();
		ana_top_menu();

		$(".carousel-ust-menu").jCarouselLite({
			mouseWheel: true,
			scroll: 2,
			visible: 2,
			auto: 10000,
			btnNext: ".carousel-ust-menu .next",
			btnPrev: ".carousel-ust-menu .prev"
			//btnGo: [".0", ".1", ".2"],
			//beforeStart: function(a) { alert("Before animation starts:" + a); },
			//afterEnd: function(a) { alert("After animation ends:" + a);	}
		});

		$(".carousel-ebulten-menu").jCarouselLite({
			mouseWheel: true,
			scroll: 1,
			auto: 10000,
			visible: 5,
			btnNext: ".carousel-ebulten-menu .next",
			btnPrev: ".carousel-ebulten-menu .prev"
		});
		
		$(".carousel-orta-menu").jCarouselLite({
			mouseWheel: true,
			scroll: 1,
			auto: 10000,
			visible: 5,
			btnNext: ".carousel-orta-menu .next",
			btnPrev: ".carousel-orta-menu .prev"
		});

		$(".carousel-haberler-menu").jCarouselLite({
			mouseWheel: true,
			scroll: 1,
			auto: 10000,
			visible: 5,
			btnNext: ".carousel-haberler-menu .next",
			btnPrev: ".carousel-haberler-menu .prev"
		});

		$(".carousel-kitap-menu").jCarouselLite({
			mouseWheel: true,
			scroll: 1,
			auto: 9500,
			visible: 5,
			btnNext: ".carousel-kitap-menu .next",
			btnPrev: ".carousel-kitap-menu .prev"
		});

		$(".carousel-alt-menu").jCarouselLite({
			mouseWheel: true,
			scroll: 1,
			visible: 5,
			btnNext: ".carousel-alt-menu .next",
			btnPrev: ".carousel-alt-menu .prev"
		});
		
		$(".carousel-top-banner").jCarouselLite({
			scroll: 1,
			auto: 8500,
			visible: 1,
			vertical: true
		});
		
		

		if(tpl_ic_bslk)
		{
			$(".icsayfalar .icmenu").jCarouselLite({
				mouseWheel: true,
				scroll: 1,
				visible: 2,
				circular: false,
				start:(tpl_ic_bslk-2),
				btnNext: ".icsayfalar .icmenu .next",
				btnPrev: ".icsayfalar .icmenu .prev"
			});
		}
		else
		{
			$(".icsayfalar .ana_icerik").css('max-width',547+191).width(547+191);
			$(".icsayfalar .icmenu").css('max-width',191).width(191);
		}
		
		if($(".icsayfalar .icmenu ul").height() < $(".icsayfalar").height()) { $(".icsayfalar .icmenu ul").height($(".icsayfalar").height()); }

		// top Panel
		$(".arama").click(function()
		{
			$('html').animate({scrollTop:0}, { duration: 'slow', complete: function()
			{
				$(".login_panel").slideUp("slow");
				$(".arama_panel").slideDown("slow");
				$("#close, .kapat").css('display','');
			}});
		});	

		$(".login_bt").click(function()
		{
			if(loginid)
				{ window.location.href = '?Did='+uyebilgileri; }
			
			else
			{
				$('html').animate({scrollTop:0}, { duration: 'slow', complete: function()
				{
					$(".arama_panel").slideUp("slow");
					$(".login_panel").slideDown("slow");
					$("#close, .kapat").css('display','');
				}});
			} // c if
		});	

		$("#close").click(function()
		{
			$(".arama_panel").slideUp("slow");
			$(".login_panel").slideUp("slow");
			$("#close, .kapat").css('display','none');
		});
		

		$(".login_change .lost-pwd").click(function()
			{ $(".login_change form").toggle(); });

		if(login_hata != '')
		{
			$(".login_bt").click();
			$(".login_hata").html(login_hata).blink(5000);
		}
		
		$('.radio').tipsy({gravity: 'n', html: true, fade: false });
		
		$('.carousel-kitap-menu a, .sonbaski a.tt').tipsy({gravity: 'f', html: true, fade: false });
		
		$('.paging a, .RSS img[tipsy_title]').tipsy({gravity: 's', html: true, fade: false });
		
		$('#altbar .istatistik a[tipsy_title], .paging_horizontal div[tipsy_title]').tipsy({gravity: 's', html: true, fade: false });

		$('.etkinlik_takvim')
			.datepicker({ hideIfNoPrevNext: false,
				onSelect: function(dateText, inst)
					{ window.location.href = '?Did=' + defvar_etkinlik; }
			})
			.tipsy({gravity: 'fs', html: true, fade: false, title:'Tarih Seçiniz.' });

		$('.top').click(function() { location.href = '/'; }).tipsy({gravity: 'f', html: true, fade: false, title:'Ana Sayfaya Git' });

		$('.etkinlik_takvim a').hover(function()
		{
			var now = new Date();
			var ay = now.getMonth()+1;
			var selected_day = Number(now.getFullYear()+String('0'+ay).right(2)+String('0'+$(this).text()).right(2));
			var str = '<b style="font-size:13px">Günün Etkinlikleri</b><hr>';
			for (var i in etkinlik_ay)
			{
				obj = i.split('_');
				//alert(obj[0]+'|'+selected_day+'|'+obj[1]);
				if(obj[0] <= selected_day && selected_day <= obj[1])
					{ str += etkinlik_ay[i]+'<hr>'; }
			}
			tipsy_title = str;

		} );

	});


	// right
	String.prototype.right = function(n)
	{
		if (n <= 0)
		   return "";
		else if (n > String(this).length)
		   return this;
		else {
		   var iLen = String(this).length;
		   return String(this).substring(iLen, iLen - n);
		}
	}


//-->
