function initializeFancyBoxImages()
{
	jQuery("a.fancyBoxImage").fancybox({
		'zoomSpeedIn':	500,
		'zoomSpeedOut':	300,
		'overlayShow':	true,
		'hideOnContentClick': true
	});
}

function v()
{
	void(null);
}

function popup(mylink, windowname, width, height){
	if (!window.focus) {
		return true;
	}
	var href;
	if (typeof(mylink) == 'string') {
		href = mylink;
	} else {
	   href=mylink.href;
	}
	window.open(href, windowname, 'width='+width+',height='+height+',scrollbars=yes');
	return false;
}

function submitForm(sFormName)
{
	jQuery('#' + sFormName + 'Submit').hide();
	jQuery('#' + sFormName).submit();
}

function setActiveAddEverthingLink(sLinkName) 
{
	var divShowMore = jQuery(".boxAllEverythingAll .showMore");
	jQuery(divShowMore).html(sLinkName);
}

function SetAllCheckBoxes(FormName, FieldName, CheckValue)
{
	if(!document.forms[FormName])
		return;
	var objCheckBoxes = document.forms[FormName].elements[FieldName];
	if(!objCheckBoxes)
		return;
	var countCheckBoxes = objCheckBoxes.length;
	if(!countCheckBoxes)
		objCheckBoxes.checked = CheckValue;
	else
		// set the check value for all check boxes
		for(var i = 0; i < countCheckBoxes; i++)
			objCheckBoxes[i].checked = CheckValue;
}


/*** toggle UserMenu***/
var bUserMenuShow = false;
function toggleUserMenu()
{
	var hrefToggleText = jQuery("#toggleUserMenu");
	var divUserMenu = jQuery("#userMenu");

	var aTexts = new Array('pokaż', 'ukryj');
	var iText = 0;
	if (!bUserMenuShow) { 
		iText = 0;
		divUserMenu.hide(20);
	} else {
		iText = 1;
		divUserMenu.show(20);
	}
	
	jQuery(hrefToggleText).html(aTexts[iText]);
	bUserMenuShow = !bUserMenuShow;
}

/*** JQUERY ***/
jQuery.noConflict();
jQuery(document).ready(function() {
	externalLinks();
	if (jQuery("div.boxSmallGalleryAll").length > 0) { // sprawdzanie czy jest taki div - zeby nioe bylo bledow
		getSmallGallery(); // small gallery na prawa strone
	}
	if (jQuery("div.boxYoutubeAll").length > 0) { // sprawdzanie czy jest taki div - zeby nioe bylo bledow
		getRightYoutube(); // youtube na prawo
	}
	if (jQuery("div#userMenu").length > 0) { // sprawdzanie czy jest taki div - zeby nioe bylo bledow
		toggleUserMenu(!bUserMenuShow); //  menu usera
	}

	/*** FANCY BOX ***/
	initializeFancyBoxImages();
});


/*** SMALL GALLERY ***/

var iLastSmallGalleryId = 0;
function getSmallGallery(iSmallGalleryId)
{
	iSmallGalleryId = (iSmallGalleryId) ? iSmallGalleryId : 0;
	if (iSmallGalleryId) {
		var divSmallGallery = jQuery( "div.galleryAjaxLoad");
	} else {
		var divSmallGallery = jQuery( "div.galleryAjaxLoadList");
	}
	jQuery.ajax({
		method: "get",url: "ajax/getSmallGallery.php",data: "iSmallGalleryId=" + iSmallGalleryId + "&random=" + Math.random(),
			beforeSend: function(){
				var divPicture = jQuery(".boxSmallGallery .galleryPicture");
				jQuery(divPicture).css('background-image','url()');
				toggleSmallGalleryNavigation(true);
			}, //show loading just when link is clicked
//			complete: function(){ jQuery("#loading").hide("fast");}, //stop showing loading when the process is complete
		success: function(html){ //so, if data is retrieved, store it in html
//				jQuery(".content").show("slow"); //animation
				jQuery(divSmallGallery).html(html); //show the html inside .content div
			toggleSmallGalleryCurrentLink();
			changeSmallGalleryPicture(iCurrentSmallGalleryPicture, false);
//			alert(iMaxSmallGalleryPicture);
			if (iMaxSmallGalleryPicture > 1) {// jak jest wiecej niz jedno zdjęcie
				toggleSmallGalleryNavigation(false);
			}
		}
	}); //close jQuery.ajax(
}

