
  OGTIAstring="OGTIA sell "; // make sure last character in this string is a space!

  function addOGTIAcode () {
  // *****************************************
  // This function is called from an
  // onFocus handler from the form query text element.
  // Google names it "q" - very descriptive!
  // *****************************************
    if (document.bob.q.value.indexOf(OGTIAstring) == -1) {
      bob.q.value=OGTIAstring + bob.q.value;
      }
  }
  // *****************************************
  // This function is called from an
  // onSubmit handler in the form declaration.
  // In case someone deletes the OGTIAstring,
  // this function will add it after the Submit
  // *****************************************
  function doubleCheckOGTIAcode () {
    if (document.bob.q.value.indexOf(OGTIAstring) == -1) {
      bob.q.value=OGTIAstring + bob.q.value;
      }
  }
  
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

 

function MM_openBrWindow(theURL,winName,features) 
{ //v2.0
  window.open(theURL,winName,features);
}


function formCheck(formobj){
	// name of mandatory fields
	var fieldRequired = Array("FNAME", "LNAME", "EMAIL", "ADDRESS_1", "CITY", "STATE_PROVINCE", "COUNTRY", "POSTAL_CODE", "TERMS", "MEMBERNAME");
	// field description to appear in the dialog box
	var fieldDescription = Array("First Name", "Last Name", "Email", "Address", "City", "State/Province", "Country", "Postal Code", "Agree to Terms", "Member Name");
	// dialog message
	var alertMsg = "Please complete the following fields:\n";
	
	var l_Msg = alertMsg.length;
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			if (obj.type == null){
				var blnchecked = false;
				for (var j = 0; j < obj.length; j++){
					if (obj[j].checked){
						blnchecked = true;
					}
				}
				if (!blnchecked){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				continue;
			}

			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "checkbox":
			 	if (!(obj.checked)){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
			}
		}
	}

	if (alertMsg.length == l_Msg){
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}
// -->

function stripNonIntegers (inputValue) {
		var s = "" // build the output from scratch
        for (var i = 0; i < inputValue.length; i++) {
                var oneChar = inputValue.charAt (i)
                //alert (oneChar) //testing only
                if (oneChar >= "0" && oneChar <= "9") {
                   s = s + oneChar
                }
        }
        return s
}

function upperMe (input) {
	var inputStr = input.value
	if (!isNumber (inputStr)) {
    	 input.value = inputStr.toUpperCase ()
	}
}

function lowerMe (input) {
	var inputStr = input.value
	if (!isNumber (inputStr)) {
    	 input.value = inputStr.toLowerCase ()
	}
}

function doAlert (input, msg) {
	alert (msg)
	input.focus ()
	input.select ()		
	return false
}

function checkEmail(input) {
// check email address submitted for illegal characters
	var illegalChars = new Array ()
	var illegalCharsText = new Array ()
	illegalChars[0] = "/" ; illegalCharsText[0] = "forward slashes" ;
	illegalChars[1] = "\\" ; illegalCharsText[1] = "backslashes" ;
	illegalChars[2] = "!" ; illegalCharsText[2] = "exclamation points" ;
	illegalChars[3] = "*" ; illegalCharsText[3] = "asterisks" ;
	illegalChars[4] = "?" ; illegalCharsText[4] = "question marks" ;
	illegalChars[5] = "<" ; illegalCharsText[5] = "less-than symbols" ;
	illegalChars[6] = ">" ; illegalCharsText[6] = "greater-than symbols" ;
	illegalChars[7] = "|" ; illegalCharsText[7] = "pipes" ;
	illegalChars[8] = "`" ; illegalCharsText[8] = "accents" ;
	illegalChars[9] = "#" ; illegalCharsText[9] = "pound signs" ;
	illegalChars[10] = "$" ; illegalCharsText[10] = "dollar signs" ;
	illegalChars[11] = "%" ; illegalCharsText[11] = "percent signs" ;
	illegalChars[12] = "^" ; illegalCharsText[12] = "carets" ;
	illegalChars[13] = "&" ; illegalCharsText[13] = "ampersands" ;
	illegalChars[14] = "(" ; illegalCharsText[14] = "parentheses" ;
	illegalChars[15] = ")" ; illegalCharsText[15] = "parentheses" ;
	illegalChars[16] = "=" ; illegalCharsText[16] = "equal signs" ;
	illegalChars[17] = "+" ; illegalCharsText[17] = "plus symbols" ;
	illegalChars[18] = ";" ; illegalCharsText[18] = "semicolons" ;
	illegalChars[19] = "," ; illegalCharsText[19] = "commas" ;
	illegalChars[20] = "[" ; illegalCharsText[20] = "square braces" ;
	illegalChars[21] = "]" ; illegalCharsText[21] = "square braces" ;
	illegalChars[22] = "{" ; illegalCharsText[22] = "curly braces" ;
	illegalChars[23] = "}" ; illegalCharsText[23] = "curly braces" ;
	illegalChars[24] = "\"" ; illegalCharsText[24] = "quotes" ;
	illegalChars[25] = "\'" ; illegalCharsText[25] = "apostrophes" ;
	illegalChars[26] = " " ; illegalCharsText[26] = "spaces" ;
	illegalChars[27] = "~" ; illegalCharsText[27] = "tildes" ;
	illegalChars[28] = "http:" ; illegalCharsText[28] = "http protocols" ;
	illegalChars[29] = "ftp:" ; illegalCharsText[29] = "ftp protocols" ;
	illegalChars[30] = ":" ; illegalCharsText[30] = "colons" ;

	var emailString = input.value
	if (!emailString) {
		return doAlert (input, "Sorry, \"E-mail\" is required.")
	}
	for (var i = 0; i < illegalChars.length; i++) {
		if (emailString.indexOf (illegalChars[i]) != -1) {
			return doAlert (input, "Sorry, " + illegalCharsText [i] + " (" + illegalChars[i] + ") are not permitted in an e-mail address.")
		}
	}
	if (emailString.indexOf("@") == -1) {
		return doAlert (input, "The E-mail address you entered is incorrect; it must contain an \"@\" symbol.")
	}
	if (emailString.indexOf(".") == -1) {
		return doAlert (input, "The E-mail address you entered is incorrect; it should end in \".com\", \".net\", \".org\", etc.\rPlease verify.")
	}
	lowerMe (input)
	return true
}



function validate()
{
	if (document.changepass.new_pass.value != document.changepass.cnew_pass.value)
	{
		alert("New Password does not match with Confirm Password");
		return false;
	}
	return true;
}

function popwindow(address,width,height) 
{
	var window_url = address;
    var window_name = "window_name";
    var window_features = "height="+height+",width="+width+",resizable,scrollbars=no,toolbar=no,menubar=no";
    window.open(window_url,window_name,window_features);
 }
 
function CountDown()
{
	warnTime = 60000 * 59;
	warnMe = setTimeout('RunDown()', warnTime);
}

function RunDown() 
{ 
	popwindow("https://www.penny7.com/infopenny7/members/expire_warning.cfm",520,375); 
}

function Continue()
{
    self.close();
	opener.location.reload();
}

function LastMinute() 
{	
	closeMe = setTimeout('EndNow()', 60000); 
}

function EndNow()
{
	self.close();
	opener.location = "http://www.penny7.com";
}

function GetURL() {
	window.location.href="http://www.somewhere/you_outta_here"
}


