<!--
/*
jQuery(document).ready(function(){
	var divGetLastArticles = jQuery("#boxLastArticles .boxHrefList div")d
	jQuery("#boxLastArticles .boxHrefList div").click(function(event){
		alert(this.className);
	});
});
*/
jQuery.noConflict();
var iLastActiveArticles = -1;

var aLastArticlesCategories = new Array();
aLastArticlesCategories[0] = 6; // moda
aLastArticlesCategories[1] = 1; // aktualnosci
aLastArticlesCategories[2] = 5; // centra handlowe
aLastArticlesCategories[3] = 4; // projektanci
aLastArticlesCategories[4] = 3; // nowe kolekcje

jQuery(document).ready(function()
{
	jQuery("#boxLastArticles .boxHrefList div").each(
		//// For each hottie, run this code. The "indIndex" is the
		// loop iteration index on the current element.
		function(intIndex) {
			// Bind the onclick event to simply alert the
			// iteration index value.
			jQuery(this).bind (
				"click",
				function(){
					iCategoryId = aLastArticlesCategories[intIndex];
					changeLastArticlesCategory(intIndex,iCategoryId);
				}
			);
			
			jQuery( "#boxLastArticles .boxHrefList div#lastArticleLink" + intIndex).hover(function() {
			  jQuery(this).addClass('lastArticleCategoryHover');
			}, function() {
			  jQuery(this).removeClass('lastArticleCategoryHover');
			});
			
		}
	);
	
	function changeLastArticlesCategory(iDivIndex,iCategoryId)
	{
		if (iLastActiveArticles == iDivIndex) {
			return;
		} 
		removeClassActiveLastArticles(iLastActiveArticles);
		addClassActiveLastArticles(iDivIndex);
		showHidePreloader();
		getAjaxLastArticle(iCategoryId);		
	}
	
	function removeClassActiveLastArticles()
	{
		jQuery( "#boxLastArticles .boxHrefList div#lastArticleLink" + iLastActiveArticles).removeClass('lastArticleCategoryActive');
	};
	
	function addClassActiveLastArticles(intIndex)
	{
		jQuery( "#boxLastArticles .boxHrefList div#lastArticleLink" + intIndex).addClass('lastArticleCategoryActive')
		iLastActiveArticles = intIndex;	
	}
	
	function showHidePreloader(bHide)
	{
		if (bHide == 'undefined') {
			bHide = false;
		}
		var iDivContentHeight = jQuery("#boxLastArticles .boxContentAll").height();
//		alert('iDivContentHeight: ' + iDivContentHeight);
		var divPreloader = jQuery( "#boxLastArticles div.preloader");
		jQuery(divPreloader).height(iDivContentHeight);
		if (!bHide) {
			jQuery(divPreloader).show();
		} else {
			jQuery(divPreloader).hide();
		}
	}
	
	changeLastArticlesCategory(0,aLastArticlesCategories[0]);
	
	
	function getAjaxLastArticle(iCategoryId) 
	{
		divContent = jQuery( "#boxLastArticles div.boxContent");
		jQuery.ajax({  
			method: "get",url: "ajax/getBoxLastArticles.php",data: "categoryId=" + iCategoryId + "&random=" + Math.random(),  
//			beforeSend: function(){jQuery("#loading").show("fast");}, //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(divContent).html(html); //show the html inside .content div  
				showHidePreloader(true);
			}  
		}); //close jQuery.ajax(  
	}
});

function focusLastArticleDiv(handleDiv,bOff) 
{
	if (!bOff) {
		jQuery(handleDiv).addClass('focusLastArticleDiv');
	} else {
		jQuery(handleDiv).removeClass('focusLastArticleDiv');
	}
}



/*
function getLastArticles(iDivId, iCategoryId) 
{
	jQuery("#boxLastArticles .boxHrefList div").each(
		alert(this);
	);

	var divLink = jQuery("#lastArticleLink" + iDivId);
	divLink.addClass('lastArticleCategoryActive');	
	
}
*/

-->