function changeSmallGalleryPicture(iCurrentPicture, bPrev)
{
//	alert('iCurrentPicture: ' +iCurrentPicture);

	iNewPicture = 0;
	if (bPrev) {
		iNewPicture = ((iCurrentPicture - 1) == -1) ? iMaxSmallGalleryPicture - 1 : iCurrentPicture - 1;
	} else {
		iNewPicture = ((iCurrentPicture + 1) >= iMaxSmallGalleryPicture) ? 0 : iCurrentPicture+1;
	}
	var divPicture = jQuery(".boxSmallGallery .galleryPicture");
	jQuery(divPicture).css('background-image','url(' + sPathToSmallGallery + aSmallGallery[iNewPicture] + ')');

	var spanCounter = jQuery("#smallGalleryCounter");
	jQuery(spanCounter).html((iNewPicture+1) + ' z ' + iMaxSmallGalleryPicture);

	iCurrentSmallGalleryPicture = iNewPicture;
//	alert('iNewPicture:: ' + iNewPicture);
}

function toggleSmallGalleryCurrentLink()
{

	var hrefLastCategory = jQuery("#smallGalleryLink_" + iLastSmallGalleryId);
	jQuery(hrefLastCategory).removeClass("linkActive");

	var hrefCurrentCategory = jQuery("#smallGalleryLink_" + iCurrentSmallGallery);
	jQuery(hrefCurrentCategory).addClass("linkActive");

	iLastSmallGalleryId = iCurrentSmallGallery;
}

function toggleSmallGalleryNavigation(bHide)
{
	var sState = (bHide) ? 'hidden' : 'visible';
	var aPrev = jQuery(".galleryPicture .prev");
	jQuery(aPrev).css('visibility', sState);

	var aNext = jQuery(".galleryPicture .next");
	jQuery(aNext).css('visibility', sState);
}

function showMoreSmallGalleries()
{
	var divMoreSG = jQuery(".moreSmallGalleries");
	jQuery(divMoreSG).show();

	var hrefMoreSG = jQuery(".moreSmallGalleriesHref");
	jQuery(hrefMoreSG).hide();
}

/*** END SMALL GALLERY ***/

/*** CONTESTS GALLERIES ***/

function getContestsGalleries(sTargetDiv, iPage, sSearchKey, iSearchValue) // target div, strona, czego mo szukac, id tego szukania
{
	var divContestsGalleries = jQuery('.' + sTargetDiv);
	jQuery.ajax({
		method: "get",url: "ajax/contestsGalleries/getContestsGalleries.php",data: "page=" + iPage + "&key=" + sSearchKey + "&value=" + iSearchValue + "&sTarget=" + sTargetDiv + "&random=" + Math.random(),
		beforeSend: function(){
			showHidePreloader(sTargetDiv);
		}, // show loading just when link is clicked
//			complete: function(){ jQuery("#loading").hide("fast");}, //stop showing loading when the process is complete
		success: function(html) { //so, if data is retrieved, store it in html
			showHidePreloader(sTargetDiv, true);
			jQuery(divContestsGalleries).html(html); // show the html inside .content div
			initializeFancyBoxImages();
		}
	}); //close jQuery.ajax(
}

/*** RIGHT YOUTUBE ***/

function getRightYoutube()
{
	var divRightYoutube = jQuery( "div.youtubeListAll");
//	var divRightYoutube = jQuery( "div#footer");
	jQuery.ajax({
		method: "get",url: "ajax/getRightYoutube.php",data: "onlyYoutube=" + "true" + "&random=" + Math.random(),
		beforeSend: function(){

		},
//			complete: function(){ jQuery("#loading").hide("fast");}, //stop showing loading when the process is complete
	success: function(html){ //so, if data is retrieved, store it in html
		jQuery(divRightYoutube).html(html); //show the html inside .content div
		changeRightYoutubeList(false);
		}
	}); //close jQuery.ajax(
}

