leftdisabled = true;
rightdisabled = true;
widthLength = 640;

function fp_ie4() {
return true;
//	var nav = navigator.appVersion.indexOf("MSIE");
//	return (nav>0) && (parseInt(navigator.appVersion.substring(nav+5, nav+6)) >= 4);
}

function fp_ns6() {
return false;
//	return ((navigator.appName == "Netscape") &&
//				(parseInt(navigator.appVersion.substring(0, 1)) >= 5))
}

function fp_ShowImg(src, sWidth, sHeight, sID, iIndex)
{	
	var el = document.images["fpGalleryMainImg_" + sID];
	if (el) {
		
			el.style.visibility = "hidden"; 
			el.src = src.lowsrc;
			el.style.width = sWidth + "px";
			el.style.height = sHeight + "px";
				
			var caption = document.getElementById("fpGalleryCaptions_" + sID).getElementsByTagName("div");			
			var sCaptionTxt;
			var sCaptionHTML;
			
			if (caption && caption[iIndex]) {
				sCaptionTxt = caption[iIndex].innerText;
				sCaptionHTML = caption[iIndex].innerHTML;
			} else {
				sCaptionTxt = "";
				sCaptionHTML = "";
			}
			
			el.title = sCaptionTxt;
			el.style.visibility = "visible";
			
			var el = document.getElementById("fpGalleryCaptionCell_" + sID);
			if (el) {
				el.innerHTML = sCaptionHTML;
			}
			
			var el = document.getElementById("fpGalleryDescCell_" + sID);
			if (el) {
				var sDesc = document.getElementById("fpGalleryDescriptions_" + sID).getElementsByTagName("div");
				el.innerHTML = sDesc && sDesc[iIndex]?sDesc[iIndex].innerHTML:"";
			}
	}
}

function fp_ScrollLeft(sID) {

	var el = document.getElementById("fpGalleryListCell_" + sID);
	if (el) {
		var coll = el.getElementsByTagName("A"); 
		var count = 20;

		if (coll) {
			for (i=1;i<coll.length;i++) {
				if (coll[i].style.display != "none") {
					coll[i-1].style.display = "inline";
					break;	
				}
			}
			
			for (i=0;i<coll.length;i++) {
				if (coll[i].style.display != "none") {
					var images = coll[i].getElementsByTagName("img");
					count += 20 + images[0].width;
					
					if (count > widthLength)				
						{coll[i].style.display = "none";}
				}
			}

			if ((el.scrollWidth - 5) >= el.clientWidth) {
				var btn = document.getElementById("fpGalleryRightBtn_" + sID);
				if (btn && rightdisabled) {
					rightdisabled = false;
					te = btn.src;
					btn.src = btn.lowsrc;
					btn.lowsrc = te;
				}
			}
			
			if (coll[0].style.display != "none") {
				var btn = document.getElementById("fpGalleryLeftBtn_" + sID);
				if (btn && !leftdisabled) {
					leftdisabled = true;
					te = btn.src;
					btn.src = btn.lowsrc;
					btn.lowsrc = te;
				}
			}
		}
		
	}
}

function fp_ScrollRight(sID) {

	var el = document.getElementById("fpGalleryListCell_" + sID);
	if (el) {
		if (!rightdisabled)
		{
			var coll = el.getElementsByTagName("A"); 
			if (coll) {
			    var state = 0;
				var count = 20;
				for (i=0;i<coll.length;i++) {
					if (state == 0)
					{
						if (coll[i].style.display != "none") {
							coll[i].style.display = "none";	
							state = 1;
						}
					}
					else{
					var images = coll[i].getElementsByTagName("img");
						count += 20 + images[0].width;
						if (count < widthLength)
							{coll[i].style.display = "inline";}
						else
							{coll[i].style.display = "none";}
					}
				}
			}
		
			var btn = document.getElementById("fpGalleryRightBtn_" + sID);
			if (btn && coll[coll.length - 1].style.display != "none") {
				rightdisabled = true;
				te = btn.src;
				btn.src = btn.lowsrc;
				btn.lowsrc = te;
			}
			
			var btn = document.getElementById("fpGalleryLeftBtn_" + sID);
			if (btn && leftdisabled) {
				te = btn.src;
				btn.src = btn.lowsrc;
				btn.lowsrc = te;
				leftdisabled = false;
			}
		}		
	}
}

