function goAnchor(destination)
{  window.location.hash = destination}

function goURL(destination)
{  window.location = destination}


function makeArray(n)
{
this.length = n
return this
}

function exists(inputValue, alertMsg)
{
aCharExists=0
if (inputValue)
{
for (var i=0; i<inputValue.length; i++)
{
if (inputValue.charAt(i) != " ")
{
aCharExists=1
}
}
}

if (!aCharExists)
{
window.alert("Please enter your " + alertMsg)
}
}

function upperChar(inputString, indx1, indx2)
{
var front = inputString.substring(0, indx1)
var uppedChar = inputString.substring(indx1, indx2).toUpperCase()
var back = inputString.substring(indx2, inputString.length)
return front + uppedChar + back
}

function insertBlank(inputString, indx)
{
var front = inputString.value.substring(0,indx)
var back = inputString.value.substring(indx, inputString.value.length)
return front + " " + back
}

function setCaseTitles(inputString)
{
var inputLength = inputString.value.length
for (i=0; (i< inputLength -1); i++)
{
// if this char is a comma or a period and the next char isn't null or blank
if ((inputString.value.charAt(i) == "," || inputString.value.charAt(i) == ".") && !(inputString.value.charAt(i+1) == "" || inputString.value.charAt(i+1) == " "))
{
// Don't put a blank between a period and a comma
if (inputString.value.charAt(i+1) != ",")
{
inputString.value = insertBlank(inputString, i+1); inputLength++
}
}
// if last char was null or blank, then next char to upper case
// if first char capitalize
if (i==0)
{
var setTitleFront = inputString.value.substring(0, 1).toUpperCase()
var setTitleBack = inputString.value.substring (1, inputLength).toLowerCase()
inputString.value = setTitleFront + setTitleBack
} else // if not first char
{

if (inputString.value.charAt(i-1) == " " || inputString.value.charAt(i-1) == "")
{
inputString.value = upperChar(inputString.value, i, (i+1))
}
}
}

}

function specialSubmit(valu1, alertMsg1, valu2, alertMsg2, valu3, alertMsg3)
{
var field1=false; field2=false; field3=true
if (boolExists(valu1))
{
field1=true
} else
{
field1=false;
window.alert("Please enter your " + alertMsg1)
}

if (boolExists(valu2))
{
field2=true
} else
{
field2=false;
window.alert("Please enter your " + alertMsg2)
}

// allows processing of only two fields
//replicate 2nd field to fill last two parms
//if only two fields then duplicated 3rd field is ignored
if (alertMsg2 != alertMsg3)
{
if (boolExists(valu3))
{
field3=true
} else
{
field3=false;
window.alert("Please enter your " + alertMsg3)
}
}

if (field1 && field2 && field3)
{
with (document)
{
forms[0].submit()
}
//window.alert("During peak periods, large numbers of inquiries can cause a backlog, sometimes for an interminable several minutes, as our ISP, NetVision, processes your " + document.forms[0].name + ".  We will display an acknowledgement page to let you know we've received your " + document.forms[0].name + ".  After clicking \"OK\" to this notice, please be patient, wait for our acknowledgement page - which contains important information for you.  Don't click on the \"Transmit\" button again, that only requests an additional wait to process it another time.  If you notice an error, please notify us via the \"Contact\" link in the appropriate ministry.")
}
}

function boolExists(inputValue)
{
aCharExists=0
if (inputValue)
{
for (var i=0; i<inputValue.length; i++)
{
if (inputValue.charAt(i) != " ") 
{
aCharExists=1
}
}
}

if (!aCharExists) 
{
return false
}
return true
}

function BoolSelectedButton(buttonGroup)
{
buttonBool = false
//alert("buttonGroup.value= "  + buttonGroup.value)
//alert("buttonGroup.length= " + buttonGroup.length)
for (var i = 0; i < buttonGroup.length; i++)
{
//alert("buttonGroup[" + i + "].value=" + buttonGroup[i].value)
//alert("buttonGroup[" + i + "].checked=" + buttonGroup[i].checked)
if (buttonGroup[i].checked)
{
buttonBool = true
}
}
//alert("returning buttonBool=" + buttonBool)
return buttonBool
}

function makhshev()
{
var plug=""
for (var i = 0; i < 4; i++)
{
plug += unescape("%21")
}
return plug
}

