// Full photos - dependent on transitions.js
var fullphotoContainer
var fullDesc
var fullCheck = false;
var hidebutt
var currentFull = ''
var fullPhotoTimer = null
var hidebutty = "340px"
	
function setup_photosFull() {
	fullphotoContainer = document.getElementById('full-photo')

	fullDesc = document.getElementById('you-have-chosen-wisely')
	hidebutt = document.getElementById('hidebutt')
	fader('you-have-chosen-wisely', 0)

	var thumbs=document.getElementsByName('thumbs')
	for(i=0; i<thumbs.length; i++) {
		thumbs[i].onclick=function(){get_fullPhoto(this); return false; }
	}
}
function get_fullPhoto(a) {
	with(document) {
		
		var previousFull = currentFull
		currentFull = 'full-'+a.id.substring(6)
		
		if(previousFull != '' && previousFull != currentFull) slide(previousFull,0,200,false)
		
		var fullIMG = getElementById(currentFull)
		if(!fullIMG) {
			fade('loading-photos',0,25,true)
			var fullPhoto = new Image()
			
			getElementById('full-photo').appendChild(fullPhoto)
			fullPhoto.id = currentFull
			fullPhoto.src = a.rel
			fullPhoto.alt = a.title
			fullPhoto.style.height = "400px"
			slider(currentFull,400)
			fullPhoto.onload = function(){fullPhotoLoaded(this)}
		} else if(previousFull != currentFull) {
			fullIMG.style.display = 'block'
			slide(currentFull,400,50,true)
			showTitle(fullIMG.alt)
			showHide(fullIMG)
		} else return

		fullphotoContainer.style.height = '400px'
		if(fullPhotoTimer) clearTimeout(fullPhotoTimer);

	}
}
function showTitle(title) {
	if(title) {
		fullDesc.innerHTML = '<p>'+title.replace("/\n/g","<br/>")+'</p>'
		fullDesc.style.top = "40px"
		fade('you-have-chosen-wisely',0,12,true)
	} else {
		fade('you-have-chosen-wisely', 100, 20, false)
		fullPhotoTimer = window.setTimeout('hideTitle()',150)
	}
}
function hideTitle(photo) {
	fullDesc.style.top = "-1000px"
	if(photo) shrinkFullPhoto()
}
function fullPhotoLoaded(photo) {
	with(photo) {
		style.left = ((1000-width)/2) + 'px'
		slide(id,400,50,true)
		showTitle(alt)	
		onclick = function(){removeFullPhoto(this)}
		showHide(photo)
	}
	fade("loading-photos",100,25,false)
}
function removeFullPhoto(photo) {
	with(photo) {
		fullCheck = false
		slide(id,0,50,false)
		fade('hidebutt',100,25,false)
		currentFull=''

		if(alt) {
			fade('you-have-chosen-wisely',100,20,false)
			fullDesc.innerHTML = ''
			fullPhotoTimer = window.setTimeout('hideTitle("true")',400)
		} else 	fullPhotoTimer = window.setTimeout('shrinkFullPhoto()',400)
	}
}
function shrinkFullPhoto() {
	document.getElementById('full-photo').style.height = '0px'
	hidebutt.style.top = "-1000px"
}
function showHide(photo) {
	if(!fullCheck) 	fade('hidebutt',0,25,true)
	fullCheck = true
	hidebutt.style.top = hidebutty;
	hidebutt.onclick = function(){ removeFullPhoto(photo); fade('hidebutt',100,25,false); return false; }	
}