var imgPanDivId = 'imgpan';
var imgHolderDivId = 'imgholder';
var txtHolder = 'imgdescription';
var imgPanDivWidth = 0;
var imgPanDivOpacity = 0;
var activeTimeout = 0;

function showImg(el,txt,width,height){
	if(width==undefined)
	width='160'
	if(height==undefined)
	height='120'
	if(document.getElementById){
		remImgContent();
		panEl = document.getElementById(imgPanDivId);
		imgEl = document.getElementById(imgHolderDivId);
		txtPan = document.getElementById(txtHolder);
		
		if(panEl != undefined && imgEl != undefined){
			path = el.getAttribute('href');
			
			if(path.search(/\.jpg/) != -1 || path.search(/\.gif/) != -1){
				nEl = document.createElement('img');
				nEl.setAttribute('src',path);
				imgEl.appendChild(nEl);
				panEl.style.display = 'block';
			}
			else if(path.search(/\.mov/) != -1 || path.search(/\.avi/) != -1 || path.search(/\.mp4/) != -1){
				nEl = document.createElement('embed');
				nEl.setAttribute('src',path);
				nEl.setAttribute('autostart','true');
				nEl.setAttribute('width',width);
				nEl.setAttribute('height',height);
				nEl.setAttribute('CONTROLLER','false');
				imgEl.appendChild(nEl);
				panEl.style.display = 'block';
	
	}
			
			txtPan.innerHTML = txt;
			//txtPan.firstChild.nodeValue = txt;

			if(document.all){ // ie
				panEl.style.position = "absolute";
				if(document.body.scrollTop){ // IE <6
					panEl.style.top = (document.body.scrollTop+10)+"px";
					panEl.style.bottom = (-document.body.scrollTop-10)+"px";
				}
				else if(document.documentElement.scrollTop){ // IE 6
					panEl.style.top = (document.documentElement.scrollTop+10)+"px";
					panEl.style.bottom = (-document.documentElement.scrollTop-10)+"px";
				}
			}
			if(activeTimeout!=0)
				window.clearTimeout(activeTimeout);
			slideinImgpan();
			// disable orig link location
			return false;
		}
	}
	// enable orig link location
	return true;
	
}

function slideinImgpan(){
	if(imgPanDivOpacity < 1){
		
		imgPanDivOpacity+=0.3;
		panEl = document.getElementById(imgPanDivId);
		if(panEl != undefined){
			//panEl.style.width = imgPanDivWidth+"px";
			//panEl.style.right = "0px";
			panEl.style.opacity = imgPanDivOpacity;
			window.setTimeout('slideinImgpan()',1);
		}
	}
}

function slideoutImgpan(){
	if(imgPanDivOpacity > 0){
		imgPanDivOpacity-=0.2;
		panEl = document.getElementById(imgPanDivId);
		if(panEl != undefined){
			//panEl.style.width = imgPanDivWidth+"px";
			//panEl.style.right = "0px";
			panEl.style.opacity = imgPanDivOpacity;
			window.setTimeout('slideoutImgpan()',1);
		}
	}
	else{
			panEl.style.display = 'none';
	}
}

function remImgContent(){
	if(document.getElementById){
		panEl = document.getElementById(imgPanDivId);
		imgEl = document.getElementById(imgHolderDivId);
		if(panEl != undefined && imgEl != undefined){
			while(imgEl.hasChildNodes()){
				imgEl.removeChild(imgEl.firstChild);
			}
			//panEl.style.visibility = 'hidden';
		}
	}
}
function hideImg(){
	if(activeTimeout!=0)
		window.clearTimeout(activeTimeout);
	slideoutImgpan();
}


var legendEl=undefined
function highlight(id){
	
	legendEl = document.getElementById(id)
	legendEl.className = "highlight"
	
}
function unhighlight(){
	
	if(legendEl!=undefined)
		legendEl.className = ""
	
}



function showMovie(targetId,src,width,height){
	if(width==undefined)
	width='160'
	if(height==undefined)
	height='120'
	if(document.getElementById){
		remImgContent();
		targetEl = document.getElementById(targetId);
		
		if(targetEl != undefined){
			
			
			
				nEl = document.createElement('embed');
				nEl.setAttribute('src',src);
				nEl.setAttribute('autostart','true');
				nEl.setAttribute('width', "+width");
				nEl.setAttribute('height', "+height");
				nEl.setAttribute('CONTROLLER','false');
				targetEl.appendChild(nEl);
				targetEl.style.display = 'block';
			
		}
	}
	
}

