/**
 * @author Nima Nekoui
 */


			var image = "01";	//change to -1 if starting from a blank screen
			
			var go = true;
			function shrinkThumbGrowImage (element) {
	      
	        	var elmtNum = ($(element).id).charAt(6) + ($(element).id).charAt(7);

				if(go)
				{	
					go = false;
					if(image != elmtNum)
					{
						if(image == -1)
						{
							new Effect.Appear('image' + elmtNum);
							new Effect.Appear('text' + elmtNum);				
							image = elmtNum;
						}
						else
						{
							new Effect.Fade('image' + image);
							new Effect.Fade('text' + image);
							new Effect.Appear('image' + elmtNum);
							new Effect.Appear('text' + elmtNum);
							image = elmtNum;
						}
					}
					setTimeout(function(){go = true;}, 1100);
				}
			}
			
			
			var openMenu = "";
			
			function subMenuBlindDown(theid){
				if(go)
				{	
					//confirm(openMenu + ":::" + theid);
					go = false;
					if (openMenu == "")
					{
						new Effect.BlindDown(theid, {queue: {position: 'end', scope: 'menu', limit:2} });
						openMenu = theid;
					}
					else
					{
						//confirm(openMenu + ":" + theid);
					
						if (openMenu != theid)
						{
							new Effect.BlindUp(openMenu, {queue: {position: 'end', scope: 'menu', limit:2} });
							new Effect.BlindDown(theid, {queue: {position: 'end', scope: 'menu', limit:2}, afterFinish:function(){openMenu = theid;} });
							
						}
						else
						{
							//new Effect.Fade(openMenu, {queue: {position: 'end', scope: 'menu', limit:2}, afterFinish:function(){openMenu = "";} });
							
						}
					}
					setTimeout(function(){go = true;}, 1100);
					//confirm(openMenu + "::" + theid);
				}
			}
			
			function subMenuBlindUp(){
				if (openMenu != "")
				{
					new Effect.BlindUp(openMenu, {queue: {position: 'end', scope: 'menu', limit:2} });
					openMenu = "";	
				}
			}


			
				
			function fadeOutOpen(id, href){
				//confirm(id);
				new Effect.Fade(id, {duration: 2.0, afterFinish:function(){ window.location = href;}, queue: {position: 'end', scope: 'pre', limit:2}});
		      	
		    }
			
			function fadeOutfadeIn(id1, id2){
				//confirm(id);
				new Effect.Fade(id1, {duration: 2.0, queue: {position: 'end', scope: 'pre', limit:2}});
		      	new Effect.Appear(id2, {duration: 2.0, queue: {position: 'end', scope: 'pre', limit:2}});
		      	
		    }
			


			
///////////////////
			imageHeight = 134;
			imageCount = 0;	//round to the nearest 3 set onload of each page
			
			positionLeft = 0;
			positionUp = 0;
			maxPositionLeft = 0; 
			maxPositionUp = 0; 
			scrollImagesLeft = false;
			scrollImagesRight = false;
			scrollImagesUp = false;
			scrollImagesDown = false;
	
			
			
			function scrollImagesToLeft() {
				if(positionLeft > -maxPositionLeft)
				{
					if (scrollImagesLeft)
					{
						positionLeft = positionLeft - 1;
						//confirm($("images").getStyle('left'));
						$("images").setStyle({'left': positionLeft + "px"});
						//confirm($("images").getStyle('left'));
						//document.getElementById("images").style.left = positionLeft+"px";
						setTimeout("scrollImagesToLeft()", 1);
					}
				}	
			}
			
			
			
			function scrollImagesToRight() {
				if(positionLeft < 0)
				{
					if (scrollImagesRight)
					{
						positionLeft = positionLeft + 1;
						$("images").setStyle({'left': positionLeft + "px"});
						//document.getElementById("images").style.left = positionLeft+"px";
						setTimeout("scrollImagesToRight()", 1);
					}
				}	
			}
			
	
			function nextSet() {
				if(positionLeft > -maxPositionLeft)
				{
					new Effect.MoveBy("images", 0, -392, {duration: 1.5, afterFinish:function(){ positionLeft = positionLeft - 392;}, queue: {position: 'end', scope: 'images', limit:1}});
					
				}	
			}
			
			function previousSet() {
				if(positionLeft <= -392)
				{
					new Effect.MoveBy("images", 0, 392, {duration: 1.5, afterFinish:function(){ positionLeft = positionLeft + 392;}, queue: {position: 'end', scope: 'images', limit:1}});
				}
			}
			

			
			function nextSetCollections() {
				if(positionLeft > -maxPositionLeft)
				{
					new Effect.MoveBy("collectionsImages", 0, -300, {duration: 1.0, afterFinish:function(){ positionLeft = positionLeft - 300;}, queue: {position: 'end', scope: 'images', limit:1}});
					new Effect.MoveBy("collectionsText", 0, -300, {duration: 1.0, queue: {position: 'end', scope: 'text', limit:1}});
				}	
			}
			
			function previousSetCollections() {
				if(positionLeft <= -300)
				{
					new Effect.MoveBy("collectionsImages", 0, 300, {duration: 1.0, afterFinish:function(){ positionLeft = positionLeft + 300;}, queue: {position: 'end', scope: 'images', limit:1}});
					new Effect.MoveBy("collectionsText", 0, 300, {duration: 1.0,  queue: {position: 'end', scope: 'text', limit:1}});
				}
			}
			
			
			
			
			function nextSet2_X2() {
				if(positionLeft > -maxPositionLeft)
				{
					new Effect.MoveBy("collectionsImages", 0, -900, {duration: 2.0, afterFinish:function(){ positionLeft = positionLeft - 900;}, queue: {position: 'end', scope: 'images', limit:1}});
					new Effect.MoveBy("collectionsText", 0, -900, {duration: 2.0, queue: {position: 'end', scope: 'text', limit:1}});
				}	
			}
			
			function previousSet2_X2() {
				if(positionLeft <= -900)
				{
					new Effect.MoveBy("collectionsImages", 0, 900, {duration: 2.0, afterFinish:function(){ positionLeft = positionLeft + 900;}, queue: {position: 'end', scope: 'images', limit:1}});
					new Effect.MoveBy("collectionsText", 0, 900, {duration: 2.0,  queue: {position: 'end', scope: 'text', limit:1}});
				}
			}
			
			function nextSet3() {
				if(positionUp > -maxPositionUp)
				{
					new Effect.MoveBy("storeList", -200, 0, {duration: .7, afterFinish:function(){ positionUp = positionUp - 200;}, queue: {position: 'end', scope: 'images', limit:1}});
				}	
			}
			
			function previousSet3() {
				if(positionUp <= -200)
				{
					new Effect.MoveBy("storeList", 200, 0, {duration: .7, afterFinish:function(){ positionUp = positionUp + 200;}, queue: {position: 'end', scope: 'images', limit:1}});
				}
			}
			
			function reset3() {
				if(positionUp <= -200)
				{
					new Effect.MoveBy("storeList", -1*positionUp, 0, {duration: 0.0, afterFinish:function(){ positionUp = 0;}, queue: {position: 'end', scope: 'images', limit:1}});
				}
			}


			
			
