function isEmail(e) {
		if(e == "") return false;
		AtSignPosition = e.indexOf('@');
		if (AtSignPosition > 0)
			PeriodPosition = e.indexOf('.', AtSignPosition);
		else
			PeriodPosition = 0;
			
		if (AtSignPosition <= 0 || PeriodPosition <= 0)
			return false;
		return true;
}
	
function submitSmall(form) {
	var alertMsg = "";
	
	//Email Address Validation

	if(!isEmail(form.txtEmailAddress.value))
		alertMsg = alertMsg + "Email address is not a valid format.  Please us a format like user@host.ext.\n";
			
	if(alertMsg == "")
		return true;
	alert(alertMsg);
	return false;
}


function jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function DoCatalogSubmit(action) {
	if (action != "") {
		Form_Catalog.action.value = action;
	}
	Form_Catalog.method = "POST";
	Form_Catalog.submit();
}


function ShowImage(Image, Title, Width, Height) {
  var Args
  Args = 'toolbar=no,location=no,directories=no,menubar=no,scrollbars=no,resizable=no,status=no,width=' + Width + ',height=' + Height
  newwin = window.open(Image,Title,Args)
}

function openWin(url, name, attributes){
	var newWin;
	newWin = window.open(url,name,attributes);
	newWin.focus();
}

// check to see if input is alphanumeric
function isAlphaNumeric(val){
	if (val.match(/^[a-zA-Z0-9]+$/)){
		return true;
	} else {
		return false;
	}	
}

// check to see if input is alphanumeric
function isAlphaNumericSpaces(val){
	if (val.match(/^[a-zA-Z0-9 ]+$/)){
		return true;
	} else {
		return false;
	}	
}

function isName(val){
	if (val.match(/^[a-zA-Z0-9 ,.]+$/)){
		return true;
	} else {
		return false;
	}	
}

function dec(s) {
  var alph="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",encrypted='',chr='';    
  for(j=0; j< s.length; j++) {
      chr = s.substr(j,1).match(/[^a-zA-Z]/) ? s.substr(j,1) : '';
      if (chr) encrypted +=chr;
      if (!chr) {     
          for(i=0; i< alph.length; i++) {
              chr = s.substr(j,1) != alph.substr(i,1) ? '' : i<13 ? alph.substr((i+13)%alph.length, 1) : i>12&&i<26 ? alph.substr((i+39)%alph.length, 1) : i>25&&i<39 ? alph.substr((i+65)%alph.length,1) : alph.substr((i+91)%alph.length, 1);
              if (chr) encrypted += chr;
          }
      }
  }
  return encrypted;
}
