function showTerm(str) {
	equiTerms = window.open(str, 'terms', 'width=400,height=300,resizable=1,status=0,scrollbars=1,toolbar=0,menubar=0');
	equiTerms.focus()
}

function showPage(str, width, height) {
	equiPage = window.open(str, 'page', 'width='+width+',height='+height+',resizable=1,status=0,scrollbars=1,toolbar=0,menubar=0');
	equiPage.focus()
}

function gotoURL(myURL){
  location.href=myURL
}
function spambot(mailbox, domain, name) {
	 if (name == null){
   name = mailbox + "@" + domain
   }
   document.write("<a href=\"mailto");
   document.write(":" + mailbox + "@");
   document.write(domain + "\">" + name + "<\/a>");
}
function equiPopUnder(str, width, height) {
	equiPop = window.open(str, 'page', 'width='+width+',height='+height+',resizable=1,status=0,scrollbars=1,toolbar=0,menubar=0');
	equiPop.blur()
	window.focus()
}
function textCounter(field, countfield, maxlimit) {
	if (field.value.length > maxlimit) // if too long...trim it!
		field.value = field.value.substring(0, maxlimit);
		// otherwise, update 'characters left' counter
	else 
		countfield.value = maxlimit - field.value.length;
	}
var funds = new Object()
	// Rydex
	funds["nmr"] = "RYOCX"
	funds["rmr"] = "RYMKX"
	funds["smr"] = "RYNVX"
	funds["ndr"] = "RYVYX"
	funds["rdr"] = "Not available"
	funds["sdr"] = "RYTNX"
	funds["nir"] = "RYAIX"
	funds["rir"] = "RYSHX"
	funds["sir"] = "RYURX"
	funds["nvr"] = "RYVNX"
	funds["rvr"] = "Not available"
	funds["svr"] = "RYTPX"
	
	// ProFunds
	funds["nmp"] = "OTPIX"
	funds["rmp"] = "SLPIX"
	funds["smp"] = "BLPIX"
	funds["ndp"] = "UOPIX"
	funds["rdp"] = "UAPIX"
	funds["sdp"] = "ULPIX"
	funds["nip"] = "SOPIX"
	funds["rip"] = "SHPIX"
	funds["sip"] = "BRPIX"
	funds["nvp"] = "USPIX"
	funds["rvp"] = "UCPIX"
	funds["svp"] = "URPIX"

function process() {
	document.customForm.bull_index[0].checked = true
	document.customForm.bull_type[0].checked = true
	document.customForm.bull_product[0].checked = true
	
	document.customForm.bear_index[0].checked = true
	document.customForm.bear_type[0].checked = true
	document.customForm.bear_product[0].checked = true
	
	selectFunds(document.customForm.bull_index, document.customForm.bull_type, document.customForm.bull_product, document.customForm.bull_text)
	selectFunds(document.customForm.bear_index, document.customForm.bear_type, document.customForm.bear_product, document.customForm.bear_text)
}

function selectFunds(anIndex, aType, aComp, aText) {
	iInd = 0
	while(!anIndex[iInd].checked)
		iInd++
	fundIndex = anIndex[iInd].value
	iTyp = 0
	while(!aType[iTyp].checked)
		iTyp++
	fundIndex = fundIndex + aType[iTyp].value
	iComp = 0
	while(!aComp[iComp].checked)
		iComp++
	fundIndex = fundIndex + aComp[iComp].value
	
	if (funds[fundIndex] == undefined)
		aText.value = "None"
	else		
		aText.value = funds[fundIndex]
}

function validateFunds() {
	if (document.customForm.bull_text.value == "Not available") {
		alert('\nPlease select a valid Bull Fund Ticker')
		return false;
	}
	if (document.customForm.bear_text.value == "Not available") {
		alert('\nPlease select a valid Bear Fund Ticker')
		return false;
	}
}

function clearFunds() {
	document.customForm.bull_text.value = ""
	document.customForm.bear_text.value = ""
}

function clearSymbol() {
	document.customForm.symbol.value = ""
}
function clearEmail(){
	if (document.member.email.value == "Username")
		document.member.email.value = "";
}
function clearPass(){
	if (document.member.passwd.value == "Password")
		document.member.passwd.value = "";
}
function swap(img_name,img_src) {
	document[img_name].src=img_src;
}
