﻿/**** GALLERY ****/
var oScrollThumbsTimer;
function fScrollThumbs(bMove, nDirection){
	if(bMove)
		oScrollThumbsTimer=setInterval("fDoScroll("+ nDirection +")", 40)
	else
		clearInterval(oScrollThumbsTimer);
}

function fDoScroll(nDirection){
	var obj=document.getElementById("oThumbsScroll");
	obj.scrollTop=(nDirection==1 ? obj.scrollTop+5 : obj.scrollTop-5);
}

var nLastSelectedID=0, bUserInteract = false, nZindex=5;
function fChangeImage(nPosID, bUser){
	if(bUser) bUserInteract = true;
	if(nPosID<0) nPosID=arrImages.length-1;
	if(nPosID>arrImages.length-1) nPosID=0;
	$("#oFullImg"+ nPosID).hide().css({zIndex:nZindex}).fadeIn(300);
	$("#oImgDescText").html(arrImages[nPosID][2]);
	nZindex++
	nLastSelectedID=nPosID;
	if(!bUserInteract) setTimeout(function(){if(!bUserInteract) fChangeImage(nLastSelectedID+1)},4000)
}

var bGelleryView = true;
function fGalleryDescView(){
	if(bGelleryView){
		$("#oImgDescBtn").html( (sCurrLang=="en"?"show":"הצג") +' <img src="/images/icon_show.png" alt="" />');
		$("#oImgDesc").animate({bottom:'-88px'},400);
		bGelleryView = false;
	}
	else{
		$("#oImgDescBtn").html( (sCurrLang=="en"?"hide":"הסתר") +' <img src="/images/icon_hide.png" alt="" />');
		$("#oImgDesc").animate({bottom:'0'},400);
		bGelleryView = true;
	}
}





$(document).ready(function(){
	var i=0
	$(".clsCatIcons").find(".clsIcons").find("div").each(function(){
		$(this).hover(
			function(){
				var $box = $("#oCatTooltip"+ $(this).attr("tooltip"));
				if(sLangDir=="rtl"){
					$box.css({
						left:$(this).position().left + 85,
						top:$(this).position().top + 280
					}).fadeIn(150);
				}
				else{
					$box.css({
						left:$(this).position().left + 155,
						top:$(this).position().top + 280
					}).fadeIn(150);
	
				}
			},
			function(){
				$("#oCatTooltip"+ $(this).attr("tooltip")).fadeOut(150);
			}		
		);
	});
});

