// JavaScript Document

$(document).ready(function(){


	
	



	$('#logo_area').click(function(e) {
		
		
		$(".tab_links").each(function(){
			var id =  $(this).attr("id") ;
			$('#'+id).removeClass('selected');
		});
		

			document.getElementById("ajx_main").style.display="block" ;
			document.getElementById("ajx_page").style.display="none" ;
	
	
	});





	
	
	
	
	$(".menu_alt").click(
function()
{
    //window.location = $(this).attr("#page_anchor");
	window.location.assign("#page_up") ;
	
});

	
	
	


	
	$('#animation_area').flash(
		{src: 'images/logo_animation.swf',width: 55,height: 73 },
		{ version: 8 }
	);
	//$('.main_links').click(function(){  
	
	$('.main_links').click(function(e) {
		e.preventDefault();
		
		
		$(".tab_links").each(function(){
			var id =  $(this).attr("id") ;
			$('#'+id).removeClass('selected');
		});
		
		var link_id = $(this).attr("id") ;
		var page_link_ham = $(this).attr("href") ;
		var page_link_bol = page_link_ham.split("?page=");
		var page_link = page_link_bol[1]  ;
		
		if(link_id == "main_page_link"){
			document.getElementById("ajx_main").style.display="block" ;
			document.getElementById("ajx_page").style.display="none" ;
		}else{
			document.getElementById("ajx_main").style.display="none" ;
			document.getElementById("ajx_page").style.display="block" ;
			var deger = 0  ;
			sayfa_yukle(page_link ,'ajx_page',deger) ;
		}
	
	});
		
	//$('.tab_links').click(function(){  
	$('.tab_links').click(function(e) {
		e.preventDefault();
		
		document.getElementById("ajx_main").style.display="none" ;
		document.getElementById("ajx_page").style.display="block" ;
		var deger = 0  ;
		var link_id = $(this).attr("id") ;
		var page_link_ham = $(this).attr("href") ;
		var page_link_bol = page_link_ham.split("?page=");
		var page_link = page_link_bol[1]  ;
		
		
		sayfa_yukle(page_link,'ajx_page',deger) ;
		
		var list_index = $(this).attr("id") ;
		
		
		$(".tab_links").each(function(){
			var id =  $(this).attr("id") ;
			if(id == list_index ){
				$('#'+id).addClass('selected');
			}else{
				$('#'+id).removeClass('selected');
			}
		});
	
	});
		
	
	haber_yukle(0) ;	
	
	
	
	  $("#yt_player").addClass("yt_playing");
  
  
  $('#yt_player').toggle(function() {
   pause();
}, function() {
	play() ;
  
});
  
  
        var videoID = "I_mWcsDpMGY"
        // Lets Flash from another domain call JavaScript
        var params = { allowScriptAccess: "always" };
        // The element id of the Flash embed
        var atts = { id: "myytplayer" };
        // All of the magic handled by SWFObject (http://code.google.com/p/swfobject/)
        swfobject.embedSWF("http://www.youtube.com/v/" + videoID + "&enablejsapi=1&playerapiid=player1&autoplay=1&loop=1&autohide=1",
                           "videoDiv", "1", "1", "8", null, null, params, atts);
	
	
	
	
	
});



$(function(){
	$('select#language').selectmenu({
		style:'dropdown',
		icons: [
			{find: '.tr'},
			{find: '.en'},
			{find: '.ru'}
		]
	});
});
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function sayfa_yukle(sayfa,alan,deger){
		
   		$('#'+alan).html('<div class="'+alan+'_loading"></div>');
		$.ajax({
			type: 'GET',
			url: 'index.php?page='+sayfa+'&ajx=1&deger='+deger ,
			success: function(sonuc) { 
				$("#"+alan).html(sonuc);	
				
				//alert(sayfa+'--'+alan+'--'+deger) ;
				
			if(sayfa != 'news'){	
				$("a[rel=photo_group]").fancybox({
					'transitionIn'		: 'none',
					'transitionOut'		: 'none',
					'titlePosition' 	: 'over',
					'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
						return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
					}
				});
			}
				
				
				
				
			}
		});
	return false;
}

function haber_yukle(id){
	sayfa_yukle('news','haber_area',id) ;
}

function haber_detay(id){
		document.getElementById("ajx_main").style.display="none" ;
		document.getElementById("ajx_page").style.display="block" ;

		
	sayfa_yukle('news_detail','ajx_page',id) ;
}






function news_list(){
		document.getElementById("ajx_main").style.display="none" ;
		document.getElementById("ajx_page").style.display="block" ;
		var id = 77 ;
		
	sayfa_yukle('news_list','ajx_page',id) ;
}

	function sayfa_yukle_hava2(deger,durum){
		$.ajax({
		type: 'GET',
		url: '?page=weather&ajx=1&cekme='+durum+'&deger='+deger ,
		success: function(sonuc) {
						$('#weather_area').html(sonuc);
		}
	});
return false;
}

	   function onYouTubePlayerReady(playerId) {
          ytplayer = document.getElementById("myytplayer");
        }

		  function play() {
          if (ytplayer) {
            ytplayer.playVideo();
			$("#yt_player").removeClass("yt_pause").addClass("yt_playing");
          }
        }
		
		    function pause() {
          if (ytplayer) {
            ytplayer.pauseVideo();
			$("#yt_player").removeClass("yt_playing").addClass("yt_pause");
          }
        }


