var projectName=["relics","port","stasi","vacanze"];
//var la=new Array();
//for (i=0;i<projectName.length;i++) {
	//la[i]="work.php?p="+projectName[i]+"&i="+(i+1);
//}


var interv, intervin, intervy, browser;
var imgID, opacity;
var yobj, x_start, y_start, x_end, y_end, ystart, yend;
var objDiv, scrolling=false;
var intervaly=40, stepsy=10;
var imageArray = new Array(), newSlide, slideId;
var itself, theself;

var cbg=0, bgmax=1, timerbg, bg=new Array(),bgl=new Array(),bgname=new Array(),bglink=new Array();

			bgname[0]="relics";
			bgname[1]="port";
			bgname[2]="stasi";
			bgname[3]="vacanze";
			
			bgmax=4;
			bgmax=projectName.length;

			for (i=0;i<bgmax;i++) {
					bg[i]=new Image();
					bg[i].src="images/background_"+projectName[i]+".jpg";
					bgl[i]=new Image();
					bgl[i].src="images/background_"+projectName[i]+"_logo.jpg";
					bglink[i]=projectName[i]+".php";
				}

			function changeBackground () {
				cbg=cbg+1;
				cbg=Math.floor(Math.random()*(bgmax+1));
				if (cbg>bgmax) {cbg=1;}
				if (cbg<1) {cbg=1};
//				cbg=4;
				newbg="#FFFFFF url(images/background_"+projectName[cbg-1]+".jpg) 0 0 no-repeat";
				newbglogo="url(images/background_"+projectName[cbg-1]+"_logo.jpg) 0 0 no-repeat";
				document.getElementById('home_background').style.background=newbg;
				document.getElementById('home_logo').style.background=newbglogo;
//				document.getElementById('aEnterAll').href="work.php?p="+bgname[cbg-1];
//				document.getElementById('aEnter').href="work.php?p="+bgname[cbg-1];
				//var randomtime=Math.floor(Math.random()*5);
				randomtime=10;
				timerbg=setTimeout("changeBackground()",randomtime*1000);
			}
			
			
function showText(tstatus) {
	if (tstatus=="change") {
		if (document.getElementById("project_description").style.display=="block") {
			document.getElementById("project_description").style.display="none";
			document.getElementById("cc-text-a").className="textClass";
		} else {
			document.getElementById("project_description").style.display="block";
			document.getElementById("cc-text-a").className="textSelectedClass";
		}
	}
	
	if (tstatus=="show") {
		document.getElementById("project_description").style.display="block";
		document.getElementById("cc-text-a").className="textSelectedClass";
	}
	
	if (tstatus=="hide") {
		document.getElementById("project_description").style.display="none";
		document.getElementById("cc-text-a").className="textClass";
	}
}

var interval, opacity;

function fadingOut12() {
		var step=0.08;
		var obj=new Array();
		opacity-=step;

		if (opacity<0) {
			clearInterval(interval);
			opacity=0;
			obj[0]=document.getElementById("home_menu");
			obj[1]=document.getElementById("home_enter");
			obj[2]=document.getElementById("home_background");
			for (i=0;i<3;i++) {
				obj[i].style.opacity = opacity;
				obj[i].style.filter = 'alpha(opacity=' + opacity*100 + ')';
				obj[i].style.display="none";
				obj[i].style.zIndex=0;
			}
			document.getElementById("home_background").style.zIndex=0;
			document.getElementById("home_background").style.zIndex=0;
			document.getElementById("home_background").style.display='none';
			document.getElementById("wmenu").style.zIndex=100;
			//smenu.clicked(3);
			
		} else {
			obj[0]=document.getElementById("home_menu");
			obj[1]=document.getElementById("home_enter");	
			obj[2]=document.getElementById("home_background");
			for (i=0;i<3;i++) {
				obj[i].style.opacity = opacity;
				obj[i].style.filter = 'alpha(opacity=' + opacity*100 + ')';
			}
		}
}

