function customLoadPiece(href, divName, divPaging, divLoader) {
   		$.ajaxSetup({cache:false});
       	$("." + divLoader).html(showLoaderHtml());
   	    $(divName).load(href, {}, function(){
   	       	$("." + divLoader).html('');
   	        var divPaginationLinks = divName+" ." + divPaging +" a";
   	        $(divPaginationLinks).click(function() {
   	            var thisHref = $(this).attr("href");
   	            customLoadPiece(thisHref, divName, divPaging, divLoader);
   	            return false;
   	        });
   	    });
}
function customPreLoadPiece(href, divName, divPaging, divLoader) {
       var divPaginationLinks = divName+" ." + divPaging +" a";
       $(divPaginationLinks).click(function() {
         var thisHref = $(this).attr("href");
           customLoadPiece(thisHref, divName, divPaging, divLoader);
           return false;
       });
}
/*
This allows you to post data to the AJAX URL
*/
function customLoadPiecePostdata(href, divName, divPaging, divLoader,data) {
           $.ajaxSetup({cache:false});
           $("." + divLoader).html(showLoaderHtml());
           $.post(href,data,function(result) {
               $(divName).html(result);
               $("." + divLoader).html('');
               var divPaginationLinks = divName+" ." + divPaging +" a";
               $(divPaginationLinks).click(function() {
                   var thisHref = $(this).attr("href");
                   customLoadPiecePostdata(thisHref, divName, divPaging, divLoader,data);
                   return false;
               });
           });
}

function customPreLoadPiecePostdata(href, divName, divPaging, divLoader,data) {
       var divPaginationLinks = divName+" ." + divPaging +" a";
       $(divPaginationLinks).click(function() {
         var thisHref = $(this).attr("href");
           customLoadPiecePostdata(thisHref, divName, divPaging, divLoader,data);
           return false;
       });
}




function showLoaderHtml() {
	return '<img src="/img/ajax_loader_m.gif" /> Loading...';
}

function showNextLoading() {
	return '<img src="/img/ajax_loader_m_green.gif" style="margin-top:10px;margin-left:15px;"/>';
}
function showPrevLoading() {
	return '<img src="/img/ajax_loader_m.gif" style="margin-top:10px;margin-left:15px;"/>';
}

jQuery.fn.extend({
    scrollBottom: function(speed, sdvig) {
		return this.each(function() {
            var targetOffset = $(this).offset().top + $(this).height() + sdvig*1;
            $('html').animate({scrollTop: targetOffset - $(window).height()}, speed);
            });
        }
});
function redirect(newUrl) {
	   window.document.location.href = newUrl;
}
function makeRadioTabs (radioClass, checkedID, showDiv) {
	$('.'+ showDiv).hide();
	$("." + radioClass).click(function() {
		$("." + radioClass).next('span').removeClass('radioChecked');
		$(this).next('span').addClass('radioChecked');
			$('.'+ showDiv).hide();
			$('#'+ showDiv + '_' + $(this).val()).show();
	});
	$('#' + checkedID).click();
	return true;
}

