// [ ☺ ]

function siteItemsFader()
{
	alert(' ');
	items = $("#catItemsFader > div");
	this.pos = 1;
	this.interval = 10000;
	this.fadeTime = 1500;
	this.show = function ()
	{
		for(var i=0,len=this.items.size(); i<len; i++) $(this.items[i]).hide();
		$(this.items[this.pos]).fadeIn(this.fadeTime);
	}
	this.next = function()
	{
		this.pos++;
		if (this.pos>=this.items.size()) this.pos = 0;
		this.show();
		var self = this;
		setTimeout( function() { self.next(); } , this.interval );
	};
	this.show();
	var self = this;
	setTimeout(function() { self.next(); } , this.interval);
}
// $(function() { setTimeout(function() { siteItemsFader(); } , 10000); }); // Preventing the fader of starting

function changeNews(link,bg,title,text)
{
	$(function()
	{
		cont = '<a id="bigNewsItem" href="index.php?dir=site&page=news&op=item&cs=' + link + '" style="background: url(\'' + bg + '\') no-repeat 0 0;">' + "\n"
				+ '<div id="NewsItemSummery">' + "\n"
					+ '<div id="ItemSummeryInner">' + "\n"
						+ '<b>' + title + '</b><br />' + "\n"
						+ text + "\n"
					+ '</div>' + "\n"
				+ '</div>' + "\n"
			+ '</a>';
		// $("#mainNewsOrg").stop().hide(0, function() { $("#mainNewsHold").hide(); $("#mainNewsHold").html(cont); $("#mainNewsHold").stop().fadeIn(300); });
		if(typeof(outto) == "number") clearTimeout(outto);
		$("#mainNewsHold").hide();
		$("#mainNewsHold").html(cont);
		$("#mainNewsOrg").hide();
		$("#mainNewsHold").fadeIn();
	});
}

function bringMain()
{
	$(function()
	{
		$("#mainNewsHold").hide(); $("#mainNewsOrg").show();
		outto = setTimeout(function() { $("#mainNewsHold").hide(); $("#mainNewsOrg").show(); } , 800);
	});
}

function switchPic(small,big,link_start,link_end)
{
	$(function()
	{
		cont = '<div id="CatalogPicOverlay"></div>' + link_start + '<img src="' + small + '" alt="" />' + link_end
			+ '<div style="clear: both; text-align: left; width: 100%;">' + link_start + 'הגדלת תמונה' + link_end +'</div>';
		
		$("#catalogPicHolder").html(cont);
		$("#CatalogPicOverlay").fadeOut("fast");
	});
}