function fadingIn12() {
		var step=0.08;
		var obj=new Array();
		opacity+=step;

		if (opacity>1) {
			clearInterval(interval);
			opacity=1;
			obj[0]=document.getElementById("home_menu");
			obj[1]=document.getElementById("home_enter");
			obj[2]=document.getElementById("home_background");
			for (i=0;i<3;i++) {
				obj[i].style.opacity = opacity;
				obj[i].style.filter = 'alpha(opacity=' + opacity*100 + ')';
				
			}
			
			
			
			
		} else {
			obj[0]=document.getElementById("home_menu");
			obj[1]=document.getElementById("home_enter");	
			obj[2]=document.getElementById("home_background");
			for (i=0;i<3;i++) {
				obj[i].style.opacity = opacity;
				obj[i].style.filter = 'alpha(opacity=' + opacity*100 + ')';
			}
		}
		
}

function startWork () {
	var elem;
	clearTimeout(timerbg);
	elem=document.getElementById("aEnterAll");
	elem.style.display="none";			// Link over entire image to enter the website
	//elem.parentNode.removeChild(elem);

	opacity=1;
//	document.getElementById("testimg").src="images/background_"+projectName[cbg-1]+"_work.jpg";
	document.getElementById("testimg").style.display="none";
	document.getElementById("test").style.background="url(images/background_"+projectName[cbg-1]+".jpg) -192px 0px no-repeat";
	//document.getElementById("home_background").style.zIndex=20;
	interval=setInterval(fadingOut12, 50);
}

function showHomepage () {
	opacity=0;
	document.getElementById("testimg").src="images/background_"+projectName[cbg-1]+"_work.jpg";
	interval=setInterval(fadingIn12, 50);
}

function menu (divId, itemsArray, linkArray, mName, mitem) {
	this.id=document.getElementById(divId);
	this.idName=divId;
	this.menuItems=itemsArray;
	this.links=linkArray;
	this.menuName=mName;
	this.idString='cc-menu-';
	if (mitem==0) {
		this.createMenu();
	} else {
		this.createMenu2(mitem-1);
	}
}

menu.prototype.createMenu = function () {
	var str="";
	var id;
	str='<ul id="'+this.idName+'_ul">';
	for (i=0; i<this.menuItems.length;i++) {
		id=this.idString+this.menuItems[i];
//		str+='<li id="'+id+'"><a id="'+id+'-span-a" href="'+this.links[i]+'" onclick="'+this.menuName+'.clicked('+i+')"><div id="'+id+'-span">'+this.menuItems[i]+'</div></a></li><br /> ';
		str+='<li id="'+id+'"><a id="'+id+'-span-a" href="javascript: '+this.menuName+'.clicked('+i+')"><div id="'+id+'-span">'+this.menuItems[i]+'</div></a></li><br /> ';
	}
	str+='</ul>';
	str+="<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />";
	this.id.innerHTML=str;
}

menu.prototype.createMenu2 = function (currentItem) {
	this.opacity=0;
	var itself=this;
	var obj;
	var lineHeight=21;

	//this.id.style.display="none";
	this.createMenu();
	this.selectedItem=currentItem;
	//document.getElementById(this.idString+this.menuItems[this.selectedItem]+"-span").style.color="#636466";
	//document.getElementById(this.idString+this.menuItems[this.selectedItem]+"-span-a").style.color="#636466";
	//document.getElementById(this.idString+this.menuItems[this.selectedItem]+"-span-a").className="worklink";
	document.getElementById(this.idString+this.menuItems[this.selectedItem]+"-span").className="worklink";
	

	for (i=0; i<itself.menuItems.length; i++) {
			if (i!=itself.selectedItem) {
					
					obj=document.getElementById(itself.idString+itself.menuItems[i]+"-span");
					obj.style.opacity = itself.opacity;
					obj.style.filter = 'alpha(opacity=' + itself.opacity*100 + ')';
					if (BrowserDetect.browser=="Explorer") {
						obj=document.getElementById(itself.idString+itself.menuItems[i]+"-span-a");
						obj.style.color="#E9ECE4";
					}
					//obj.filters.alpha.opacity = itself.opacity*100;
				}
			}
	//this.id.style.display="block";


	this.id.scrollTop=this.id.scrollTop+(this.selectedItem*lineHeight);
	document.getElementById(this.idString+this.menuItems[this.selectedItem]+"-span-a").href="javascript: "+this.menuName+".back();";
	document.getElementById('cc-work-a').href="javascript: "+this.menuName+".back();";
}

