
function showCategGalleryList(page,order,catID ) {	
	catID = typeof(catID) != 'undefined' ? catID : 0;
	order = typeof(order) != 'undefined' ? order : 1;

	preloader.remove("#galleryListing");
	preloader.add("#galleryListing","top");	
	
	//var currentUrl = document.location.href;
	var currentUrl = 'http://www.libertatea.ro/';
	if(currentUrl.indexOf('?')!=-1)
		currentUrl += "&tx_gallery_pi1[showCateg]="+catID+"&tx_gallery_pi1[page]="+page+"&tx_gallery_pi1[order]="+order+"&tx_gallery_pi1[ajaxList]=1&type=6692";
	else 
		currentUrl += "?tx_gallery_pi1[showCateg]="+catID+"&tx_gallery_pi1[page]="+page+"&tx_gallery_pi1[order]="+order+"&tx_gallery_pi1[ajaxList]=1&type=6692";
		
	$.ajax({
		url: currentUrl,
		cache: true,
		type: "GET",
		success: function(html){
			$("#galleryListing").replaceWith(html);			
			/*Media list*/
			if ($(".page-multimediaGallery .list").length) {
				$("#photoGallery-list .list").find(".item:nth-child(4n), .item:last").addClass("last");			
			}
		}
	});
}

function showLatestGallery(showUid) {	
	preloader.remove("#singleGallery");
	preloader.add("#singleGallery");	
	
	//var currentUrl = document.location.href;
	var currentUrl = 'http://www.libertatea.ro/';
	if(currentUrl.indexOf('?')!=-1)
		currentUrl += "&tx_gallery_pi1[showUid]="+showUid+"&tx_gallery_pi1[ajaxSwitch]=1&type=6690";
	else 
		currentUrl += "?tx_gallery_pi1[showUid]="+showUid+"&tx_gallery_pi1[ajaxSwitch]=1&type=6690";
		
	$.ajax({
		url: currentUrl,
		cache: true,
		type: "GET",
		success: function(html){
			$("#singleGallery").replaceWith(html);	
			var offset = $(".content-borderBox").offset();
			$(document).scrollTop(offset.top);
			if(!$.trim($(".media-sliderWrapper .slider-inner").html()).length) $(".media-sliderWrapper").remove();
			//Fix last items
			listlastitem();
			//Slider
			$(".media-single").mediaSlider();
			//Twitter
			$(document).trigger("twitterLoad");			
		}
	});
}

function closeTipForm() {
	var currentUrl = document.location.href;
	$.ajax({
		url: currentUrl,
		cache: true,
		type: "GET",
		success: function() {
			$("#tipafriendlayout").html(' ');
		}
	});
}


function searchGallery(page, order){
	preloader.remove("#galleryListing");
	preloader.add("#galleryListing","top");	

	//var currentUrl = document.location.href;
	var currentUrl = 'http://www.libertatea.ro/';
	if(currentUrl.indexOf('?')!=-1)
		currentUrl += "&tx_gallery_pi1[keyword]="+$('#keyword').val()+"&tx_gallery_pi1[page]="+page+"&tx_gallery_pi1[order]="+order+"&tx_gallery_pi1[ajaxList]=1&type=6692";
	else 
		currentUrl += "?tx_gallery_pi1[keyword]="+$('#keyword').val()+"&tx_gallery_pi1[page]="+page+"&tx_gallery_pi1[order]="+order+"&tx_gallery_pi1[ajaxList]=1&type=6692";
		
	$.ajax({
		url: currentUrl,
		cache: true,
		type: "GET",
		success: function(html){
			$("#galleryListing").replaceWith(html);			
			if ($("#photoGallery-list .tabs").length) $("#photoGallery-list .tabs").hoverTabs();
			if ($(".page-multimediaGallery .list").length) {
				$("#photoGallery-list .list").find(".item:nth-child(4n), .item:last").addClass("last");			
			}
		}
	});
}
