/********************************/
/* 	Simple Slider (Sidebar)		*/
/********************************/
function slideShow() {
	//Set the opacity of all images to 0
	$('#sgallery a').css({opacity: 0.0});
	//Get the first image and display it (set it to full opacity)
	$('#sgallery a:first').css({opacity: 1.0});
	//Set the caption background to semi-transparent
	$('#sgallery .scaption').css({opacity: 0.7});
	//Resize the width of the caption according to the image width
	$('#sgallery .scaption').css({width: $('#sgallery a').find('img').css('width')});
	//Get the caption of the first image from REL attribute and display it
	$('#sgallery .scontent').html($('#sgallery a:first').find('img').attr('rel'))
	.animate({opacity: 0.7}, 900);
	//Call the gallery function to run the slideshow, 6000 = change to next image after 6 seconds
	setInterval('gallery()',5000);
}

function gallery() {
	//if no IMGs have the show class, grab the first image
	var current = ($('#sgallery a.show')?  $('#sgallery a.show') : $('#sgallery a:first'));
	//Get next image, if it reached the end of the slideshow, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('scaption'))? $('#sgallery a:first') :current.next()) : $('#sgallery a:first'));	
	//Get next image caption
	var caption = next.find('img').attr('rel');	
	//Set the fade in effect for the next image, show class has higher z-index
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000);
	//Hide the current image
	current.animate({opacity: 0.0}, 1000)
	.removeClass('show');
	//Set the opacity to 0 and height to 1px
	$('#gallery .scaption').animate({opacity: 0.0}, { queue:false, duration:300 }).animate({height: '1px'}, { queue:true, duration:500 });	
	//Animate the caption, opacity to 0.7 and heigth to 100px, a slide up effect
	$('#sgallery .scaption').animate({opacity: 0.7},100 ).animate({height: '20px'},1500 );
	//Display the content
	$('#sgallery .scontent').html(caption);
}
/* ------------------------ END ------------------------ */

/********************************/
/* 	Header Slider (no caption)	*/
/********************************/
function slideShow2() {
	//Set the opacity of all images to 0
	$('#header-gallery a').css({opacity: 0.0});
	//Get the first image and display it (set it to full opacity)
	$('#header-gallery a:first').css({opacity: 1.0});
	//Set the caption background to semi-transparent
	setInterval('gallery2()',9000);
}

function gallery2() {
	var current = ($('#header-gallery a.show')?  $('#header-gallery a.show') : $('#header-gallery a:first'));
	var next = ((current.next().length) ? ((current.next().hasClass('scaption'))? $('#header-gallery a:first') :current.next()) : $('#header-gallery a:first'));	
	next.css({opacity: 0.0})
	next.fadeIn()
	.addClass('show')
	.animate({opacity: 1.0}, 1700);
	//Hide the current image
	current.animate({opacity: 0.0}, 1600)
	current.fadeOut()
	.removeClass('show');
	//Set the opacity to 0 and height to 1px
}
/* ------------------------ END ------------------------ */

/********************************/
/* Toggle Center				*/
/********************************/
$(document).ready(function(){
	//Hide (Collapse) the toggle containers on load
	$(".gizli_alan").hide(); 
	//Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state)
	$("h5.tepe").click(function(){
		$(this).toggleClass("active").next().slideToggle("slow");
		return false; //Prevent the browser jump to the link anchor
	});
});
/* ------------------------ END ------------------------ */

/********************************/
/* Toggle SideBar				*/
/********************************/
$(document).ready(function(){
	//Hide (Collapse) the toggle containers on load
	$(".gizli_alan").hide(); 
	//Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state)
	$("h2.sideToggle").click(function(){
		$(this).toggleClass("active").next().slideToggle("slow");
		return false; //Prevent the browser jump to the link anchor
	});
});
/* ------------------------ END ------------------------ */
/********************************/
/* Toggle Duyuru				*/
/********************************/
$(document).ready(function(){
	//Hide (Collapse) the toggle containers on load
	$(".post_entry2").hide(); 
	//Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state)
	$("p.post_title2").click(function(){
		//$(this).toggleClass("active");
		$(this).toggleClass("active").next().next().slideToggle("medium");
		return false; //Prevent the browser jump to the link anchor
	});
});
/* ------------------------ END ------------------------ */

/* SIMPLE LIGHTBOX EFFECT */
$(document).ready(function(){
	$("a#show-panel").click(function(){
		$("#lightbox, #lightbox-panel").fadeIn(300);
	})
	$("a#close-panel").click(function(){
		$("#lightbox, #lightbox-panel").fadeOut(300);
	})
})
/* ------------------------ END ------------------------ */

/*
by UmutA
*/
$(document).ready(function(){
	// loading
	var divid = "otofoto";
	var dir = $('#'+divid).attr('rel');
	var url = 'inc_otofotogaleri.php';
	var query = dir;
	var loading = "<p align='center'><img src='images/loader.gif' align='middle' alt='' /></p>";
	//document.getElementById(divid).innerHTML = loading;
	// Succes
	$("#"+divid).load(url, {gdir: query});

});
// sample 