menu.prototype.createMenu1 = function () {
	var str="";
	var id;
	for (i=0; i<this.menuItems.length;i++) {
		id=this.idString+this.menuItems[i];
//		str+='<div id="'+id+'-span"><a href="'+this.links[i]+'" onclick="'+this.menuName+'.clicked('+i+')">'+this.menuItems[i]+'</a></div><br /> ';
		str+='<div id="'+id+'-span"><a id="'+id+'-span-a" href="javascript: '+this.menuName+'.clicked('+i+')">'+this.menuItems[i]+'</a></div><br /> ';
	}
	str+="<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />";
	this.id.innerHTML=str;
}


menu.prototype.clicked = function (itemNumber) {
	this.selectedItem=itemNumber;
	document.getElementById(this.idString+this.menuItems[this.selectedItem]+"-span").style.color="#636466";
	document.getElementById(this.idString+this.menuItems[this.selectedItem]+"-span-a").style.color="#636466";
	this.fadeOut();
}

menu.prototype.back = function () {	
	document.getElementById("project_description").style.display="none";
	document.getElementById("image_description").style.display="none";	
	document.getElementById("arrow_menu").style.display="none";	
	document.getElementById("images_menu").style.display="none";
	document.getElementById("line").style.display="none";
	document.getElementById("numbers").style.display="none";
	//document.getElementById(this.idString+this.menuItems[this.selectedItem]+"-span").style.color="#9d9fa2";
	//document.getElementById(this.idString+this.menuItems[this.selectedItem]+"-span-a").className="worklink";
	
//	document.getElementById(this.idString+this.menuItems[this.selectedItem]+"-span").style.color="#9d9fa2";

	//document.getElementById(this.idString+this.menuItems[this.selectedItem]+"-span-a").style.color="#9d9fa2";
	
	document.getElementById(this.idString+this.menuItems[this.selectedItem]+"-span").className="worklink1";
	this.moveItemDown();
	
}

menu.prototype.moveItemUp = function () {
	var itself=this;
	var lineHeight=21;
	var steps=10;
	var yDistance;
	
	yDistance=this.selectedItem*lineHeight;
	this.yMove=yDistance/steps;

	function scrolly() {
		if ((itself.id.scrollTop+itself.yMove)<itself.yEnd) {
			itself.id.scrollTop=itself.id.scrollTop+itself.yMove;
		} else {
			itself.id.scrollTop=itself.yEnd;
			clearInterval(itself.interval);
			window.location=itself.links[itself.selectedItem];
		}
	}

	this.yStart=this.id.scrollTop;
	this.yEnd=this.id.scrollTop+yDistance;
	this.interval=setInterval(scrolly,40);
}

menu.prototype.moveItemDown = function () {
	var itself=this;
	var lineHeight=21;
	var steps=10;
	var yDistance;
	
	yDistance=this.selectedItem*lineHeight;
	this.yMove=yDistance/steps;

	function scrolly1() {
		if ((itself.id.scrollTop-itself.yMove)>itself.yEnd) {
			itself.id.scrollTop=itself.id.scrollTop-itself.yMove;
		} else {
			itself.id.scrollTop=itself.yEnd;
			clearInterval(itself.interval);
			itself.fadeIn();
		}
	}

	this.yStart=this.id.scrollTop;
	this.yEnd=this.id.scrollTop-yDistance;
	this.interval=setInterval(scrolly1,40);
}

