// JavaScript Document
<!--
	
	function getCategoryPhotos(obj){
		if(obj.getAttribute("fsSelected")=="false"){
			//global attribute to check which elements is selected so i can fade out or in the other elements
			globalFsSelected="category";
			
			var divArchiveContent = $("divArchiveContent");
			var divContactContent = $("divContactContent");
			if(divArchiveContent.getAttribute("fsShow")=="1"){
				$jquery("#divArchiveContent").fadeOut(500,function(){
					divArchiveContent.setAttribute("fsShow","0");
				});
			}else if(divContactContent.getAttribute("fsShow")=="1"){
				$jquery("#divContactContent").fadeOut(500,function(){
					divContactContent.setAttribute("fsShow","0");
				});
			}
			obj.setAttribute("fsSelected","true");
				$$("ul.ulCategories li,ul.ulArchive li,span.spanArchive,span.spanContact,span.spanSlide").each(
									function(node){
										if(node!=obj){
											if(node.getAttribute("fsSelected")=="true"){
												node.style.color='rgb(120,120,120)';
											}
											node.setAttribute("fsSelected","false");
										}
								    }
				);
				
			//get the photos from the selected category
			$("imgFirstImage").src=mainFakeImage.src;
			var categoryId = obj.getAttribute("id");
			categoryId = categoryId.substring(1);
			//function to construct progress bar
			var isAnimatedLoader=true;
			$("divLoader").style.backgroundColor='rgb(90,90,90)';
			var animateLoader=function(){
				if(isAnimatedLoader){
					$jquery("#divLoader").animate({width:700},500,function(){
						$jquery("#divLoader").animate({width:0},500,function(){
							animateLoader();
						});
					});
				}else{
					$("divLoader").style.backgroundColor='#FFFFFF';
					$("divLoader").style.width='1px';
				}
			};
			animateLoader();
			/*
			$jquery("#divLoader").animate({width:700},500,function(){
				$jquery("#divLoader").animate({width:0},500,function(){});
			});
			*/
			$jquery.ajax({
					url:'getCategoryPhotos.php',
					type:'GET',
					data:'category_id='+categoryId,
					dataType:'json',
					error:function(){
					},
					success:function(json){
						//stop animateLoader function to run
						isAnimatedLoader=false;
						
						mainImageArray = null;
						mainImageArray = json;
						/*
						if(mainImageArray.length==0){
							mainImageArray.push("./images/notAvailableImage.gif");
						}
						interactiveShow = new InteractiveShow(mainImageArray,"topPhoto");
						interactiveShow.next();
						interactiveShow.animate();
						*/
						var newMainImageArray=[];
						var loaded=false;
						var currentLoadedIndex=0;
						var onload = function(){
							currentLoadedIndex++;
							//alert(currentLoadedIndex);
							if(currentLoadedIndex==mainImageArray.length){
								loaded=true;
								isAnimatedLoader=false;
								interactiveShow = new InteractiveShow(newMainImageArray,"topPhoto");
								interactiveShow.next();
								interactiveShow.animate();
							}
						};
						if(mainImageArray!=null){
						for(var i=0;i<mainImageArray.length;i++){
							var curImage = new Image();
							curImage.src=mainImageArray[i];
							curImage.onload=onload;
							newMainImageArray.push(curImage);
						}
						}
						if(mainImageArray!=null && mainImageArray.length==0){
							var curImage = new Image();
							curImage.src="./images/notAvailableImage.gif";
							curImage.onload=onload;
							mainImageArray.push("./images/notAvailableImage.gif");
							newMainImageArray.push(curImage);
						}
						
					}
			});
		}//if(obj.getAttribute("fsSelected")=="false"){
	}
	function getArchivePhotos(obj){
		if(obj.getAttribute("fsSelected")=="false"){
			//global attribute to check which elements is selected so i can fade out or in the other elements
			globalFsSelected="archive";
			
			var divContactContent = $("divContactContent");
			if(divContactContent.getAttribute("fsShow")=="1"){
				$jquery("#divContactContent").fadeOut(500,function(){
					divContactContent.setAttribute("fsShow","0");
				});
			}
			obj.setAttribute("fsSelected","true");
				$$("ul.ulCategories li,ul.ulArchive li,span.spanContact,span.spanSlide").each(
									function(node){
										if(node!=obj){
											if(node.getAttribute("fsSelected")=="true"){
												node.style.color='rgb(120,120,120)';
											}
											node.setAttribute("fsSelected","false");
										}
								    }
				);
				
			//get the photos from the selected category
			$("imgFirstImage").src=mainFakeImage.src;
			var archiveId = obj.getAttribute("id");
			
			//function to construct progress bar
			var isAnimatedLoader=true;
			$("divLoader").style.backgroundColor='rgb(90,90,90)';
			var animateLoader=function(){
				if(isAnimatedLoader){
					$jquery("#divLoader").animate({width:700},500,function(){
						$jquery("#divLoader").animate({width:0},500,function(){
							animateLoader();
						});
					});
				}else{
					$("divLoader").style.backgroundColor='#FFFFFF';
					$("divLoader").style.width='1px';
				}
			};
			animateLoader();
			
			$jquery.ajax({
					url:'getArchivePhotos.php',
					type:'GET',
					data:'archive_id='+archiveId,
					dataType:'json',
					error:function(){
					},
					success:function(json){
						//stop animateLoader function to run
						
						mainImageArray = null;
						mainImageArray = json;
						var newMainImageArray=[];
						var loaded=false;
						var currentLoadedIndex=0;
						var onload = function(){
							currentLoadedIndex++;
							if(currentLoadedIndex==mainImageArray.length){
								loaded=true;
								isAnimatedLoader=false;
								interactiveShow = new InteractiveShow(newMainImageArray,"topPhoto");
								interactiveShow.next();
								interactiveShow.animate();
							}
						};
						
						if(mainImageArray!=null){
						for(var i=0;i<mainImageArray.length;i++){
							var curImage = new Image();
							curImage.src=mainImageArray[i];
							curImage.onload=onload;
							newMainImageArray.push(curImage);
						}
						}
						if(mainImageArray!=null && mainImageArray.length==0){
							var curImage = new Image();
							curImage.src="./images/notAvailableImage.gif";
							curImage.onload=onload;
							mainImageArray.push("./images/notAvailableImage.gif");
							newMainImageArray.push(curImage);
						}
						
					}
			});
		}//if(obj.getAttribute("fsSelected")=="false"){
	}
//-->