// COPYRIGHT 2002 Jennifer Madden
// jennifermadden.com
// this function is used specifically for the global and page-to-page functions only
function FormObject(name,type,elName,buttonFunction){
this.formopen = "<form name=\""+name+"\" action=\"index.html\" method=\"get\">\n"
this.selectopen = "<select name=\"weeks\" onChange=\"this.form.submit()\" class=\"submit\">\n"
this.selectclose = "</select>\n"
this.inputtype = "<input type=\""+type+"\" "+buttonFunction+" name=\""+elName+"\" class=\"submit\">\n"
this.submitLast = "<input type=\"submit\" onClick=\"buttonLast()\" value=\"Last\" class=\"submit\">"
this.submitNext = "<input type=\"submit\" onClick=\"buttonNext()\" value=\"Next\" class=\"submit\">"
this.formclose = "</form>\n"

this.writeMenu=writeMenu //writeMenu is the method that writes the drop-down menu
this.writeP2P=writeP2P  //writeP2P is method that writes last and next buttons
}

function writeMenu(){ 
getLocation()
document.open()
document.write(this.formopen)
document.write(this.selectopen)
if(isNaN(searchString)){
searchString=0// if user has just arrived, all is selected
}
	for(i=0; i<titles.length; i++){	
		if(i==searchString){
		this.isselected = " selected" // if statement determines which option is selected
		}
		else {
		this.isselected = ""
		}
		
	this.value=i
	this.content=titles[i]+"\n"
	this.option = "<option "+this.isselected+" value=\""+this.value+"\" class=\"submit\">"
	document.write(this.option)
	document.write(this.content)
	}

document.write(this.selectclose)
document.write(this.formclose)
document.close()
}

function writeP2P(){
getLocation()
//document.open()
document.write(this.formopen)
document.write(this.inputtype)
if(wNum != 1){
document.write(this.submitLast + " ")
}
if(wNum != week.length-1){
document.write(this.submitNext)
}
document.write(this.formclose)
//document.close()
}