function getFunc(s) {
	return function() { eval(s); };
}

function initHS1F(){
	imgBox=document.getElementById("image_box") // element containing the images
	txtBox=document.getElementById("text_box") // element containing the images
	imgNum=is1hbArr.length // number of images

	if(document.getElementById&&document.all&&document.compatMode!="CSS1Compat"){
		ieBorder=parseInt(document.getElementById("inner_box").style.borderWidth)*2
	}
	else{
		ieBorder=0
	}

	for(var i=0;i<imgNum;i++){ // set image size
		//create img tag
		newImg=document.createElement("IMG")
		newImg.setAttribute("src",is1hbArr[i][0])
		newImg.setAttribute("id","pic"+i)
		newImg.i=i
		newImg.onclick = getFunc(is1hbArr[i][2]);

		if(imageSize!=0){ // use percentage size
			newImg.style.width=preload[i].width/100*imageSize+"px"
			newImg.style.height=preload[i].height/100*imageSize+"px"
		}
		else{ // use fixed size
			newImg.style.width=fixedWidth+"px"
			newImg.style.height=fixedHeight+"px"
		}
		newImg.style.cursor="pointer"
		imgBox.appendChild(newImg)
	
		//create p for text tag
		newTxt=document.createElement("P")
		newTxt.setAttribute("id","txt"+i)
		newTxt.i=i
		newTxt.onclick = getFunc(is1hbArr[i][2]);
		newTxt.style.width=fixedTxtWidth+"px"
		newTxt.style.height=fixedTxtHeight+"px"
		newTxt.style.cursor="pointer"
		txtBox.appendChild(newTxt)
		
	} //END FOR

	for(var i=0;i<imgNum;i++){
		totalWidth+=(document.getElementById("pic"+i).offsetWidth)
		document.getElementById("pic"+i).style.marginRight=spacerWidth+"px"		//right margin
		document.getElementById("pic"+i).alt="Click to view detail"		//right margin

		document.getElementById("txt"+i).style.marginRight=6+"px"
		document.getElementById("txt"+i).style.color=is1hbArr[i][3]
		document.getElementById("txt"+i).innerHTML=is1hbArr[i][1]

		if(autoWidth==1){
			if(document.getElementById("pic"+i).offsetWidth>displayWidth){
			displayWidth=document.getElementById("pic"+i).offsetWidth
			}
		}
		else{
			displayWidth=parseInt(document.getElementById("inner_box").style.width)
		}

		if((document.getElementById("pic"+i).offsetHeight+document.getElementById("pic"+i).offsetHeight)>displayHeight){
			displayHeight=document.getElementById("pic"+i).offsetHeight+document.getElementById("txt"+i).offsetHeight
		}

	} //END FOR

	for(var i=0;i<imgNum;i++){ // vertically center images
//		document.getElementById("pic"+i).style.marginBottom=(displayHeight-document.getElementById("pic"+i).height)/2+"px"
		document.getElementById("pic"+i).style.marginBottom="5px"
	}

	totalWidth=totalWidth+(imgNum*spacerWidth) // Total width of all images

	imgHolderWidth=displayWidth+ieBorder //adjust inner and outer box width for borders
//	document.getElementById("outer_box").style.width=imgHolderWidth+"px"
	document.getElementById("inner_box").style.width=imgHolderWidth+"px"
	imgBox.style.width=totalWidth+"px"
	txtBox.style.width=totalWidth+"px"

	imgHolderHeight=displayHeight+ieBorder  //adjust inner height
	document.getElementById("inner_box").style.height=imgHolderHeight+"px" 
	document.getElementById("inner_box").style.clip="rect(0,"+(imgHolderWidth+"px")+","+(imgHolderHeight+"px")+",0)"

}

leftTimer=""
function scrollHS1F(n){

	clearTimeout(leftTimer)
	imgBoxPos=parseInt(imgBox.style.left)
	if(n==1){
		imgBoxPos-=speed
	}
	else{
		imgBoxPos+=speed
	}

	imgBox.style.left=imgBoxPos+"px"
	txtBox.style.left=imgBoxPos+"px"
	leftTimer=setTimeout("scrollHS1F("+n+")",50)


	if(n==1&&imgBoxPos < -(totalWidth-imgHolderWidth)+(spacerWidth-ieBorder)){
	imgBox.style.left=-(totalWidth-imgHolderWidth)+spacerWidth-ieBorder+"px"
	clearTimeout(leftTimer)
	}

	if(n==0&&imgBoxPos> 0-speed){
		imgBox.style.left=0
		txtBox.style.left=0
		clearTimeout(leftTimer)
	}

}

function fast(){
	speed=maxSpeed
}

function slow(){
	speed=defaultSpeed
}

function pause(){
	clearTimeout(leftTimer)
}

lastN=0
count=0
fading=0
fadeStep = 2
fadeSpeed=10
minFadeValue=0

function initFade(n){
	count=n
	if(lastN==n||fading==1){return}

	if(dualFade==0){fadeValue=0}
	else{fadeValue=100}

	picNum=n
	lastN=n
	fadePic()
}
/*
function fadePic(){
	displayEl=document.images["bigpic"]
	fading=1
	fadeValue -= fadeStep
	fadeTimer=setTimeout("fadePic()",fadeSpeed)

	if(displayEl.filters){
		displayEl.filters.alpha.opacity=fadeValue}
	else{
		displayEl.style.MozOpacity=(fadeValue/100)-0.1}

	if(fadeValue<minFadeValue){ // for fade out first
		fadeValue=minFadeValue
		fadeStep= -fadeStep
		displayEl.src=is1hbArr[picNum][1]
	}

	if(fadeValue>=100){ // fade in
		fadeValue=100
		fadeStep= -fadeStep
		fading=0
		clearTimeout(fadeTimer)
	}
}

maxOpac=70
minOpac=100

function toggleOpac(obj){

	if(obj.filters){

		if(obj.filters.alpha.Opacity==minOpac){
			obj.filters.alpha.Opacity=maxOpac}
		else{obj.filters.alpha.Opacity=minOpac}

	}
	else{

		if(obj.style.opacity == maxOpac/100){
			obj.style.opacity = minOpac/100}
		else{obj.style.opacity = maxOpac/100}

	}

}
*/
//add onload="initHS1F()" to the opening BODY tag

