var initTMR;

$(function(){
	start();
});

function start(){
	$("*").ajaxComplete(function(event,request, settings){
		if(initTMR){
			clearTimeout(initTMR);
		}
		initTMR = setTimeout("init();", 800);
	});
	
	init();
}

function init(){
	$(".ajaxForm").unbind("submit").submit(function(){
		return ajaxForm(this);
	});
	
}

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: 'resim',
		txtOf: '/'
	});
}

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

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");
}