function changeRightYoutubeList(bPrev)
{
	iNewList = 0;
	if (bPrev) {
		iNewList = ((iCurrentYoutubeList - 1) == -1) ? 0 : iCurrentYoutubeList - 1;
	} else {
		iNewList = ((iCurrentYoutubeList + 1) >= iMaxYoutubeList - 1) ? iMaxYoutubeList - 1 : iCurrentYoutubeList + 1;
	}

	var divLastList = jQuery("#youtubeList_" + iCurrentYoutubeList);
	jQuery(divLastList).hide();

	var divList = jQuery("#youtubeList_" + iNewList);
	jQuery(divList).show();

	iCurrentYoutubeList = iNewList;

//	alert(iNewList);
}

function changeRightYoutubeVideo(iYoutubeId)
{
	var divVideo = jQuery(".youtubeVideo");
	var iVideoLink = aRightYoutubes[iYoutubeId];

	jQuery(divVideo).html('<object type="application/x-shockwave-flash" width="290" height="235" data="http://www.youtube.com/v/' + iVideoLink + '"><param name="movie" value="http://www.youtube.com/v/' + iVideoLink + '" /><param name="wmode" value="transparent" /></object>');

	var divYoutubeName = jQuery(".boxYoutube .youtubeName");
	jQuery(divYoutubeName).html(aRightYoutubesNames[iYoutubeId]);

	//var divGalleryDesc = jQuery(".boxYoutube .youtubeDesc");
	//jQuery(divGalleryDesc).html('{$aRightYoutubes.smallGalleryDesc}');

}

function showRightYoutubeNavigation()
{
	var aPrev = jQuery(".youtubeBottom .prev");
	jQuery(aPrev).css('visibility','visible');

	var aNext = jQuery(".youtubeBottom .next");
	jQuery(aNext).css('visibility','visible');

}

/*** NEW USERS ***/

function getUsers(sTargetDiv, iPage, sSearchKey , iSearchValue, iType) // target div, strona, czego mo szukac, id tego szukania, typ ludzia
{
	sSearchKey = (sSearchKey != undefined) ? sSearchKey : '';
	iSearchValue = (iSearchValue != undefined) ? iSearchValue : '';
	iType = (iType != undefined) ? iType : 0;
	var bDefaultSection = (sTargetDiv == 'newUsers') ? true : false; // jak jest taki div to inna ilosc na 1 strone

	var divSmallGallery = jQuery('.' + sTargetDiv);
	jQuery.ajax({
		method: "get",url: "ajax/users/getUsers.php", data: "page=" + iPage + "&key=" + sSearchKey + "&value=" + iSearchValue + "&defaultSection=" + bDefaultSection + "&type=" + iType + "&random=" + Math.random(),
		beforeSend: function(){
			showHideNewUsersPreloader();
		}, //show loading just when link is clicked
//			complete: function(){ jQuery("#loading").hide("fast");}, //stop showing loading when the process is complete
		success: function(html){ //so, if data is retrieved, store it in html
			showHideNewUsersPreloader(true);
			jQuery(divSmallGallery).html(html); //show the html inside .content div
		}
	}); //close jQuery.ajax(
}

function showHideNewUsersPreloader(bHide)
{
	if (bHide == 'undefined') {
		bHide = false;
	}

	var iDivContentHeight = jQuery("div.newUsers").height();
//		alert('iDivContentHeight: ' + iDivContentHeight);
	var divPreloader = jQuery( "div.preloaderApla");
	jQuery(divPreloader).height(iDivContentHeight);
	if (!bHide) {
		jQuery(divPreloader).show();
	} else {
		jQuery(divPreloader).hide();
	}
}

/*** TEAM USERS ***/

