function loadPics()
{
if(document.music)
document.music.src = "/images/marsha.gif";

if(document.books)
document.books.src = "/images/featurebook.gif";

if(document.shirts)
document.shirts.src = "/images/shirts.gif";

if(document.hats)
document.hats.src = "/images/hats.gif";

if(document.mugs)
document.mugs.src = "/images/mug.gif";

if(document.homo)
document.homo.src = "/images/books/homo.gif";

if(document.recovery)
document.recovery.src = "/images/books/recovery.gif";

if(document.wounded)
document.wounded.src = "/images/books/wounded.gif";

if(document.thebible)
document.thebible.src = "/images/books/thebible.gif";

if(document.comingout)
document.comingout.src = "/images/books/comingout.gif";

if(document.bothfeet)
document.bothfeet.src = "/images/books/bothfeet.gif";

if(document.theroad)
document.theroad.src = "/images/books/theroad.gif";

if(document.calledout)
document.calledout.src = "/images/books/calledout.gif";

if(document.baptized)
document.baptized.src = "/images/books/baptized.gif";

if(document.uncommon)
document.uncommon.src = "/images/books/uncommon.gif";

if(document.face)
document.face.src = "/images/books/face.jpg";

if(document.remembered)
document.remembered.src = "/images/books/remembered.gif";

if(document.comehome)
document.comehome.src = "/images/books/comehome.gif";

if(document.christianfaith)
document.christianfaith.src = "/images/books/christianfaith.gif";

if(document.dancing)
document.dancing.src = "/images/books/dancing.gif";

if(document.celebrate)
document.celebrate.src = "/images/books/celebrate.gif";

if(document.handb)
document.handb.src = "/images/books/handb.gif";

if(document.freetobe)
document.freetobe.src = "/images/books/freetobe.gif";

if(document.dickert)
document.dickert.src = "/images/books/dickert.jpg";

return true;
}

function otherCountry()
{
if(document.forms[0].country.value == "other")
{
alert("You selected other for your country name.  Please ensure that you have manually typed it in the address line #2 field.");
}

return true;
}

function otherProv()
{
if(document.forms[0].prov.value == "other")
{
alert("You selected other for your province/state.  Please make sure you have manually entered it in the address line #2 field.");
}

return true;
}

function checkEmail(address)
{
var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
var check=/@[\w\-]+\.+/;
var checkend=/\.[a-zA-Z]{2,4}$/;

	if(((address.search(exclude) != -1)||(address.search(check)) == -1)||(address.search(checkend) == -1))
{
		alert("The email address you entered is not a recognized format.  Please try entering it again or use the email link at the bottom of the page.");
return false;
	}
	else 
{
return true;
	}
}

function validate(emailAdd)
{
with(document.subscribe)
{
if(send[1].checked || send[2].checked)
if(!checkPostal())
return false;

if(send[0].checked || send[2].checked)
if(!checkEmail(emailAdd))
{
email.focus();
return false;
}

if(!email.value == email2.value) {
alert("The two email addresses you entered are different.  Please check them and correct the one that is wrong.");
return false;
}

}

return true;
}

function checkPostal()
{
with(document.subscribe)
{
if(fname.value == "")
{
alert("You didn't provide a name for addressing your materials.");
fname.focus();
return false;
}

if(lname.value == "")
{
alert("You did not provide a last name for addressing your materials.");
lname.focus();
return false;
}

if(add1.value == "" && add2.value == "")
{
alert("You did not provide an address to send your information to.");
add1.focus();
return false;
}

if(city.value == "")
{
alert("Please provide the name of your city.");
city.focus();
return false;
}

if(prov.value == "")
{
alert("You did not include your Province or State.");
prov.focus();
return false;
}

if(pcode.value == "")
{
alert("Please enter a value for your postal/zip code.");
pcode.focus();
return false;
}

if(country.value == "-")
{
alert("Please enter in your country in the country box.");
country.focus();
return false;
}
}

return true;
}

// check that they entered a value for the comment field
function checkGuest()
{
if(document.guest.comments.value == "")
{
alert("You didn't provide any comments.  Please enter some comments and resubmit the form.");
document.guest.comments.focus();
return false;
}

if(document.guest.elist[0].checked && document.guest.email.value == "") {
alert("You chose to be added to the mailing list but, you did not provide your email address.  Please return to the form and complete it before submitting.");
return false;
}

return true;
}

