var desc = new Array(18)
desc[1] = "Green Fields of Rupnagar"
desc[2] = "Agampur Bridge"
desc[3] = "Sunset at River Satluj"
desc[4] = "White City Anadpur Sahib"
desc[5] = "A Scene of River Satluj"
desc[6] = "Sunset at River Satluj"
desc[7] = "A View of Agampur Bridge"
desc[8] = "Sunset at River Satluj"
desc[9] = "Sunset at River Satluj"
desc[10] = "Charan Ganga Stadium, Anandpur Sahib"
desc[11] = "Dara Studio, Mohali"
desc[12] = "Guru Gobind Singh Marg"
desc[13] = "Lake at Nangal"
desc[14] = "Pandaal Erected During 300th Years Celebrations of Khalsa"
desc[15] = "Punjab School Education Board, Mohali"
desc[16] = "PCA Cricket Stadium, Mohali"
desc[17] = "Gurudwara Keshgarh Sahib"



var i = 1

function goSlide(ctr) {		
	i = ctr
	initialize()
	return false
}

function initialize() {	
	document.images[0].src =  "../images/" + i + ".jpg"
	document.images[0].alt =  desc[i]
	document.preview.b_slide.value = "Photo #" + i
	//document.preview.b_title.value = desc[i]
	if (i == 1) 
		document.preview.b_previous.disabled = true
	else if (document.preview.b_previous.disabled)
			document.preview.b_previous.disabled = false
	
	if (i == 17) 
		document.preview.b_next.disabled = true
	else if (document.preview.b_next.disabled) 
			document.preview.b_next.disabled = false
	
	return
}

function previous() {		
	i--
	if (i==0) i=17 //i=last image
	initialize()
	return false
}

function first() {
	i = 1
	initialize()
	return false
}

function last() {
	i = 17
	initialize()
	return false
}


function next() {	
	i++
	i %= 18 //divide by total images plus one
	if (i==0) i=1
	initialize()
	return false
}




function setHeading() {	
	document.writeln('<P class="heading">Photo Gallery</P>')
	return
}

function setSlide() {	
	document.writeln('<img src="../images/'+i+'.jpg" width="550" height="370" border="0">')
	return
}

function setForm() {	
	document.writeln('<form name="preview">')
	document.writeln('<table cellpadding=0 cellspacing=0 border=0>')
//	document.writeln('<tr align="center">')
//	document.writeln('<td colspan="5"><input type="text" name="b_title" value="" style="width:100%;font-size:10pt; font-weight:normal; color:#000000; background-image:url(../images/back.jpg)" readonly></td>')
//	document.writeln('</tr>')
	document.writeln('<tr>')
	document.writeln('	<td><input type="button" name="b_previous" value="Previous" onclick="return previous()"></td>')
	document.writeln('	<td><input type="button" name="b_first" value="First" onclick="return first()"></td>')
	document.writeln('	<td><input type="button" name="b_slide" value="Photo #1"></td>')
	document.writeln('	<td><input type="button" name="b_last"   value="Last" onclick="return last()"></td>')
	document.writeln('	<td><input type="button" name="b_next"  value="Next" onclick="return next()"></td>')
	document.writeln('</tr>')
	document.writeln('</table>')
	document.writeln('</form>')
	return
}

function setDocument(ctr){
	document.writeln('<html>')
	document.writeln('<head>')
	document.writeln('<title>Photo #'+ctr+'</title>')
	document.writeln('<link rel=stylesheet href="../css/global.css" type="text/css">')
	document.writeln('<script language="JavaScript" src="../js/slide.js">')
	document.writeln('<!--')
	document.writeln('//-->')
	document.writeln('</script>')
	document.writeln('</head>')
	document.writeln('<body>')

	document.writeln('<center>')
	document.writeln('<script language="JavaScript">')
	document.writeln('<!--')
	document.writeln('setSlide()')
	document.writeln('setForm()')
	document.writeln('goSlide('+ctr+')')
	document.writeln('//-->')
	document.writeln('</script>')
	document.writeln('</center>')
	document.writeln('</body>')
	document.writeln('</html>')
}