function getTeamUsers(sTargetDiv, iPage, sSearchKey , iSearchValue, iType) // target div, strona, czego mo szukac, id tego szukania, typ ludzia
{
//	sSearchKey = (sSearchKey != undefined) ? sSearchKey : '';
//	iSearchValue = (iSearchValue != undefined) ? iSearchValue : '';
	iType = (iType != undefined) ? iType : 0;
//	alert('iPage: ' + iPage);
	var divSmallGallery = jQuery('.' + sTargetDiv);
	jQuery.ajax({
		method: "get",url: "ajax/users/getTeamUsers.php", data: "page=" + iPage + "&key=" + sSearchKey + "&value=" + iSearchValue + "&type=" + iType + "&random=" + Math.random(),
		beforeSend: function(){
			showHidePreloader(sTargetDiv);
		}, //show loading just when link is clicked
//			complete: function(){ jQuery("#loading").hide("fast");}, //stop showing loading when the process is complete
		success: function(html){ //so, if data is retrieved, store it in html
			showHidePreloader(sTargetDiv,true);
			jQuery(divSmallGallery).html(html); //show the html inside .content div
		}
	}); //close jQuery.ajax(
}

function showHidePreloader(sTargetDiv, bHide)
{
	if (bHide == 'undefined') {
		bHide = false;
	}
	var iDivContentHeight = jQuery('div.' + sTargetDiv).height();
	var divPreloader = jQuery('div.preloaderApla_' + sTargetDiv);
	jQuery(divPreloader).height(iDivContentHeight);
	if (!bHide) {
		jQuery(divPreloader).show();
	} else {
		jQuery(divPreloader).hide();
	}
}

/*** COMMENTS ***/

function getComments(sTargetDiv, iPage, sSearchKey, iSearchValue) // target div, strona, czego mo szukac, id tego szukania
{
	var divComments = jQuery('.' + sTargetDiv);
	jQuery.ajax({
		method: "get",
		url: "ajax/comments/getComments.php",
		data: "page=" + iPage + "&key=" + sSearchKey + "&value=" + iSearchValue + "&random=" + Math.random(),
		beforeSend: function(){
			showHidePreloader(sTargetDiv);
		},
		success: function(html) {
			showHidePreloader(sTargetDiv,true);
			jQuery(divComments).html(html);
		}
	}); //close jQuery.ajax(
}

/*** END COMMENTS ***/

/*** PICTURES ***/

function getPictures(sTargetDiv, iPage, sSearchKey, iSearchValue, sTable, iForceLimit) // target div, strona, czego mo szukac, id tego szukania, tabela , limit
{
	sTable = (sTable != undefined) ? sTable : '';
	iForceLimit = (iForceLimit != undefined) ? iForceLimit : '';
	var bDefaultSection = (sTargetDiv == 'newUsersPicturesList') ? true : false; // jak jest taki div to inna ilosc na 1 strone
	var divPictures = jQuery('.' + sTargetDiv);
	jQuery.ajax({
		method: "get",url: "ajax/pictures/getPictures.php",data: "page=" + iPage + "&key=" + sSearchKey + "&value=" + iSearchValue + "&defaultSection=" + bDefaultSection + "&sTable=" + sTable + "&sTarget=" + sTargetDiv + "&iForceLimit=" + iForceLimit + "&random=" + Math.random(),
		beforeSend: function(){
			showHidePreloader(sTargetDiv);
		}, // show loading just when link is clicked
//			complete: function(){ jQuery("#loading").hide("fast");}, //stop showing loading when the process is complete
		success: function(html) { //so, if data is retrieved, store it in html
			showHidePreloader(sTargetDiv,true);
			jQuery(divPictures).html(html); // show the html inside .content div
			initializeFancyBoxImages();
		}

	}); //close jQuery.ajax(
}


/*** ARTICLES ***/

function getArticles(sTargetDiv, iPage, sSearchKey, iSearchValue, iMax) // target div, strona, czego mo szukac, id tego szukania, max
{
	if (iMax == undefined) { iLimit = 0; }
	var divArticles = jQuery('.' + sTargetDiv);
	jQuery.ajax({
		method: "get",url: "ajax/articles/getArticles.php",data: "page=" + iPage + "&key=" + sSearchKey + "&value=" + iSearchValue + "&sTarget=" + sTargetDiv + "&iMax=" + iMax + "&random=" + Math.random(),
		beforeSend: function(){
			showHidePreloader(sTargetDiv);
		}, // show loading just when link is clicked
//			complete: function(){ jQuery("#loading").hide("fast");}, //stop showing loading when the process is complete
		success: function(html) { //so, if data is retrieved, store it in html
			showHidePreloader(sTargetDiv,true);
			jQuery(divArticles).html(html); // show the html inside .content div
			initializeFancyBoxImages();
		}
	}); //close jQuery.ajax(
}