function nextPage(url)
{
location = url;
}

// Make the notice appear
function openWindow() {
var attr = "WIDTH=225,HEIGHT=230,STATUS=no,RESIZABLE=YES,TOOLBAR=no,MENUBAR=no,SCROLLBARS=YES,SCREENX=15,SCREENY=";
attr += 100;
attr += ",left=15,top=";
attr += screen.height-400;

if(document.cookie) {
var cookieStr = document.cookie;
if(cookieStr = /beenThere/)
return;
}

document.cookie = "beenThere=9;PATH=/";
document.cookie = "Currency=0;PATH=/";

window.open("/notice.html","notice",attr);

return;
}

function parseCookie(cookieName) {
var start = document.cookie.indexOf(cookieName);

if(start == -1)
return (cookieName + "=");

var end = document.cookie.indexOf(";", start);

if(end == -1)
end = document.cookie.length;

return (document.cookie.substring(start, end));
}

function addProduct(newData) {
if(confirm("Add purchase to shopping cart?\n\nYou may view your shopping cart or you may check out at any time by clicking the 'View Cart' link in the navigation bar or at the bottom of the page.  No information is recorded until you complete the check-out process.\n\nDue to increased credit card fees, we no longer accept Mastercard, however, we do still accept VISA, AMEX and Diners Club.")) {
var productStr = parseCookie("Products") + newData + "::";
document.cookie = productStr + ";PATH=/";
} else
return false;
}

function addToCart(prodCode, quantity) {
var prodId = prodCode + ":" + quantity;
if(addProduct(prodId))
return true;
else
return false;
}

function shoppingCart() {
var attr = "WIDTH=610,HEIGHT=300,STATUS=no,RESIZABLE=YES,TOOLBAR=no,MENUBAR=no,SCROLLBARS=YES,SCREENX=15,SCREENY=";
attr += 100;
attr += ",left=15,top=";
attr += screen.height-400;

window.open("/cgi-bin/shop.pl","shop",attr);
}

function determineCurrency(version) {
var cookieStr = document.cookie;
var first = cookieStr.indexOf("=", 0);
if(first == -1)  {
if(version == 1) 
document.write('<a class="left" href="/products/us/products.shtml">Store</a>');
else
document.write('<a href="/products/us/products.shtml">Store</a> | ');
return;
}

var second = cookieStr.indexOf("=", first+1);
if(second == -1)
var currency = 0;
else
var currency = cookieStr.substr(second+1, 1);

if(version == 1) {
if(currency == 1) 
document.write('<a class="left" href="/products/cdn/products.shtml">Store</a>');
else if (currency == 0) 
document.write('<a class="left" href="/products/us/products.shtml">Store</a>');
else if (currency == 2) 
document.write('<a class="left" href="/products/uk/products.shtml">Store</a>');
else if (currency == 3) 
document.write('<a class="left" href="/products/euro/products.shtml">Store</a>');
} else {
if (currency == 1) 
document.write('<a href="/products/cdn/products.shtml">Store</a> | ');
else if (currency == 0) 
document.write('<a href="/products/us/products.shtml">Store</a> | ');
else if (currency == 2) 
document.write('<a href="/products/uk/products.shtml">Store</a> | ');
else if (currency == 3) 
document.write('<a href="/products/euro/products.shtml">Store</a> | ');
}

}

function productBox(productStr) {
if(productStr == "")
return
var link = "/products/";
var cookieStr = document.cookie;
var first = cookieStr.indexOf("Currency=", 0);
var currency = cookieStr.substr(first + 9, 1);
if(currency == -1)
currency = 0;
var array = new Array ("us", "cdn", "uk", "euro");

link += array[currency] + "/" + productStr + ".shtml";

location.href = link;
}

//this function will open a small Window to play a music file
function playMp3(filename) {
var attr = "WIDTH=500,HEIGHT=150,STATUS=no,RESIZABLE=NO,TOOLBAR=YES,MENUBAR=YES,SCROLLBARS=NO,SCREENX=0,SCREENY=";
attr += "0,left=0,top=0";

window.open(filename,"music",attr);
}

