var initTMR;

$(document).ready(function(){
	start();
});

function start(l){
	$.post('sepet.php',
		   {'islem':'update'},
		   function(data) {
			   $("#sbox").html(data);
		   });
	if(l==true) {
		$.post('sepet.php',
		   {'islem':'list'},
		   function(data) {
			   $("#spt").html(data);
		   });
	}
}

function slidegit(i, syle){
	if(!syle){
	 $('#Banners').cycle(i);
	} else {
	 $("#Uruns").cycle(i);
	}
 $("[id^=ban]").css({"background-color":"#edebec","color":"#000000"});
 $("#ban"+i).css({"background-color":"#c71721","color":"#FFFFFF"});
 $("[id^=ar]").css({"display":"none"});
 $("#ar"+i).css({"display":"block"});
 $(".BanTxt").css("opacity","0.6");

}

function login(href) {
		var login = $("#logins").serialize();
		$.post('INC/STR.php', login, function(data) {
					if ( data == 'success') {
							location = href;
					} else {
						LoginErr();
					}
											  });
}

function LoginErr() {
	var options = {};
	$("#error").animate({
				 height: 'toggle',
				 duration: 1000 });
}

function sepet(id) {
	$.post('sepet.php',
		   {'uid':id,'islem':'addbasket'},
		   function(data) {
			   $("#sbox").html(data);
		   });
}

function sBos() {
		$.post('sepet.php',
		   {'islem':'demolish'},
		   function(data) {
			   start(true);
		   });
}
function del(id) {
		$.post('sepet.php',
		   {'uid':id,'islem':'delete'},
		   function(data) {
			   start();
		   });
		$.post('sepet.php',
		   {'islem':'list'},
		   function(data) {
			   $("#spt").html(data);
		   });
}
function sayfaDegis(adres){
	window.location.href = adres;
}

function galeriYap(str){
	$(str).lightBox({
		overlayBgColor: '#000',
		overlayOpacity: 0.7,
		imageLoading: 'JS/jQuery/lightbox/images/lightbox-ico-loading.gif',
		imageBtnClose: 'JS/jQuery/lightbox/images/lightbox-btn-close.gif',
		imageBtnPrev: 'JS/jQuery/lightbox/images/lightbox-btn-prev.gif',
		imageBtnNext: 'JS/jQuery/lightbox/images/lightbox-btn-next.gif',
		containerResizeSpeed: 350 /*,
		txtImage: 'Imagem',
		txtOf: 'de'*/
	});
}

function secAll(me){
	var val = $(me).attr("checked");
	var grup = $(me).attr("grup");
	$("input[grup="+ grup +"]").attr("checked", val);
}

function seCikar(val,e) {
		if (e=='sec') {
			$("input[grup='"+val+"']").attr("checked", "checked");
		} else {
			$("input[grup='"+val+"']").removeAttr("checked");
		}
}
function ajaxDiyalog(adres, options, ajaxOptions){
	$('.dialog-content').css("overflow-x", null).css("overflow-y", null);
	$.weeboxs.open('Lütfen Bekleyiniz...',{
		title: 'Lütfen Bekleyiniz...'
	});
	
	if(ajaxOptions){
		if(ajaxOptions.method == "post"){
			$.post(adres, ajaxOptions, function(data){
				$.weeboxs.close();
				$.weeboxs.open(data, options);
			});
		}else{
			$.get(adres, ajaxOptions, function(data){
				$.weeboxs.close();
				$.weeboxs.open(data, options);
			});
		}
	}else{
		$.get(adres, function(data){
			$.weeboxs.close();
			$.weeboxs.open(data, options);
		});
	}
}

function frameDiyalog(baslik, adres){
	$.weeboxs.open('<iframe width="600" height="500" style="border:0; margin:0px 0px 0px 0px; padding:0px 0px 0px 0px;" scrolling="auto" src="'+ adres +'">',{
		title: baslik,
		width:606
	});
	$('.dialog-content').css("overflow-x", "hidden").css("overflow-y", "hidden");
}