/*** HUMOR ***/

function getHumors(sTargetDiv, iPage, sSearchKey, iSearchValue) // target div, strona, czego mo szukac, id tego szukania
{
	var divHumors = jQuery('.' + sTargetDiv);
	jQuery.ajax({
		method: "get",url: "ajax/humors/getHumors.php",data: "page=" + iPage + "&key=" + sSearchKey + "&value=" + iSearchValue + "&sTarget=" + sTargetDiv + "&random=" + Math.random(),
		beforeSend: function(){
			showHidePreloader(sTargetDiv);
		}, // show loading just when link is clicked
//			complete: function(){ jQuery("#loading").hide("fast");}, //stop showing loading when the process is complete
		success: function(html) { //so, if data is retrieved, store it in html
			showHidePreloader(sTargetDiv,true);
			jQuery(divHumors).html(html); // show the html inside .content div
			initializeFancyBoxImages();
		}
	}); //close jQuery.ajax(
}

function toggleHumorYotube(iHumorId)
{
	sHrefHtml = (jQuery("#oneHumorYoutubeHref_" + iHumorId).html() == 'pokaz') ? 'ukryj' : 'pokaz';
	jQuery("#oneHumorYoutubeHref_" + iHumorId).html(sHrefHtml);
	jQuery("#oneHumorYoutube_" + iHumorId).toggle();
}


/*** BLOG ***/

function getBlog(sTargetDiv, iPage, sSearchKey, iSearchValue) // target div, strona, czego mo szukac, id tego szukania
{
	var divBlog = jQuery('.' + sTargetDiv);
	jQuery.ajax({
		method: "get",url: "ajax/blog/getBlog.php",data: "page=" + iPage + "&key=" + sSearchKey + "&value=" + iSearchValue + "&sTarget=" + sTargetDiv + "&random=" + Math.random(),
		beforeSend: function(){
			showHidePreloader(sTargetDiv);
		}, 
		success: function(html) {
			showHidePreloader(sTargetDiv,true);
			jQuery(divBlog).html(html);
			initializeFancyBoxImages();
		}
	}); //close jQuery.ajax(
}

/*** RIGHT RATINGS ***/

var iCurrentRightRating = -1;
function showRightRatings(iId) {
	var divRightRatingOld = jQuery("#rightRankingsContent_" + iCurrentRightRating); 
	var divRightRatingHrefOld = jQuery("#rightRankingsHref_" + iCurrentRightRating); 
	
	if (divRightRatingHrefOld) {
		jQuery(divRightRatingOld).hide();	
		jQuery(divRightRatingHrefOld).removeClass("active");
	}
	var divRightRating = ("#rightRankingsContent_" + iId); 
	var divRightRatingHref = ("#rightRankingsHref_" + iId); 
	jQuery(divRightRating).show();
	jQuery(divRightRatingHref).addClass("active");
	iCurrentRightRating = iId;
	return false;
}


/*** TABS ***/
 
function showTabContent(sContent, iTabId, iId) 
{
	var divTabOld = jQuery("#" + sContent + "_" + iTabId); 
	var divTabHrefOld = jQuery("#" + sContent + "Href_" + iTabId); 
	
	if (divTabHrefOld) {
		jQuery(divTabOld).hide();	
		jQuery(divTabHrefOld).removeClass("active");
	}
	var divTab = jQuery("#" + sContent + "_" + iId); 
	var divTabHref = jQuery("#" + sContent + "Href_" + iId); 
	jQuery(divTab).show();
	jQuery(divTabHref).addClass("active");
	iTabSkaut = iId;
	return false;
}


/*** FANCLUBS ***/

