$(function() {
	$('.rollover').hover(function() {
			var currentImg = $(this).attr('src');
			$(this).attr('src', $(this).attr('hover'));
			$(this).attr('hover', currentImg);
		}, function() {
			var currentImg = $(this).attr('src');
			$(this).attr('src', $(this).attr('hover'));
			$(this).attr('hover', currentImg);
		});
});


$(function() {
	$('.switchmain').hover(function() {
			var currentImg = $(this).find('img').attr('src');
			var currentImgTitle = $(this).find('img').attr('title');
			var currentImgText = $(this).find('img').attr('text');
			$('img.mainPageImage').attr('src',currentImg);
			$('img.mainPageImage').attr('title',currentImgTitle);
			$('h1.textheader1').html(currentImgTitle);
			$('td.text1').html('<br/>' + currentImgText);

			//$(this).parent().parent().css({'z-index' : '10'});
			$(this).find('img').css('z-index','1000');
			$(this).css('position' , 'relative');
			$(this).find('img').css('position','absolute');
			$(this).find('img').addClass("hover").stop() /* Add class of "hover", then stop animation queue buildup*/
			.animate({
				/*marginTop: '-15px',  The next 4 lines will vertically align this image
				marginLeft: '12px',  
				top: '50%',
				left: '50%',*/
				top: '-5px',
				left: '-5px',
				width: '71px', /* Set new width */
				height: '84px', /* Set new height */
				padding: '2px'
			}, 0); /* this value of "200" is the speed of how fast/slow this hover animates */
	
			} , function() {
				//$(this).parent().parent().css({'z-index' : '0'});
				$(this).find('img').css({'z-index' : '0'});
				//$(this).find('img').css('position','relative');
				//$(this).css('position' , 'absolute');
				$(this).find('img').removeClass("hover").stop()  /* Remove the "hover" class , then stop animation queue buildup*/
				.animate({
					marginTop: '0', /* Set alignment back to default */
					marginLeft: '0',
					top: '0',
					left: '0',
					width: '56px', /* Set width back to default */
					height: '64px', /* Set height back to default */
					padding: '2px'
				}, 0);
			});
		

});

(function($) {
	  var cache = [];
	  // Arguments are image paths relative to the current page.
	  $.preLoadImages = function() {
	    var args_len = arguments.length;
	    for (var i = args_len; i--;) {
	      var cacheImage = document.createElement('img');
	      cacheImage.src = arguments[i];
	      cache.push(cacheImage);
	    }
	  }
	})(jQuery)



$(function(){
	$("a.arrowUp").bind("mouseover click", function(){
		    var topVal = $(".container").find(".content").css("top");
		    var parsedTopVal = topVal.replace("px", "");
		    if ((parsedTopVal*1) != 0)
		    {
		    	$(".container").find(".content").css("top", ((parsedTopVal*1)+10) + "px" );
		    }
		  });

	  $("a.arrowDown").bind("mouseover click", function(){
		    var topVal = $(".container").find(".content").css("top");
		    var parsedTopVal = topVal.replace("px", "");
		    $(".container").find(".content").css("top", ((parsedTopVal*1)-10) + "px" );
	  });
});


$(function(){
	$('td.menu').hover(function() {
			var $jjj = $(this).attr('id');
			var $kkk = "home";
			var $aaa = "המרכז לאומנויות העץ";

			if ($jjj == "about")
			{	$kkk = "odot";
				$aaa = "אודות אלי";
			}
			else if ($jjj == "woodworking")
			{	$kkk = "nagarut";
				$aaa = "קורס נגרות";
			}
			else if ($jjj == "woodcarving")
			{	$kkk = "giluf";
				$aaa = "קורס גילוף";
			}
			else if ($jjj == "woodturning")
			{	$kkk = "harita";
				$aaa = "קורס חריטה";
			}
			else if ($jjj == "sculpting")
			{	$kkk = "pisul";
				$aaa = "קורס פיסול";
			}
			else if ($jjj == "gallery")
			{
				$kkk = "galery";
				$aaa = "גלריה";
			}
			else if ($jjj == "contact")
			{
				$kkk = "contact";
				$aaa = "צור קשר";
			}
			else
			{
				$kkk = "home";
				$aaa = "עמוד הבית";
			}
			
			if ($kkk == "home")
			{
				$('#ID_defaultMenu').attr('src', 'images/MainMenu/tafrit.png');
				$('#ID_defaultMenu').attr('alt', 'המרכז לאומנויות העץ');
				if ($jjj != $jsPageName )
				{
					$(this).find('span.menuBlock a.menuText[title]').css('color','#BBCB2E');	
				}
			}
			else
			{
				$('#ID_defaultMenu').attr('src', 'images/MainMenu/tafrit-' + $kkk + '.png');
				$('#ID_defaultMenu').attr('alt', $aaa );
				$(this).find('span.menuBlock a.menuText[title]').css('color','#BBCB2E');	
			}
		}, function() {
			var $jjj = $(this).attr('id');
			$('#ID_defaultMenu').attr('src', 'images/MainMenu/tafrit.png');
			$('#ID_defaultMenu').attr('alt', 'המרכז לאומנויות העץ');
			if ($jjj != $jsPageName )
			{
				$(this).find('span.menuBlock a.menuText[title]').css('color','#FFFFFF');	
			}
			
		});
});


jQuery.exists = function(selector) {return ($(selector).length > 0);}


