function toAlphaNumber(checkString)
{
    newString = "";    // REVISED/CORRECTED STRING
    count = 0;         // COUNTER FOR LOOPING THROUGH STRING

    // LOOP THROUGH STRING CHARACTER BY CHARACTER
    for (i = 0; i < checkString.length; i++) {
        ch = checkString.substring(i, i+1);

        // ENSURE CHARACTER IS AN ALPHA OR NUMERIC CHARACTER
        if ((ch >= "a" && ch <= "z") || (ch >= "A" && ch <= "Z") ||(ch == "?") ||
            (ch >= "!" && ch <= ")") || (ch >= "0" && ch <= "9") || (ch == " ") || (ch == ".") || (ch == ",")) {
            newString += ch;
        }
    }

    if (checkString != newString) {
      // VERIFY WITH USER THAT IT IS OKAY TO REMOVE INVALID CHARACTERS
      if (confirm("You have entered hard returns\nand other characters that might not get to us.\nThese will be removed and then\nyou may edit the submission afterwards.\nPlease don't enter any hard returns.")) {
        // RETURN REVISED STRING
        return newString;
      } else {
        // RETURN ORIGINAL STRING
        return checkString;
      }
    }
    return checkString;
}

function checkEmail(checkString)
{
    var newstr = "";
    var at = false;
    var dot = false;
	var www = false;
	var regexp = /\bwww\b/;
	var resultArray = checkString.match(regexp);

    // DO SOME PRELIMINARY CHECKS ON THE DATA

    // IF EMAIL ADDRESS HAS A '@' CHARACTER
    if (checkString.indexOf("@") != -1) {
      at = true;

    // IF EMAIL ADDRESS HAS A '.' CHARACTER
    }  if (checkString.indexOf(".") != -1) {
      dot = true;
    }
	//check for that www mistake!
		if (resultArray == "www") {
		www = true;
		}
	
	
    // PARSE REMAINDER OF STRING
    for (var i = 0; i < checkString.length; i++) {
        ch = checkString.substring(i, i + 1)
        if ((ch >= "A" && ch <= "Z") || (ch >= "a" && ch <= "z")
                || (ch == "@") || (ch == ".") || (ch == "_")
                || (ch == "-") || (ch >= "0" && ch <= "9")) {
                newstr += ch;
                if (ch == "@") {
                    at=true;
                }
                if (ch == ".") {
                    dot=true;
                }
        }
    }
		if (www == true) {
	alert ("The email address you entered\ncontains www in the address.\nIs this correct?")
		return newstr;
	}
    else if ((at == true) && (dot == true)) {
        return newstr;
    }
    else {
      // DISPLAY ERROR MESSAGE
      alert ("Sorry, the email address you\nentered is not in the correct\nformat.");
      return "";
    }
}

var windowName = null;
var url = null;
var myWindow = null;
var saveWindow = new Array();
var i = 0

//example for calling popWindow would be 
//onClick="popWindow("/quoter/allCDs.html","Help Window")
function popWindow(url,windowName) {

myWindow=window.open(url,windowName,"HEIGHT=450,WIDTH=400,scrollbars,resizable,dependent");
saveWindow[i] = myWindow
i++;

if (myWindow || myWindow.open) {
myWindow.focus();
	}

}

//you can use this function attached to a button
//be sure to use <body onUnload="closeMe()"> in your body tag
//this will close any window that was spawned from the original window
//if the user leaves the page

function closeMe() {

	for(i=0; i<saveWindow.length; i++) {
	if(saveWindow[i]) {
	saveWindow[i].close()
		}
	}
}
///a simple effective way to put a back button in a pop-up window

function goBack() {
	history.go(-1);
}

///need to add a function to check the email address and send info from HELP window
function saveMyQuote() {
if (document.eQuote.email.value != "") {
document.eQuote.saveQuote.value = "yes";
}
	else {
	document.eQuote.saveQuote.value = "";
	
	}
}


///for quote retrieval, check to make sure they havent
//entered a quoteID and email address
function checkID() {
quote = document.eQuote.myQuoteID.value
email = document.eQuote.searchemail.value

if (quote && email) {
	return "";
	}



}