function getFanClubs(sTargetDiv, iPage, sSearchKey, iSearchValue) // target div, strona, czego mo szukac, id tego szukania
{
	var divFanClubs = jQuery('.' + sTargetDiv);
	var bDefaultSection = (sTargetDiv == 'newFanclubs') ? true : false; // jak jest taki div to inna ilosc na 1 strone
	jQuery.ajax({
		method: "get",url: "ajax/fanclubs/getFanClubs.php",data: "page=" + iPage + "&key=" + sSearchKey + "&value=" + iSearchValue + "&defaultSection=" + bDefaultSection + "&sTarget=" + sTargetDiv + "&random=" + Math.random(),
		beforeSend: function(){
			showHidePreloader(sTargetDiv);
		}, // show loading just when link is clicked
//			complete: function(){ jQuery("#loading").hide("fast");}, //stop showing loading when the process is complete
		success: function(html) { //so, if data is retrieved, store it in html
			showHidePreloader(sTargetDiv,true);
			jQuery(divFanClubs).html(html); // show the html inside .content div
			initializeFancyBoxImages();
		}
	}); //close jQuery.ajax(
}

/*** FANLUB USERS / and otherz***/

function getFanclubUsers(sTargetDiv, iPage, sSearchKey , iSearchValue, sTable) // target div, strona, czego mo szukac, id tego szukania, typ ludzia
{
//	sSearchKey = (sSearchKey != undefined) ? sSearchKey : '';
//	iSearchValue = (iSearchValue != undefined) ? iSearchValue : '';
	sTable = (sTable != undefined) ? sTable : 'users';
	
//	alert('iPage: ' + iPage);
	var divSmallGallery = jQuery('.' + sTargetDiv);
	jQuery.ajax({
		method: "get",url: "ajax/users/getFanclubUsers.php", data: "page=" + iPage + "&key=" + sSearchKey + "&value=" + iSearchValue + "&table=" + sTable + "&sTarget=" + sTargetDiv + "&random=" + Math.random(),
		beforeSend: function(){
			showHidePreloader(sTargetDiv);
		}, //show loading just when link is clicked
//			complete: function(){ jQuery("#loading").hide("fast");}, //stop showing loading when the process is complete
		success: function(html){ //so, if data is retrieved, store it in html
			showHidePreloader(sTargetDiv,true);
			jQuery(divSmallGallery).html(html); //show the html inside .content div
		}
	}); //close jQuery.ajax(
}

/*** EVENTS ***/

function getEvents(sTargetDiv, iPage, sSearchKey, iSearchValue) // target div, strona, czego mo szukac, id tego szukania
{
	var divEvents = jQuery('.' + sTargetDiv);
	jQuery.ajax({
		method: "get",url: "ajax/events/getEvents.php",data: "page=" + iPage + "&key=" + sSearchKey + "&value=" + iSearchValue + "&sTarget=" + sTargetDiv + "&random=" + Math.random(),
		beforeSend: function(){
			showHidePreloader(sTargetDiv);
		}, // show loading just when link is clicked
//			complete: function(){ jQuery("#loading").hide("fast");}, //stop showing loading when the process is complete
		success: function(html) { //so, if data is retrieved, store it in html
			showHidePreloader(sTargetDiv,true);
			jQuery(divEvents).html(html); // show the html inside .content div
			initializeFancyBoxImages();
		}
	}); //close jQuery.ajax(
}

/*** BLOGS ***/

function getBlogs(sTargetDiv, iPage, sSearchKey, iSearchValue) // target div, strona, czego mo szukac, id tego szukania
{
	var divBlogs = jQuery('.' + sTargetDiv);
	jQuery.ajax({
		method: "get",url: "ajax/blogs/getBlogs.php",data: "page=" + iPage + "&key=" + sSearchKey + "&value=" + iSearchValue + "&sTarget=" + sTargetDiv + "&random=" + Math.random(),
		beforeSend: function(){
			showHidePreloader(sTargetDiv);
		}, // show loading just when link is clicked
//			complete: function(){ jQuery("#loading").hide("fast");}, //stop showing loading when the process is complete
		success: function(html) { //so, if data is retrieved, store it in html
			showHidePreloader(sTargetDiv,true);
			jQuery(divBlogs).html(html); // show the html inside .content div
			initializeFancyBoxImages();
		}
	}); //close jQuery.ajax(
}