menu.prototype.fadeOut = function () {
	this.opacity=1;
	var itself=this;
	var obj;
	
	function fadingOut() {
		var step=0.08;
		var obj;
		itself.opacity-=step;

		if (itself.opacity<0) {
			clearInterval(itself.interval);
			itself.opacity=0;
			for (i=0; i<itself.menuItems.length; i++) {
				if (i!=itself.selectedItem) {
					obj=document.getElementById(itself.idString+itself.menuItems[i]+"-span");
					obj.style.opacity = itself.opacity;
					obj.style.filter = 'alpha(opacity=' + itself.opacity*100 + ')';
					if (BrowserDetect.browser=="Explorer") {
						obj=document.getElementById(itself.idString+itself.menuItems[i]+"-span-a");
						obj.style.color="#E9ECE4";
						obj=document.getElementById(itself.idString+itself.menuItems[i]+"-span");
						obj.style.color="#E9ECE4";
						//alert('ie!');

					}
					obj=document.getElementById(itself.idString+itself.menuItems[i]+"-span-a");
						obj.style.color="#E9ECE4";
						obj=document.getElementById(itself.idString+itself.menuItems[i]+"-span");
						obj.style.color="#E9ECE4";
					
					//obj.filters.alpha.opacity = itself.opacity*100;
				}
				
			}
			itself.moveItemUp();
		} else {
			for (i=0; i<itself.menuItems.length; i++) {
				if (i!=itself.selectedItem) {
					obj=document.getElementById(itself.idString+itself.menuItems[i]+"-span");
					obj.style.opacity = itself.opacity;
					obj.style.filter = 'alpha(opacity=' + itself.opacity*100 + ')';
					//obj.filters.alpha.opacity = itself.opacity*100;
				}
			}
		}
	}
	
	this.interval=setInterval(fadingOut, 50);
}

menu.prototype.fadeIn = function () {
	this.opacity=0;
	var itself=this;
	var obj;
	
	function fadingIn() {
		var step=0.08;
		var obj;
		itself.opacity+=step;

		if (itself.opacity>1) {
			clearInterval(itself.interval);
			itself.opacity=1;
			for (i=0; i<itself.menuItems.length; i++) {
				if (i!=itself.selectedItem) {
					obj=document.getElementById(itself.idString+itself.menuItems[i]+"-span");
					obj.style.opacity = itself.opacity;
					obj.style.filter = 'alpha(opacity=' + itself.opacity*100 + ')';
					if (BrowserDetect.browser=="Explorer") {
						obj=document.getElementById(itself.idString+itself.menuItems[i]+"-span-a");
						obj.style.color="#E9ECE4";
					}
					obj=document.getElementById(itself.idString+itself.menuItems[i]+"-span-a");
					obj.style.color="#9d9fa2";
					obj.className="worklink1";
					obj=document.getElementById(itself.idString+itself.menuItems[i]+"-span");
					//obj.filters.alpha.opacity = itself.opacity*100;
					//obj.style.color="#9d9fa2";
					obj.className="worklink1";
					
				}
			}
			//itself.moveItemUp();
			document.getElementById(itself.idString+itself.menuItems[itself.selectedItem]+"-span-a").href='javascript: '+itself.menuName+'.clicked('+itself.selectedItem+')';
			//document.getElementById(itself.idString+itself.menuItems[itself.selectedItem]+"-span").style.color="#636466";
	//document.getElementById(itself.idString+itself.menuItems[itself.selectedItem]+"-span-a:hover").style.color = "#636466";
			document.getElementById('cc-work-a').href="work.php";
		} else {
			for (i=0; i<itself.menuItems.length; i++) {
				if (i!=itself.selectedItem) {
					obj=document.getElementById(itself.idString+itself.menuItems[i]+"-span");
					obj.style.opacity = itself.opacity;
					obj.style.filter = 'alpha(opacity=' + itself.opacity*100 + ')';
					//obj.filters.alpha.opacity = itself.opacity*100;
				}
			}
		}
	}
	
	this.interval=setInterval(fadingIn, 50);
}

menu.prototype.id;
menu.prototype.idName;
menu.prototype.menuItems;
menu.prototype.links;
menu.prototype.menuName;
menu.prototype.selectedItem;
menu.prototype.opacity;
menu.prototype.interval;
menu.prototype.idString;
menu.prototype.yStart;
menu.prototype.yEnd;
menu.prototype.yMove;


function showSlide(id, img) {
	slideId=document.getElementById(id);
	newSlide=img;
	
}

function slideshow (divId, backId, loadId, numId, txtId, descrId, imgArray, txtArray, currentImg) {
	this.id=document.getElementById(divId);
	this.bgId=document.getElementById(backId);
	this.loadingId=document.getElementById(loadId);
	this.numbersId=document.getElementById(numId);
	this.textId=document.getElementById(txtId);
	this.descriptionId=document.getElementById(descrId);
	this.text=txtArray;
	this.images=imgArray;
	this.currentSlide=currentImg;
	this.nextSlide=this.currentSlide;
	this.started=false;
	this.active=false;
}

