// Copyright 2000-2005 Glory Day Software Company
function putfocus(strJSKey)
{
	switch(strJSKey) {
		case "Cart":
			for(var count=0;count<document.forms[1].elements.length;count++)
				if(document.forms[1].elements[count].name.substr(0,3)=="Qty"){
					document.frmCart.elements[count].focus();
					break;
					}
			break;
		case "Search":
			document.frmSearch.searchvalue.focus();
			break;
		case "Donation":
			document.frmProduct.Input_Amount.focus();
			break;
		case "Checkout":
			document.frmCheckout.I_Name.focus();
			break;
		default:
			break;
	}
}

function textarealength1(objText,numMaxLength)
{
if(objText.value.length > numMaxLength) {
	objText.value = objText.value.substring(0, numMaxLength);
	}
}

function textarealength2(objText,numMaxLength,objCounter)
{
if(objText.value.length > numMaxLength)
	objText.value = objText.value.substring(0, numMaxLength);
if (! objCounter==null)
	alert("not null");
objCounter.value=objText.value.length;
//objText.focus()
}

function hit(squirrel,artist,landing) {
squirrel += ' ';
var punishment = squirrel.length;
var opposite = 0;
var corporation = '';
for(var waste = 0; waste < punishment; waste++) {
opposite = 0;
while(squirrel.charCodeAt(waste) != 32) {
opposite = opposite * 10;
opposite = opposite + squirrel.charCodeAt(waste)-48;
waste++;
}
corporation += String.fromCharCode(shoot(opposite,artist,landing));
}
parent.location = 'm'+'a'+'i'+'l'+'t'+'o'+':'+corporation;
}

function leap(speech,structure,extravagance) {
speech += ' ';
var flore = speech.length;
var human = 0;
for(var lake = 0; lake < flore; lake++) {
human = 0;
while(speech.charCodeAt(lake) != 32) {
human = human * 10;
human = human + speech.charCodeAt(lake)-48;
lake++;
}
//document.write('&');
//document.write('#');
//document.write(shoot(human,structure,extravagance));
document.write(String.fromCharCode(shoot(human,structure,extravagance)));
}
}

function shoot(moon,male,magic) {
if (magic % 2 == 0) {
movement = 1;
for(var optician = 1; optician <= magic/2; optician++) {
music = (moon*moon) % male;
movement = (music*movement) % male;
}
} else {
movement = moon;
for(var somethingawful = 1; somethingawful <= magic/2; somethingawful++) {
music = (moon*moon) % male;
movement = (music*movement) % male;
}
}
return movement;
}

//for bookshelf


// <!-- 479463790
// This script is (C) Copyright 2004 Jim Tucek
// Leave these comments alone!  For more info, visit
// www.jracademy.com/~jtucek/email/ 

function beat(agriculture,box,fuel) {
agriculture += ' ';
var opposite = agriculture.length;
var notice = 0;
var courtesy = '';
for(var thing = 0; thing < opposite; thing++) {
notice = 0;
while(agriculture.charCodeAt(thing) != 32) {
notice = notice * 10;
notice = notice + agriculture.charCodeAt(thing)-48;
thing++;
}
courtesy += String.fromCharCode(sweep(notice,box,fuel));
}
parent.location = 'm'+'a'+'i'+'l'+'t'+'o'+':'+courtesy;
}

function mow(custom,square,day) {
custom += ' ';
var money = custom.length;
var encounter = 0;
for(var energy = 0; energy < money; energy++) {
encounter = 0;
while(custom.charCodeAt(energy) != 32) {
encounter = encounter * 10;
encounter = encounter + custom.charCodeAt(energy)-48;
energy++;
}
//document.write('&');
//document.write('#');
//document.write(sweep(encounter,square,day));
document.write(String.fromCharCode(sweep(encounter,square,day)));
}
}

function sweep(disease,structure,gesture) {
if (gesture % 2 == 0) {
incredulity = 1;
for(var mass = 1; mass <= gesture/2; mass++) {
license = (disease*disease) % structure;
incredulity = (license*incredulity) % structure;
}
} else {
incredulity = disease;
for(var night = 1; night <= gesture/2; night++) {
license = (disease*disease) % structure;
incredulity = (license*incredulity) % structure;
}
}
return incredulity;
}

function is_numeric(checkStr){
		// allow ONLY alphanumeric keys, no symbols or punctuation
	// this can be altered for any "checkOK" string you desire
	var checkOK = "0123456789";
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
			if (ch == checkOK.charAt(j))
				break;
		if (j == checkOK.length)
		{
			allValid = false;
			break;
		}
	}
	if (!allValid)	return (false);
	
	return true;
}


function check_amount(theForm) {
	//Need better error checking
	
	//var test = "hello";
	//myArray = new Array(15,89,4,61,5) 
	//alert (print_r(document));
	
	if (theForm["id[txt_15]"].value.length < 1  || !is_numeric(theForm["id[txt_15]"].value)){
		alert('Please enter a valid amount (all numeric no $) for your Donation.');
		theForm["id[txt_15]"].focus();
 			return (false);
	}

	return true;
}

// -->