/*** EVENTS USERS / and otherz***/

function getEventUsers(sTargetDiv, iPage, sSearchKey , iSearchValue, sTable) // target div, strona, czego mo szukac, id tego szukania, typ ludzia
{
//	sSearchKey = (sSearchKey != undefined) ? sSearchKey : '';
//	iSearchValue = (iSearchValue != undefined) ? iSearchValue : '';
	sTable = (sTable != undefined) ? sTable : 'users';
	
//	alert('iPage: ' + iPage);
	var divSmallGallery = jQuery('.' + sTargetDiv);
	jQuery.ajax({
		method: "get",url: "ajax/users/getEventUsers.php", data: "page=" + iPage + "&key=" + sSearchKey + "&value=" + iSearchValue + "&table=" + sTable + "&sTarget=" + sTargetDiv + "&random=" + Math.random(),
		beforeSend: function(){
			showHidePreloader(sTargetDiv);
		}, //show loading just when link is clicked
//			complete: function(){ jQuery("#loading").hide("fast");}, //stop showing loading when the process is complete
		success: function(html){ //so, if data is retrieved, store it in html
			showHidePreloader(sTargetDiv,true);
			jQuery(divSmallGallery).html(html); //show the html inside .content div
		}
	}); //close jQuery.ajax(
}




/*** SKAUTS ***/

function getSkauts(sTargetDiv, iPage, sSearchKey, iSearchValue) // target div, strona, czego mo szukac, id tego szukania
{
	var divSkauts = jQuery('.' + sTargetDiv);
	jQuery.ajax({
		method: "get",url: "ajax/skauts/getSkauts.php",data: "page=" + iPage + "&key=" + sSearchKey + "&value=" + iSearchValue + "&sTarget=" + sTargetDiv + "&random=" + Math.random(),
		beforeSend: function(){
			showHidePreloader(sTargetDiv);
		}, // show loading just when link is clicked
//			complete: function(){ jQuery("#loading").hide("fast");}, //stop showing loading when the process is complete
		success: function(html) { //so, if data is retrieved, store it in html
			showHidePreloader(sTargetDiv,true);
			jQuery(divSkauts).html(html); // show the html inside .content div
			initializeFancyBoxImages();
		}
	}); //close jQuery.ajax(
}


/*** ADVICES ***/

function getAdvices(sTargetDiv, iPage, sSearchKey, iSearchValue) // target div, strona, czego mo szukac, id tego szukania
{
	var divAdvices = jQuery('.' + sTargetDiv);
	jQuery.ajax({
		method: "get",url: "ajax/advices/getAdvices.php",data: "page=" + iPage + "&key=" + sSearchKey + "&value=" + iSearchValue + "&sTarget=" + sTargetDiv + "&random=" + Math.random(),
		beforeSend: function(){
			showHidePreloader(sTargetDiv);
		}, // show loading just when link is clicked
//			complete: function(){ jQuery("#loading").hide("fast");}, //stop showing loading when the process is complete
		success: function(html) { //so, if data is retrieved, store it in html
			showHidePreloader(sTargetDiv,true);
			jQuery(divAdvices).html(html); // show the html inside .content div
			initializeFancyBoxImages();
		}
	}); //close jQuery.ajax(
}



/*** RIGHT - EVENTS - changing - forward backwards ***/

/*** RIGHT RATINGS ***/

var iCurrentRightEvent = -1;
function showRightBoxEvent(bNext) {

	var divRightEventOld = jQuery("#boxEventOne_" + iCurrentRightEvent); 
	jQuery(divRightEventOld).hide();
		
	if (bNext) {
		iCurrentRightEvent = ((iCurrentRightEvent+1) > iMaxRightEvents) ? 0 : (iCurrentRightEvent+1);
	} else {
		iCurrentRightEvent = ((iCurrentRightEvent-1) < 0) ? iMaxRightEvents : (iCurrentRightEvent-1);
	}
	
//	alert('iCurrentRightEvent; ' + iCurrentRightEvent);
	var divRightEvent = ("#boxEventOne_" + iCurrentRightEvent); 
	jQuery(divRightEvent).show();
	return false;
}




/*** END JQUERY ***/


