/*	Bu .js dosyası Tayfun Erbilen tarafından kodlanmıştır. */

(function($){
 $.fn.extend({
 
 	customStyle : function(options) {
	  if(!$.browser.msie || ($.browser.msie&&$.browser.version>6)){
	  return this.each(function() {
	  
			var currentSelected = $(this).find(':selected');
			$(this).after('<span class="acilir_menu"><span class="customStyleSelectBoxInner">'+currentSelected.text()+'</span></span>').css({position:'absolute', opacity:0,fontSize:$(this).next().css('font-size')});
			var selectBoxSpan = $(this).next();
			var selectBoxWidth = parseInt($(this).width()) - parseInt(selectBoxSpan.css('padding-left')) -parseInt(selectBoxSpan.css('padding-right'));			
			var selectBoxSpanInner = selectBoxSpan.find(':first-child');
			selectBoxSpan.css({display:'inline-block'});
			selectBoxSpanInner.css({width:selectBoxWidth, display:'inline-block'});
			var selectBoxHeight = parseInt(selectBoxSpan.height()) + parseInt(selectBoxSpan.css('padding-top')) + parseInt(selectBoxSpan.css('padding-bottom'));
			$(this).height(selectBoxHeight).change(function(){
				// selectBoxSpanInner.text($(this).val()).parent().addClass('changed');   This was not ideal
			selectBoxSpanInner.text($(this).find(':selected').text()).parent().addClass('changed');
				// Thanks to Juarez Filho & PaddyMurphy
			});
			
	  });
	  }
	}
 });
})(jQuery);

$(document).ready(function(){

	/* Kontrol Paneli Açılır Menü */
	$("#kpaneli_menu li a:first").css("border-left","none");
	$("#kpaneli_acilan li.profil").click(function(){
		$(this).toggleClass("aktif");
	});
	
	$(".menu_sag span a").tipsy({gravity: 's'});
	
	$('.scroll-pane').jScrollPane({
			horizontalDragMinWidth: 112,
			horizontalDragMaxWidth: 112
	});
	
	/* Slider */
	$("#slider_resimler li").hide();
	$("#slider_resimler li:first").show();
	var toplam_resim = $("#slider_resimler li").length;
	for (i = 1; i<=toplam_resim; i++){
		$("#slider_buton").append("<li><a href='javascript:void(0)'>"+i+"</a></li>");
	}
	$("#slider_buton li:first").addClass("aktif");
	$("#slider_buton li").click(function(){
		var a = $(this).index();
		$("#slider_buton li").removeClass("aktif");
		$(this).addClass("aktif");
		$("#slider_resimler li").hide();
		$("#slider_resimler li:eq("+a+")").fadeIn();
	});
	var sayi = 1;
	$("#slider_ok li:eq(0)").click(function(){
		if (sayi < 5){
		var a = sayi++;
		$("#slider_resimler li").hide();
		$("#slider_resimler li:eq("+a+")").fadeIn();
		$("#slider_buton li").removeClass("aktif");
		$("#slider_buton li:eq("+a+")").addClass("aktif");
		}
	});
	$("#slider_ok li:eq(1)").click(function(){
		if (sayi > 0){
		var b = --sayi;
		$("#slider_resimler li").hide();
		$("#slider_resimler li:eq("+b+")").fadeIn();
		$("#slider_buton li").removeClass("aktif");
		$("#slider_buton li:eq("+b+")").addClass("aktif");
		}
	});
	
	/* Menü Cufon */
	Cufon.replace("#menu_sol", {textShadow: "1px 1px #fff", hover: true});
	$("#menu_sol li a:last").css("background","none");

	/* Kategoriler Menü */
	$("#kategoriler li ul").hide();
	$("#kategoriler li.e").click(function(){
		var a = $(this).index();
		$("#kategoriler li").removeClass("aktif");
		$(this).addClass("aktif");
		$("#kategoriler li ul").slideUp();
		$("#kategoriler li.e:eq("+a+") a").next("ul").slideDown();
	});
	
	$(".sepet_tablo ul li:last").css("border-bottom","none");
	
	$("#tab li:first").addClass("aktif");
	$(".tab_ic").hide();
	$(".tab_ic:first").show();
	$("#tab li").click(function(){
		$("#tab li").removeClass("aktif");
		$(this).addClass("aktif");
		var a = $(this).index();
		$(".tab_ic").hide();
		$(".tab_ic:eq("+a+")").show();
	});
	
	$("#onceki_siparisler li.os_ic").hide();
	$("#onceki_siparisler li").click(function(){
		$(this).next().slideToggle();
	});
	
	$(".arama_select").customStyle();
	$(".h_select").customStyle();
	$(".kps_select").customStyle();
	$(".kps_select2").customStyle();
	$(".kps_select3").customStyle();
	$(".kps_select4").customStyle();
	$(".olcu").customStyle();
	$(".form_select").customStyle();
	$(".tab_select2").customStyle();
	$(".select_sbs").customStyle();
	
});