slideshow.prototype.show1 = function (current) {
	var itself=this;
//	if (this.active==false) {
		this.currentSlide=current;
		this.nextSlide=this.currentSlide;
		this.opacity=0;
		this.bgId.style.opacity = 0;
		this.bgId.style.filter = 'alpha(opacity=' + 0 + ')';
		//this.bgId.filters.alpha.opacity = 0;		
		this.bgId.style.display="block";
		this.bgId.style.background="#FFFFFF";
		this.id.src=itself.images[this.currentSlide];
		this.numbersId.style.display="block";
		this.textId.style.display="block";
		this.updateInfo(itself.currentSlide);
//		itself.interval=setInterval(fadingIn, 50);
			itself.opacity=1;
			itself.bgId.style.opacity = itself.opacity;
			itself.bgId.style.filter = 'alpha(opacity=' + itself.opacity*100 + ')';	
			//itself.bgId.filters.alpha.opacity = itself.opacity*100;
		this.active=true;
//	}
	
	function fadingIn() {
		var step=0.1
		itself.opacity+=step;

		if (itself.opacity>1) {
			clearInterval(itself.interval);
			itself.opacity=1;
			itself.bgId.style.opacity = itself.opacity;
			itself.bgId.style.filter = 'alpha(opacity=' + itself.opacity*100 + ')';		
			//itself.bgId.filters.alpha.opacity = itself.opacity*100;		
		} else {
			itself.bgId.style.opacity = itself.opacity;
			itself.bgId.style.filter = 'alpha(opacity=' + itself.opacity*100 + ')';
			//itself.bgId.filters.alpha.opacity = itself.opacity*100;
		}
	}
	
}



slideshow.prototype.show = function (current) {
	var itself=this;
	if (this.active==false) {
		this.currentSlide=current;
		this.nextSlide=this.currentSlide;
		this.opacity=0;
		this.bgId.style.opacity = 0;
		this.bgId.style.filter = 'alpha(opacity=' + 0 + ')';
		//this.bgId.filters.alpha.opacity = 0;
		this.bgId.style.display="block";
		this.bgId.style.background="#FFFFFF";
		this.id.src=itself.images[this.currentSlide];
		this.numbersId.style.display="block";
		this.textId.style.display="block";
		showText("show");
		this.updateInfo(itself.currentSlide);

		var newImg=new Image();
		this.loaded=false;
		newImg.onload=firstSlideLoaded;	
		newImg.src=this.images[this.nextSlide];
		setTimeout(showLoading,100);
	}

	function firstSlideLoaded() {
		itself.loaded=true;
		itself.loadingId.style.background="none";
		itself.interval=setInterval(fadingIn, 50);
		itself.active=true;

	}
		
	function showLoading() {
		if (itself.loaded==false) {
			itself.loadingId.style.background="url(images/loading.gif) center center no-repeat";	
		}
	}
	
	function fadingIn() {
		var step=0.1
		itself.opacity+=step;

		if (itself.opacity>1) {
			clearInterval(itself.interval);
			itself.opacity=1;
			itself.bgId.style.opacity = itself.opacity;
			itself.bgId.style.filter = 'alpha(opacity=' + itself.opacity*100 + ')';		
			//itself.bgId.filters.alpha.opacity = itself.opacity*100;		
		} else {
			itself.bgId.style.opacity = itself.opacity;
			itself.bgId.style.filter = 'alpha(opacity=' + itself.opacity*100 + ')';
			//itself.bgId.filters.alpha.opacity = itself.opacity*100;
		}
	}
	
}

