/**
 * @author oreny
 */
var thumbs = new Array(4);
var pos=0;
var moreAlreadyClicked=0;
thumbs[0]="images/thumbs/1.jpg"
thumbs[1]="images/thumbs/2.jpg"
thumbs[2]="images/thumbs/3.jpg"
thumbs[3]="images/thumbs/4.jpg"

var nextImageId=0;

function swapThumb( anImage){
	anImage.src = thumbs[nextImageId++];
	if(nextImageId == thumbs.length){
		nextImageId=0;
	}
}

function changeMainImage(thumbClicked){
	var thumbSrc = thumbClicked.src;
	var fullsizeImageSrc = thumbSrc.replace("images/thumbs","images/pics");
	
	$("#mainImageCell").attr("background",fullsizeImageSrc);
	//mainImageCell.style.background = "url(\'"+fullsizeImageSrc+"\')";
	
}




$(document).ready(function(){
	
//Rollover
		$(".topmenu").mouseover( function()
									{
										$(this).addClass("topmenu_hover");
									}
		
								);
		$("a.menu").mouseover( function()
									{
										$(this).addClass("a.menuohver");
									}
		
								);
		
		
		$(".topmenu").mouseout( function()
									{
										$(this).removeClass("topmenu_hover");
									}
		
								);
		
		
		$("a.menu").mouseout( function()
									{
										$(this).removeClass("a.menuohver");
									}
		
								);
		
		// click
		$("img.thumbimage").click(function(){
			changeMainImage(this);
	//		$(this).parent().hide(500);
	//		if(moreAlreadyClicked==0){
	//				moreAlreadyClicked=1;
	//				$("#instructions").hide(500);
	//				$("#morediv").css('visibility','visible') ;
					
				
	//		}
				
		}
		)
		
		$("#morediv").click(function(){			
			$("#thumbs_div table tr td:visible").eq(0).hide(500);
			$("#thumbs_div table tr td:visible").eq(1).hide(400);
			$("#thumbs_div table tr td:visible").eq(2).hide(300);
			$("#thumbs_div table tr td:visible").eq(3).hide(200);
				
			
		});
		
		$("#moredivab").click(function(){
			$("#thumbs_div table tr td").show(500);
		});
		
		$("#moredivaa").click(function(){
			pos=pos-290;			
			$("#thumbs_table").animate({left: pos}, 2000);
			if(moreAlreadyClicked==0){
					moreAlreadyClicked=1;
					$("#more_caption").animate({opacity:'hide'},500);
					;
					
				}
			}
		);
	});//end of ready.
	