//Cufon
Cufon.replace('#logo');

//Menü
ddsmoothmenu.init({
	mainmenuid: "smoothmenu1", //menu DIV id
	orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
	classname: 'ddsmoothmenu', //class added to menu's outer DIV
	//customtheme: ["#1c5a80", "#18374a"],
	contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
})
/*****/
$(document).ready(function()
{
	$("#menuListe .menuBaslik").click(function()
    {
		$(this).next(".altMenu").slideToggle(300).siblings(".altMenu").slideUp("slow");
	});
});

//Uyegirişi
$(document).ready(function() {
	$('.uyeGirisi').click(function(){
		$('.kayitForm').slideUp();
		$('.uyeForm').slideDown();
	});  
	$('#kapat').click(function(){
		$('.uyeForm').slideUp();
	});
});

//KayıtForm
$(document).ready(function() {
	$('.kayitOl').click(function(){
		$('.uyeForm').slideUp();
		$('.kayitForm').slideDown();
	});  
	$('#kapatt').click(function(){
		$('.kayitForm').slideUp();
	});
});

//BannerSlider
$(document).ready( function(){	
	var buttons = { 
		previous:$('#bannerSlider .geri'),	
		next:$('#bannerSlider .ileri')
	};
					
	$obj = $('#bannerSlider').lofJSidernews( { 
		interval 		: 4000,
		direction		: 'opacitys',	
		easing			: 'easeInOutExpo',
		duration		: 1200,
		auto		 	: true,
		maxItemDisplay  : 3,
		navPosition     : 'horizontal', // horizontal
		navigatorHeight : 45,
		navigatorWidth  : 47,
		mainWidth		: 700,
		buttons			: buttons} );	
});

//form stil
$(function(){
	$('#detayform').jqTransform({imgPath:'css/img/'});
});

//DetaySlider
$(function() {
    $(".anyClass").jCarouselLite({
        btnNext: ".next, .nextsmall",
        btnPrev: ".prev, .prevsmall"
    });
});

//Colorbox
$(document).ready(function(){
	$(".resimDetay").colorbox();
});

//Formlar
function kayit() {
    $.ajax({
        type: "POST",
        url: "sayfalar.php?Sayfa=Kayit",
        data: $('form#kayitform').serialize(),
        success: function(kayitcevap){
            $('.kayitsonuc').html(kayitcevap);  
        }
    });
}

function giris() {
    $.ajax({
        type: "POST",
        url: "sayfalar.php?Sayfa=Giris",
        data: $('form#girisform').serialize(),
        success: function(giriscevap){
            $('.girissonuc').html(giriscevap);  
        }
    });
}

function email() {
    $.ajax({
        type: "POST",
        url: "sayfalar.php?Sayfa=Email",
        data: $('form#emailform').serialize(),
        success: function(emailcevap){
            $('.emailsonuc').show();

            $('.emailsonuc').html(emailcevap);  
            
            setTimeout(function() {  
                    $('.emailsonuc').hide('slow');
            }, 6000); 
        }
    });
}

function sepet() {
    $.ajax({
        type: "POST",
        url: "sayfalar.php?Sayfa=SepetOnay",
        data: $('form#sepetform').serialize(),
        success: function(sepetcevap){
            $('.sepetsonuc').html(sepetcevap);  
        }
    });
}

function uyeGuncelle() {
    $.ajax({
        type: "POST",
        url: "sayfalar.php?Sayfa=UyeGuncelle",
        data: $('form#uyeguncelleform').serialize(),
        success: function(uyeguncellecevap){
            $('.uyeguncellesonuc').html(uyeguncellecevap);  
        }
    });
}

//modal
$(document).ready(function() {	
	//select all the a tag with name equal to modal
	$('a[name=modal]').click(function(e) {
		//Cancel the link behavior
		e.preventDefault();
		
		//Get the A tag
		var id = $(this).attr('href');
	
		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		//Set heigth and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		
		//transition effect		
		$('#mask').fadeIn(1000);	
		$('#mask').fadeTo("slow",0.8);	
	
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
              
		//Set the popup window to center
		$(id).css('top',  winH/2-$(id).height()/2);
		$(id).css('left', winW/2-$(id).width()/2);
	
		//transition effect
		$(id).fadeIn(2000); 
	
	});
	
	//if close button is clicked
	$('.window .close').click(function (e) {
		//Cancel the link behavior
		e.preventDefault();
		
		$('#mask').hide();
		$('.window').hide();
	});		
	
	//if mask is clicked
	$('#mask').click(function () {
		$(this).hide();
		$('.window').hide();
	});			
	
});