slideshow.prototype.showThumbnails = function () {
	var itself=this;
	if (this.active==false) {
		this.currentSlide=current;
		this.nextSlide=this.currentSlide;
		this.opacity=0;
 		this.bgId.style.opacity = 0;
		this.bgId.style.filter = 'alpha(opacity=' + 0 + ')';
		//this.bgId.filters.alpha.opacity = 0;
		this.bgId.style.display="block";
		this.bgId.style.background="#FFFFFF";
		this.id.src=itself.images[this.currentSlide];
		this.numbersId.style.display="block";
		this.textId.style.display="block";
		showText("show");
		this.updateInfo(itself.currentSlide);

		var newImg=new Image();
		this.loaded=false;
		newImg.onload=firstSlideLoaded;	
		newImg.src=this.images[this.nextSlide];
		setTimeout(showLoading,100);
	}

	function firstSlideLoaded() {
		itself.loaded=true;
		itself.loadingId.style.background="none";
		
		this.active=true;

	}
	
	itself.interval=setInterval(fadingIn, 50);
	
	function fadingIn() {
		var step=0.1
		itself.opacity-=step;

		if (itself.opacity<0) {
			clearInterval(itself.interval);
			itself.opacity=0;
			itself.bgId.style.opacity = itself.opacity;
			itself.bgId.style.filter = 'alpha(opacity=' + itself.opacity*100 + ')';		
			//itself.bgId.filters.alpha.opacity = itself.opacity*100;		
		} else {
			itself.bgId.style.opacity = itself.opacity;
			itself.bgId.style.filter = 'alpha(opacity=' + itself.opacity*100 + ')';
			//itself.bgId.filters.alpha.opacity = itself.opacity*100;
		}
	}
	
}

slideshow.prototype.hide = function () {
	var itself=this;
	this.opacity=1;
	
	itself.numbersId.style.display="none";
	itself.textId.style.display="none";
	showText("show");
	
	itself.interval=setInterval(fadingIn, 50);
	
	function fadingIn() {
		var step=0.1
		itself.opacity-=step;

		if (itself.opacity<0) {
			clearInterval(itself.interval);
			itself.opacity=0;
			itself.bgId.style.opacity = itself.opacity;
			itself.bgId.style.filter = 'alpha(opacity=' + itself.opacity*100 + ')';		
			//itself.bgId.filters.alpha.opacity = itself.opacity*100;	

			itself.bgId.style.display="none";
			
			itself.active=false;	
		} else {
			itself.bgId.style.opacity = itself.opacity;
			itself.bgId.style.filter = 'alpha(opacity=' + itself.opacity*100 + ')';
			//itself.bgId.filters.alpha.opacity = itself.opacity*100;
		}
	}
	
	
}

slideshow.prototype.hide1 = function () {
	this.bgId.style.display="none";
	this.numbersId.style.display="none";
	this.textId.style.display="none";
	showText("hide");
	this.active=false;
}

slideshow.prototype.updateInfo = function (current) {
	var max;
	this.textId.innerHTML=this.text[current];
	if (current!=0) {
	//	this.descriptionId.style.display="none";
		showText("hide");
	} else {
	//	this.descriptionId.style.display="block";
		showText("show");
	}
	current++;
	if (current<10)
		current="0"+current;
	max=this.images.length;
	if (max<10) {
		max="0"+max;
	}
	this.numbersId.innerHTML='<p><span class="currentNumber">'+current+'</span>/'+max+'</p>';

}

slideshow.prototype.slideLeft = function () {
//	this.id.src=this.images[this.currentSlide];
	if (this.currentSlide==this.nextSlide) {
		if (this.currentSlide>0) {
			this.nextSlide--;
		} else {
			this.nextSlide=this.images.length-1;
		}
		this.updateInfo(this.nextSlide);
		this.loadNextSlide();
		//this.fadeOut();
	}
}

slideshow.prototype.slideRight = function () {
//	this.id.src=this.images[this.currentSlide];
	if (this.currentSlide==this.nextSlide) {
		if (this.currentSlide<(this.images.length-1)) {
			this.nextSlide++;
		} else {
			this.nextSlide=0;
		}
		this.updateInfo(this.nextSlide);
		this.loadNextSlide();
		//this.fadeOut();
	}
}


slideshow.prototype.loadNextSlide = function () {
	
	var itself=this;
	
	theself=this;
	var newImg=new Image();
	this.loaded=false;
	newImg.onload=nextSlideLoaded;	
	newImg.src=this.images[this.nextSlide];

	function nextSlideLoaded() {
		itself.loaded=true;
		itself.loadingId.style.background="none";
		itself.fadeOut();
	}

	setTimeout(showLoading,100);
	
	function showLoading() {
		if (itself.loaded==false) {
			itself.loadingId.style.background="url(images/loading.gif) center center no-repeat";	
		}
	}

}

