


// -----------------------------------------------------------------------------------
// 
// This page coded by Scott Upton
// http://www.uptonic.com | http://www.couloir.org
//
// Associated API copyright 2002, Travis Beckham (www.squidfingers.com)
//
// -----------------------------------------------------------------------------------
// --- version date: 06/08/05 ------------------------------------------------------

fullscreen=function(){
	self.moveTo(0,0);self.resizeTo(screen.availWidth,screen.availHeight);
	}

API=new Detect();

loadAPI=function(){
	API.Container=new HTMLobj('Container');
	API.Photo=new HTMLobj('Photo');
	API.PhotoContainer=new HTMLobj('PhotoContainer');
//	API.LinkContainer=new HTMLobj('LinkContainer');
//	API.MenuContainer=new HTMLobj('MenuContainer');
//	API.PrevLink=new HTMLobj('PrevLink');
//	API.NextLink=new HTMLobj('NextLink');
	API.LoadImg=new HTMLobj('LoadImg');
cyclePhoto(photoId);
}


onload=loadAPI;

initFade=function(){
	API.PhotoContainer.show();
	var fade_timer=setInterval('startFade()',1000);
	startFade=function(){
		if(API.Container._tweenRunning==false){
		clearInterval(fade_timer);
		var adv_timer=setInterval('permitNextPrev()',500);
		permitNextPrev=function(){
			if(API.Photo._fadeRunning==false){
				clearInterval(adv_timer);
//			API.LinkContainer.displayShow();

//				document.getElementById('NextLink').onclick=nextPhoto;
//				document.getElementById('PrevLink').onclick=prevPhoto;
				for(var i=0; i<photoNum;i++){
						restoreThumbLinks(i);}
			}else{
			return;
			}
			}
	API.LoadImg.setSrc("/imagenes/c.gif");
	API.Photo.fadeIn(0,15,33);
	}else{
		return;
		}
	}
}

restoreThumbLinks=function(thumbId){
	thisThumb="Thumb"+thumbId;thisCyclePhoto = function(){
		if(photoId !== thumbId){
			cyclePhoto(thumbId);
			photoId = thumbId;
		}
	}
	document.getElementById(thisThumb).onclick=thisCyclePhoto;
}

falsify=function(){
	return false;
}


//nextPhoto=function(){if(photoId==(photoArray.length-1)){photoId=0;}else{photoId++;}cyclePhoto(photoId);}

//prevPhoto=function(){if(photoId==0){photoId=photoArray.length-1;}else{photoId--;}cyclePhoto(photoId);}



changeElementClass=function(objId,setClass){
	document.getElementById(objId).className=setClass;
}

//toggleActiveMenu=function(){API.MenuContainer.displayShowHide();if(document.getElementById('MenuLink').className=="selected"){changeElementClass('MenuLink','none');}else{changeElementClass('MenuLink','selected');}}

toggleActiveThumb=function(newThumb){
	var oldThumb=activeThumb;
	if(oldThumb&&newThumb)changeElementClass(oldThumb,'');
	if(newThumb)changeElementClass(newThumb,'selected');
	activeThumb=newThumb;
}

toggleActiveDesc=function(newThumbDesc) {
	document.getElementById('desc').childNodes[0].nodeValue = document.getElementById(newThumbDesc).title;
}


cyclePhoto=function(photoId){
	API.LoadImg.setSrc("/imagenes/loading_ani.gif");
//	if(document.getElementById('MenuLink').className=="selected"){changeElementClass('MenuLink','none');}
	var newThumbDesc="Thumb"+photoId;
	toggleActiveDesc (newThumbDesc);
	var newThumb="Thumb"+photoId;
	toggleActiveThumb(newThumb);
//	API.MenuContainer.displayHide();
//	API.LinkContainer.displayHide();
	API.Photo.hide();
	API.Photo.setOpacity(0);
//	var wNew=photoArray[photoId][1];
//	var hNew=photoArray[photoId][2];
//	var wCur=API.Container.getWidth()-borderSize;
//	var hCur=API.Container.getHeight()-borderSize;
//	setTimeout('API.Container.tweenTo(easeInQuad, ['+wCur+', '+hCur+'], ['+wNew+','+hNew+'], 7)',500);
//	setTimeout('API.LinkContainer.sizeTo('+wNew+','+hNew+')',500);
//	setTimeout('API.PrevLink.sizeTo('+wNew/2+','+hNew+')',500);
//	setTimeout('API.NextLink.sizeTo('+wNew/2+','+hNew+')',500);
	var newPhoto=photoDir+photoArray[photoId][0];
	API.Photo.setSrc(newPhoto);
//	API.Photo.sizeTo(wNew,hNew);
//	API.NextLink.setHref("#"+(photoId+1));
//	API.PrevLink.setHref("#"+(photoId+1));
	document.getElementById('Photo').onload=initFade;
//	document.getElementById('NextLink').onclick=falsify;
//	document.getElementById('PrevLink').onclick=falsify;
	for(var i=0;i<photoNum;i++){
		document.getElementById('Thumb'+i).onclick=falsify;
		}
}