﻿<!--

// Erdem Öztürk (erdemozturk@gmail.com) © Ağustos 2010 // 

	// 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:'800px', height:'100px', position:'absolute', left:'-800px', top:'0px' })
			.appendTo($( "body:first" ));

		var objFrame	= window.frames["yazdir"];
		var objDoc		= objFrame.document;
		var jStyleDiv = $("<div>").append($("link:first").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));
	}

	// 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() {};
			});
		}
	
	})();

	$.fn.wait = function(time, type)
	{
        time = time || 1000;
        type = type || "fx";
        return this.queue(type, function() {
            var self = this;
            setTimeout(function() {
                $(self).dequeue();
            }, time);
        });
    };


	$(document).ready(function()
	{

		Shadowbox.init({
			handleOversize:"drag",
			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
			
		$('.button, .input').each(function()
			{ $(this).html('<div class="tl"></div><div class="t"></div><div class="tr"></div><div class="r"></div><div class="br"></div><div class="b"></div><div class="bl"></div><div class="l"></div><div class="ic">'+$(this).html()+'</div>'); });

		$('.ust_resim img').click(function()
			{ location.href = '/'; }).tipsy({gravity: 'f', html: true, fade: false, title:'Ana Sayfaya Git' });		
		
		$('.lost-pwd').click(function()
			{ $('.login_sendpass').toggle(); });

		$('.cikis').click(function()
			{ $('#login_cikis_frm').submit(); });

		$('.arama_bt').click(function()
			{ $('#arama_frm').submit(); });

		$('.arama_inp').keydown(function(e)
		{
			var code = (e.keyCode ? e.keyCode : e.which);
			if(code == 13) $('#arama_frm').submit();
		});

		$('.login_bt').click(function()
			{ location.href = $(this).attr('url'); });

		$('.giris_bt').click(function()
			{ $('#login_giris_frm').submit(); });

		$('.giris_inp').keydown(function(e)
		{
			var code = (e.keyCode ? e.keyCode : e.which);
			if(code == 13) $('#login_giris_frm').submit();
		});

		$('.parola_gonder_bt').click(function()
			{ $('#parolami_unuttum_frm').submit(); });
			
		$('.parola_gonder_inp').keydown(function(e)
		{
			var code = (e.keyCode ? e.keyCode : e.which);
			if(code == 13) $('#parolami_unuttum_frm').submit();
		});

		$('.kayit_bt').click(function()
			{ $('#yeni_kayit_frm').submit(); });

		$('.kayit_inp').keydown(function(e)
		{
			var code = (e.keyCode ? e.keyCode : e.which);
			if(code == 13) $('#yeni_kayit_frm').submit();
		});

		$('.news_bt').click(function()
			{ $('#news_kayit_frm').submit(); });
		
		$('.paging a, .social img[tipsy_title], .basvuru a[tipsy_title], .istatistik a[tipsy_title]').tipsy({gravity: 's', html: true, fade: false });

  		$('.yil_menu a').addClass('yillar');
  		$('.yil_menu tbody:first td').each(function()
		{
			if($('a:first', this).hasClass("sec"))
				{ $('table', this).remove(); }

			if($(this).attr('class') != 'ara' && !$('a:first', this).hasClass("sec"))
			{
				var yeni_icerik = $('<div>'+
					'<div class="yil"></div>'+
					'<div class="alt_menu">'+
						'<div style="background:url(_img/t.png); width:45px; height:29px; margin-top:20px;"></div>'+
							'<div style="padding-left:22px">'+
								'<table class="ana_menu"></table>'+
							'</div>'+
					'</div>'+
				'</div>');
				
				// ilk içerikteki table trleri yeni içeriğe ekleniyor
				$('td>a', this).each(function()
				{
					if($(this).attr('class') != 'ara')
						{ $('.ana_menu', yeni_icerik).append('<tr><td><a href="'+$(this).attr('href')+'">'+$(this).html()+'</a></td></tr>'); }
				});

				// ilk içerikteki kalanlar clası yil olan divle yer değişiyor.
				$('.yil', yeni_icerik).replaceWith($('a:first', this));
				
				
				$(this)
					.html(yeni_icerik)
					.hover(
						function()
						{
							$('.alt_menu', this).wait(200).stop().animate({height:'180px'}, "fast");
							$('.yil_menu').stop().animate({marginBottom:'180px'}, "fast");
							var Did = $('a:first', this).attr('Did');
							$('.alt_menu a', this).each(function()
							{
								if($(this).attr('nere'))
									{ $(this).attr('href','/?Did='+Did+$(this).attr('nere')); }
							});

							$('.alt_menu', $(this).siblings()).stop().animate({height:'0px'}, "fast");
						},    
						function ()
						{
							$('.alt_menu', this).stop().animate({height:'0px'}, "fast");
							$('.yil_menu').stop().animate({marginBottom:'0px'}, "fast");
						}   
					);
									
			} // c if
		});
		
		
	}); // end document ready
	
//-->