slideshow.prototype.fadeOut = function () {
	this.id.style.opacity = 1;
	this.id.style.filter = 'alpha(opacity=' + 100 + ')';
	//this.id.filters.alpha.opacity = 100;
	this.opacity=1;
	var itself=this;

	function fadingOut() {
		var step=0.08;
		itself.opacity-=step;

		if (itself.opacity<0) {
			clearInterval(itself.interval);
			itself.opacity=0;
			itself.id.style.opacity = itself.opacity;
			itself.id.style.filter = 'alpha(opacity=' + itself.opacity*100 + ')';
			//itself.id.filters.alpha.opacity = itself.opacity*100;			
			itself.id.src=itself.images[itself.nextSlide];
			//itself.fadeIn();
			itself.opacity=1;
			itself.id.style.opacity = itself.opacity;
			itself.id.style.filter = 'alpha(opacity=' + itself.opacity*100 + ')';
			//itself.id.filters.alpha.opacity = itself.opacity*100;			
			itself.currentSlide=itself.nextSlide;
		} else {
			itself.id.style.opacity = itself.opacity;
			itself.id.style.filter = 'alpha(opacity=' + itself.opacity*100 + ')';
			//itself.id.filters.alpha.opacity = itself.opacity*100;
		}
	}
//	this.bgId.style.background="url("+itself.images[itself.nextSlide]+") top left no-repeat";
	this.bgId.style.background="#FFFFFF url("+itself.images[itself.nextSlide]+") top left no-repeat";
	this.interval=setInterval(fadingOut, 50);
}

slideshow.prototype.fadeIn = function () {
	this.id.style.opacity = 0;
	this.id.style.filter = 'alpha(opacity=' + 100 + ')';
	//this.id.filters.alpha.opacity = 100;
	this.opacity=0;
	var itself=this;

	function fadingIn() {
		var step=0.1
		itself.opacity+=step;

		if (itself.opacity>1) {
			clearInterval(itself.interval);
			itself.opacity=1;
			itself.id.style.opacity = itself.opacity;
			itself.id.style.filter = 'alpha(opacity=' + itself.opacity*100 + ')';
			//itself.id.filters.alpha.opacity = itself.opacity*100;			
			itself.currentSlide=itself.nextSlide;
		} else {
			itself.id.style.opacity = itself.opacity;
			itself.id.style.filter = 'alpha(opacity=' + itself.opacity*100 + ')';
			//itself.id.filters.alpha.opacity = itself.opacity*100;
		}
	}
	
	itself.interval=setInterval(fadingIn, 50);
}

slideshow.prototype.fadeIn1 = function () {
	this.id.style.opacity = 0;
	this.id.style.filter = 'alpha(opacity=' + 0 + ')';
	//this.id.filters.alpha.opacity = 0;
	this.opacity=0;
	interval=setInterval('this.fadingIn()',50);	
}

slideshow.prototype.fadingIn1 = function () {
	var step=0.1;
	this.opacity+=step;
	if (this.opacity>1) {
		this.opacity=1;
		this.id.style.opacity = this.opacity;
		this.id.style.filter = 'alpha(opacity=' + this.opacity*100 + ')';
		//this.id.filters.alpha.opacity = this.opacity*100;
		clearInterval(this.inverval);
		this.currentSlide=this.nextSlide;
	} else {
		this.id.style.opacity = opacity;
		this.id.style.filter = 'alpha(opacity=' + this.opacity*100 + ')';
		//this.id.filters.alpha.opacity = this.opacity*100;
	}
}

slideshow.prototype.images;
slideshow.prototype.id;
slideshow.prototype.bgId;
slideshow.prototype.loadingId;
slideshow.prototype.numbersId;
slideshow.prototype.textId;
slideshow.prototype.descriptionId;
slideshow.prototype.currentSlide;
slideshow.prototype.nextSlide;
slideshow.prototype.opacity;
slideshow.prototype.intervali;
slideshow.prototype.loaded;
slideshow.prototype.started;
slideshow.prototype.active;
slideshow.prototype.text;



	
var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
 			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};

function displayMenu() {
	document.getElementById("project_description").style.display="none";
	document.getElementById("image_description").style.display="none";	
	document.getElementById("arrow_menu").style.display="none";	
	document.getElementById("numbers").style.display="none";
	smenu.back();
}
