$(document).ready(function(){

	var playItem = 1;
	swfPath: "js/"
	var myPlayList = [
		{name:"Palavra",mp3:"audio/palavra.mp3"},
		{name:"Sevil Neselen",mp3:"audio/sevilneselen.mp3"},
	];

	// Local copy of jQuery selectors, for performance.
	var jpPlayTime = $("#jplayer_play_time");
	var jpTotalTime = $("#jplayer_total_time");
	var jpStatus = $("#demo_status"); // For displaying information about jPlayer's status in the demo page

	$("#jquery_jplayer").jPlayer({
		ready: function() {
			displayPlayList();
			playListInit(true); // Parameter is a boolean for autoplay.
			demoInstanceInfo(this.element, $("#demo_info")); // This displays information about jPlayer's configuration in the demo page
		},
		oggSupport: false
	})
	.jPlayer("onProgressChange", function(loadPercent, playedPercentRelative, playedPercentAbsolute, playedTime, totalTime) {
		jpPlayTime.text($.jPlayer.convertTime(playedTime));
		jpTotalTime.text($.jPlayer.convertTime(totalTime));

		demoStatusInfo(this.element, jpStatus); // This displays information about jPlayer's status in the demo page
	})
	.jPlayer("onSoundComplete", function() {
		playListNext();
	});

	$("#jplayer_previous").click( function() {
		playListPrev();
		$(this).blur();
		return false;
	});

	$("#jplayer_next").click( function() {
		playListNext();
		$(this).blur();
		return false;
	});

	function displayPlayList() {
		$("#jplayer_playlist ul").empty();
		for (i=0; i < myPlayList.length; i++) {
			var listItem = (i == myPlayList.length-1) ? "<li class='jplayer_playlist_item_last'>" : "<li>";
			listItem += "<a href='#' id='jplayer_playlist_item_"+i+"' tabindex='1'>"+ myPlayList[i].name +"</a></li>";
			$("#jplayer_playlist ul").append(listItem);
			$("#jplayer_playlist_item_"+i).data( "index", i ).click( function() {
				var index = $(this).data("index");
				if (playItem != index) {
					playListChange( index );
				} else {
					$("#jquery_jplayer").jPlayer("play");
				}
				$(this).blur();
				return false;
			});
		}
	}

	function playListInit(autoplay) {
		if(autoplay) {
			playListChange( playItem );
		} else {
			playListConfig( playItem );
		}
	}

	function playListConfig( index ) {
		$("#jplayer_playlist_item_"+playItem).removeClass("jplayer_playlist_current").parent().removeClass("jplayer_playlist_current");
		$("#jplayer_playlist_item_"+index).addClass("jplayer_playlist_current").parent().addClass("jplayer_playlist_current");
		playItem = index;
		$("#jquery_jplayer").jPlayer("setFile", myPlayList[playItem].mp3, myPlayList[playItem].ogg);
	}

	function playListChange( index ) {
		playListConfig( index );
		$("#jquery_jplayer").jPlayer("play");
	}

	function playListNext() {
		var index = (playItem+1 < myPlayList.length) ? playItem+1 : 0;
		playListChange( index );
	}

	function playListPrev() {
		var index = (playItem-1 >= 0) ? playItem-1 : myPlayList.length-1;
		playListChange( index );
	}

	
	
});


function openPage(page, back){
	/*$('.back' + back).css("z-index", -9);
	$('.back' + back).fadeIn("slow", function() {
		var i=0;
		for(i=1; i<6; i++){
			if(i != back){
				$('.back' + i).css("z-index", -10);
				$('.back' + i).css("display", "none");
			}
		}
	});*/
	/*document.getElementById(fullscreen).Play();*/
	 $('.contentUp').load(page, function(){
			$('#pane1').jScrollPane(); 
			$('#pane2').jScrollPane();   
				if(page == 'videolar.php' || page=='basin.php'){ 
					$("#slider").easySlider(); 
					    $(".iframe").fancybox({
							'autoScale' : true,
							'transitionIn' : 'none',
							'transitionOut' : 'none',
							'type' : 'iframe'
						});
				}
			var back = getFlashMovieObject("fullscreen");
			back.Play();
			});
}	
function openAlbum(idE){
	$('.albumAc').load("albumler/" + idE + ".php", function(){ 
							$('.albumIcerik').fadeIn("fast"); 
							$('#pane2').jScrollPane();
							$(".inline").fancybox({
								'autoScale' : true,
								'href' : '#inline01',
								'titlePosition'		: 'inside',
								'transitionIn'		: 'none',
								'transitionOut'		: 'none',
								'type' : 'inline'
							});	
						});
}
function openPhoto(gallery, page, total){
		var dataRem= '&gallery=' + gallery + '&page=' + page + '&total=' + total; 
   		 $.ajax({
		   type: 'GET',
		   url: 'fotograflarGaleri.php',
		   data:  dataRem,
		   success: function(sonuc) {
					$('.fotoAc').html(sonuc);
					$('.gallery1').fancybox();
		   }
		 });
}
	function lContent(idE) {
		if ($('#'+idE).is(":hidden")) {
		$('#'+idE).slideDown("slow", function(){$('#pane2').jScrollPane(); });
		} else {
		$('#'+idE).hide("fast", function(){	$('#pane2').jScrollPane(); });
		}
	}
	
function getFlashMovieObject(movieName)
{
  if (window.document[movieName]) 
  {
      return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }
}

function openPhotoCat(idE){
		if ($('#cat'+idE).is(":hidden")) {
		$('#cat'+idE).slideDown("slow", function(){$('#pane2').jScrollPane(); });
		} else {
		$('#cat'+idE).hide("fast", function(){	$('#pane2').jScrollPane(); });
		}
}
	


