// JavaScript Document
<!--
	function getArchiveContent(obj,e){
		interactiveShow = null;
		//global imageArray holding the images returned from categories or archive
		mainImageArray=[];
		
		var divContactContent = $("divContactContent");
		var divArchiveContent = $("divArchiveContent");
		//if divArchiveContent is not visible then run handler
		if(divArchiveContent.getAttribute("fsShow")=="0"){
			globalFsSelected=null;
			//when contact link clicked the main image must be blank
			$("imgFirstImage").src=mainFakeImage.src;
			
			//if divContactContent is already showing hide it before show Archive
			if(divContactContent.getAttribute("fsShow")=="1"){
				$jquery("#divContactContent").fadeOut(300,function(){
					divContactContent.setAttribute("fsShow","0");
					$jquery("#divArchiveContent").fadeIn(300,function(){
						$("divArchiveContent").setAttribute("fsShow","1");
					});
				});
			}else{
				$jquery("#divArchiveContent").fadeIn(300,function(){
					$("divArchiveContent").setAttribute("fsShow","1");
				});
			}
				obj.setAttribute("fsSelected","true");
				//update all elements and set their attibute fsSelected to false except the selected one
				$$("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");
										}
								    }
				);
				
		}
		
	}
	function getContactContent(obj,e){
		//global imageArray holding the images returned from categories or archive
		interactiveShow = null;
		mainImageArray=[];
		
		var divContactContent = $("divContactContent");
		var divArchiveContent = $("divArchiveContent");
		//if divArchiveContent is not visible then run handler
		if(divContactContent.getAttribute("fsShow")=="0"){
			//when contact link clicked the main image must be blank
			$("imgFirstImage").src=mainFakeImage.src;
			//global attribute to check which elements is selected so i can fade out or in the other elements
			globalFsSelected="contact";
			
			//if divContactContent is already showing hide it before show Archive
			if(divArchiveContent.getAttribute("fsShow")=="1"){
				$jquery("#divArchiveContent").fadeOut(300,function(){
					divArchiveContent.setAttribute("fsShow","0");
					$jquery("#divContactContent").fadeIn(300,function(){
						$("divContactContent").setAttribute("fsShow","1");
					});
				});
			}else{
				/*
				$jquery("#divContactContent").fadeIn(300,function(){
					$("divContactContent").setAttribute("fsShow","1");
				});
				*/
				var imageBackground = new ImageBackground(0.8);
				imageBackground.show();
				
				var div = document.createElement("div");

				div.style.zIndex=11;
				div.style.position='absolute';
				div.style.width='200px';
				div.style.height='200px';
				div.style.backgroundColor='#FFFFFF';

				var totalWidth=$jquery(document).width();
				var totalHeight=$jquery(document).height();

				div.style.left=parseInt(totalWidth/2)-parseInt(div.style.width)/2+"px";
				div.style.top=parseInt(totalHeight/2)-parseInt(div.style.height)/2+'px';

				var divClose = document.createElement("div");
				var randomId = "divImage_"+new Date().getTime();
				var randomId2 = "divContactContent_"+new Date().getTime();
				
				divClose.setAttribute("id",randomId);

				divClose.style.display='none';
				divClose.style.textAlign='right';
				divClose.style.paddingRight="15px";
				var closeImage = new Image();
				closeImage.src="./images/fsCloseLightBox.gif";
				closeImage.style.cursor='pointer';
				closeImage.imageBackground=imageBackground;
				closeImage.div = div;

				var closeImage2 = function(event){

					var elem = Event.element(event);

					elem.imageBackground.hide();

					document.body.removeChild(elem.div);
				};

				$(closeImage).observe("click",closeImage2);
				divClose.style.paddingTop="5px";
				divClose.style.paddingBottom="0px";
				divClose.appendChild(closeImage);
				
				var divContactContent = document.createElement("div");
				divContactContent.setAttribute("id",randomId2);
				
				var imageFirst = document.createElement("img");
				imageFirst.src = "./images/BILLGEORGOUSSIS.gif";
				var divFirst = document.createElement("div");
				divFirst.style.cssText="text-align:left;";
				divFirst.appendChild(imageFirst);
				
				var imageSec = document.createElement("img");
				imageSec.src = "./images/contact_popup.gif";
				var divSec = document.createElement("div");
				divSec.style.cssText="text-align:left;padding-top:15px;";
				divSec.appendChild(imageSec);
				
				var imageThird = document.createElement("img");
				imageThird.src = "./images/georgoussis@mac.gif";
				imageThird.border=0;
				var divThird = document.createElement("div");
				divThird.style.cssText="text-align:left;border-width:0px;";
				var linkThird = document.createElement("a");
				linkThird.href="mailto:georgoussis@mac.com";
				linkThird.style.cssText="cursor:pointer;text-decoration:none;border-width:0px;";
				linkThird.appendChild(imageThird);
				divThird.appendChild(linkThird);
				
				var imageFour = document.createElement("img");
				imageFour.src = "./images/bill@georgoussis.gif";
				imageFour.border=0;
				var divFour = document.createElement("div");
				divFour.style.cssText="text-align:left;border-width:0px;";
				var linkFour = document.createElement("a");
				linkFour.href="mailto:bill@georgoussis.com";
				linkFour.style.cssText="cursor:pointer;text-decoration:none;border-width:0px;";
				linkFour.appendChild(imageFour);
				divFour.appendChild(linkFour);
				
				divContactContent.style.cssText="display:none;font-family:'Tahoma,Verdana';padding:4px 4px 0px 45px;";
				divContactContent.appendChild(divFirst);
				divContactContent.appendChild(divSec);
				divContactContent.appendChild(divThird);
				divContactContent.appendChild(divFour);
				
				div.appendChild(divContactContent);
				div.appendChild(divClose);

				var finalWidth = 700;
				var finalHeight = 500;
				
				document.body.appendChild(div);

				//alert(false);

			new Effect.Scale(div,finalWidth/parseInt(div.style.width)*100+20,{scaleFromCenter:true,scaleY:false,

									afterFinish:function(effect){
										new Effect.Scale(div,finalHeight/parseInt(div.style.height)*100+30,{scaleFromCenter:true,scaleX:false,
											afterFinish:function(effect){
												var divContactContent = div.childNodes[div.childNodes.length-2];
												var divClose = div.childNodes[div.childNodes.length-1];
												var curHeight = parseInt(divContactContent.offsetHeight);
												var curHeight2 = parseInt(divClose.offsetHeight);
												var newDiv = document.createElement("div");
												var newDiv = document.createElement("div");
												newDiv.style.width="450px";
												newDiv.style.height = 400-(curHeight+curHeight2-10)+"px";
												
												div.insertBefore(newDiv,divContactContent);
												
												$jquery("#"+divContactContent.getAttribute("id")).fadeIn(400,function(){
												});
												

												$jquery("#"+divClose.getAttribute("id")).fadeIn(900,function(){

												});

											}

										});

									}

								}

							);

				
			}//else
				
				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");
										}
								    }
				);
				
		}
		
	}//getContactContect
	
	function getSlideShow(obj){
		globalFsSelected=null;
		interactiveShow = null;
		mainImageArray = [];
		var divContactContent = $("divContactContent");
		var divArchiveContent = $("divArchiveContent");
		//if archive content appears fade it out
		if(divArchiveContent.getAttribute("fsShow")=="1"){
			$jquery("#divArchiveContent").fadeOut(300,function(){
				divArchiveContent.setAttribute("fsShow","0");
			});
		} 
		//if contact content appears fade it out
		if(divContactContent.getAttribute("fsShow")=="1"){
			$jquery("#divContactContent").fadeOut(300,function(){
				divContactContent.setAttribute("fsShow","0");
			});
		}
		//search all elements from category and archive and reset on mouseover color
		$$("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");
										}
								    }
		);
		//fade out tdSubCategory(elements contained spanArchive, span Contact, span SlideShow)
		$jquery("#tdSubCategory").animate({opacity:0.0},500,function(){
			
		});
		//fade out divCategories(elements container ul li categories )
		$jquery("#divCategories").animate({opacity:0.0},500,function(){
		});
		//fade in the player for the slide show
		$jquery("#tdPlayer").animate({opacity:1.0},500,function(){
			if(Prototype.Browser.IE){
				$("tdPlayer").style.cssText="";
			}
		});
		
		//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:'getSlideShowPhotos.php',
					type:'GET',
					dataType:'json',
					error:function(){
					},
					success:function(json){
						//stop animateLoader function to run
						isAnimatedLoader=false;
						
						mainImageArray = [];
						
						$("imgFirstImage").src= mainFakeImage.src;
						var oPos = Element.cumulativeOffset($("imgFirstImage").parentNode);
						var width = $("imgFirstImage").parentNode.offsetWidth;
						var height = $("imgFirstImage").parentNode.offsetHeight;
						var slideShowLogo = new Image();
						slideShowLogo.setAttribute("id","slideShowLogo");
						slideShowLogo.src="./images/slideShowLogo.gif";
						slideShowLogo.style.width='300px';
						slideShowLogo.style.height='100px';
						slideShowLogo.style.position='absolute';
						slideShowLogo.style.left=oPos.left+parseInt(width/2)-parseInt(slideShowLogo.style.width)/2+"px";
						slideShowLogo.style.top=oPos.top+parseInt(height/2)-parseInt(slideShowLogo.style.height)/2+"px";
						document.body.appendChild(slideShowLogo);
						playerImageArray = json;
						if(playerImageArray.length==0){
							playerImageArray.push("./images/notAvailableImage.gif");
						}
						
					}
			});
			
	}//function getSlideShow()
	
	function hideSlideShow(obj){
		//fade in tdSubCategory(elements contained spanArchive, span Contact, span SlideShow)
		$jquery("#tdSubCategory").animate({opacity:1.0},500,function(){
			if(Prototype.Browser.IE){
				$("tdSubCategory").style.cssText="";
			}
		});
		//fade out divCategories(elements container ul li categories )
		$jquery("#divCategories").animate({opacity:1.0},500,function(){
			if(Prototype.Browser.IE){
				$("divCategories").style.cssText="";
			}
		});
		//fade in the player for the slide show
		$jquery("#tdPlayer").animate({opacity:0.0},500,function(){
		});
		if($("slideShowLogo")){
			document.body.removeChild($("slideShowLogo"));
		}
		if(fsPlayer!=null && fsPlayer.isPlaying()){
			fsPlayer.pause();
			fsPlayer=null;
		}
		$("imgStartSlide").src='./images/startSlide.gif';
	}
//-->