function encryptSubmit(ThisForm, Client, Street, CityState, LogicMode, Aleph, Hei, Devarim)
{
//window.alert("function encryptSubmit:\n ThisForm=" + ThisForm)
//window.alert("function encryptSubmit:\n Client=" + Client)
//window.alert("function encryptSubmit:\n Street=" + Street)
//window.alert("function encryptSubmit:\n CityState=" + CityState)
//window.alert("function encryptSubmit:\n LogicMode=" + LogicMode)
//window.alert("function encryptSubmit:\n Aleph=" + Aleph)
//window.alert("function encryptSubmit:\n Hei=" + Hei)
//window.alert("function encryptSubmit:\n Devarim=" + Devarim)
var BooClient=false; BooStreet=false; BooCityState=true; BooLogicMode=false; BooFontType=false; BooFontSize=false; AlephHei=false
var Devarim2 = "number"
if (boolExists(Client))
{
BooClient=true
} else
{
BooClient=false;
window.alert("Please enter your full name")
}

if (boolExists(Street))
{
BooStreet=true
} else
{
BooStreet=false;
window.alert("Please enter your street or POB address")
}

if (boolExists(CityState))
{
BooCityState=true
} else
{
BooCityState=false
window.alert("Please enter your city and state (and province, if applicable)")
}

//alert("LogicMode[0].checked=" + LogicMode[0].checked)
//alert("LogicMode[1].checked=" + LogicMode[1].checked)
//alert("LogicMode[3].checked=" + LogicMode[1].checked)
//alert("LogicMode[4].checked=" + LogicMode[1].checked)
//alert("BoolSelectedButton(LogicMode)=" + BoolSelectedButton(LogicMode))
if (BoolSelectedButton(LogicMode))
{
BooLogicMode=true
//alert("BooLogicMode=" + BooLogicMode + "\nFinished with LogicMode")
} else
{
BooLogicMode=false
window.alert("Your order cannot be processed unless you indicate which credit card you wish to use.  You can also pay by mailing a check or money order in $US")
}

//alert("Aleph=" + Aleph + " and Hei=" + Hei)
if (boolExists(Aleph) && boolExists(Hei))
{
AlephHei=true
} else
{
AlephHei=false
window.alert("The order cannot be processed without your " + Devarim + " card " + Devarim2 + ".  You can also pay by mailing a check or money order in $US")
}

if (BooClient && BooStreet && BooCityState && BooLogicMode && AlephHei)
{
var nariyah="", lasheim="", neranena="", lekhu=""
var aleiphbeit = new makeArray(10)
aleiphbeit[0] = "ephes"
aleiphbeit[1] = "aleph"
aleiphbeit[2] = "beit"
aleiphbeit[3] = "gimel"
aleiphbeit[4] = "dalet"
aleiphbeit[5] = "hei"
aleiphbeit[6] = "vav"
aleiphbeit[7] = "zayin"
aleiphbeit[8] = "kheit"
aleiphbeit[9] = "teit"
ThisForm.lekhu.value=""
ThisForm.neranena.value=""
ThisForm.lasheim.value=""
ThisForm.nariyah.value=""
for (charndx=0; charndx<4; charndx++)
{
lasheim += aleiphbeit[ThisForm.Teitleyodbeit.value.charAt(charndx)] + ", "
}
//alert("lasheim=" + lasheim)
ThisForm.lasheim.value = lasheim
//alert("ThisForm.lasheim.value=" + ThisForm.lasheim.value)
for (charndx=0; charndx<4; charndx++)
{
lekhu += aleiphbeit[ThisForm.Alephledalet.value.charAt(charndx)] + ", "
}
//alert("lekhu=" + lekhu)
ThisForm.lekhu.value = lekhu
//alert("ThisForm.lekhu.value=" + ThisForm.lekhu.value)
for (charndx=0; charndx<4; charndx++)
{
nariyah += aleiphbeit[ThisForm.Yodgimelleteitzayin.value.charAt(charndx)] + ", "
}
//alert("nariyah=" + nariyah)
ThisForm.nariyah.value = nariyah
//alert("ThisForm.nariyah.value=" + ThisForm.nariyah.value)
for (charndx=0; charndx<4; charndx++)
{
neranena += aleiphbeit[ThisForm.Heilekheit.value.charAt(charndx)] + ", "
}
//alert("neranena=" + neranena)
ThisForm.neranena.value = neranena
ThisForm.Teitleyodbeit.value = makhshev()
ThisForm.Alephledalet.value = makhshev()
ThisForm.Yodgimelleteitzayin.value = makhshev()
ThisForm.Heilekheit.value = makhshev()
with (document) 
{
forms[0].submit()
}
//window.alert("If for any reason the Internet Service Provider (ISP) doesn't display our 'thank you' note quickly you can use your \"Back\" button or click on a different area in our directory panel on the left and notify us of the error via the \"Contact\" link in the appropriate ministry. Please don't submit this " + document.forms[0].name + " Shoppe Order form more than once.")
}
}

