var version;
browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);
if ((browserName == "Netscape" && browserVer >= 3) || browserVer>=4 ) version = "ok"; else version = "no";
if (version == "ok")  {
var aboutdeact = new Image(100,100);
aboutdeact.src = "about.gif";
var aboutact = new Image(100,100);
aboutact.src = "aboutact.gif";

var gallerydeact = new Image(100,100);
gallerydeact.src = "gallery.gif";
var galleryact = new Image(100,100);
galleryact.src = "galleryact.gif";

var credentialsdeact = new Image(100,100);
credentialsdeact.src = "credentials.gif";
var credentialsact = new Image(100,100);
credentialsact.src = "credentialsact.gif";

var contactdeact = new Image(100,100);
contactdeact.src = "contact.gif";
var contactact = new Image(100,100);
contactact.src = "contactact.gif";

var librarydeact = new Image(100,100);
librarydeact.src = "library.gif";
var libraryact = new Image(100,100);
libraryact.src = "libraryact.gif";

var goforwarddeact = new Image(75,36);
goforwarddeact.src = "goforward.jpg";
var goforwardact = new Image(75,36);
goforwardact.src = "goforwardact.jpg";

var gobackdeact = new Image(75,36);
gobackdeact.src = "goback.jpg";
var gobackact = new Image(75,36);
gobackact.src = "gobackact.jpg";

var backtogallerydeact = new Image(75,36);
backtogallerydeact.src = "backtogallery.jpg";
var backtogalleryact = new Image(75,36);
backtogalleryact.src = "backtogalleryact.jpg";

}

function act(image) {if (version == "ok"){document [image].src = eval(image + "act.src");}}
function deact(image) {if (version == "ok"){document [image].src = eval(image + "deact.src");}}
function openWin(name) {window.open(name, 'popup', config='height=350,width=500,toolbar=no,scrollbars=no,resizable=yes,location=no,directories=no,status=no');}

function conditionalBack() {
	if (document.referrer.indexOf('faccents') > -1)
		history.back();
	else
		location.href = 'gallery.html';
}

function emailCheck (emailStr) {
var emailPat=/^(.+)@(.+)$/
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
var validChars="\[^\\s" + specialChars + "\]"
var quotedUser="(\"[^\"]*\")"
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
var atom=validChars + '+'
var word="(" + atom + "|" + quotedUser + ")"
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
var matchArray=emailStr.match(emailPat)

if (emailStr=="") {
	alert("Thank you for your inquiry!")
	return true
}

if (matchArray==null) {
	alert("Your e-mail address seems to be incorrect.  (Perhaps the @ symbol or periods are missing or out of place?)  Please check your address and try again!")
	return false
}
var user=matchArray[1]
var domain=matchArray[2]

if (user.match(userPat)==null) {
    alert("Your e-mail username doesn't seem to be valid.  Please check your address and try again!")
    return false
}

var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
    // this is an IP address
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	        alert("The destination IP address of your e-mail address is invalid!    Please check your address and try again!")
		return false
	    }
    }
    return true
}

var domainArray=domain.match(domainPat)
if (domainArray==null) {
	alert("The domain name of your e-mail address (the part after the @ symbol) doesn't seem to be valid.  Please check your address and try again!")
    return false
}

var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>3) {
   alert("Your e-mail address must end in a three-letter domain, or two letter country (something like '.com', '.org' or '.be' should be at the end).  Please check your address and try again!")
   return false
}

if (len<2) {
   var errStr="Your e-mail address is missing a hostname! (something like 'aol.com' or 'msn.com' after the @).  Please check your address and try again!"
   alert(errStr)
   return false
}

alert("Thank you for your inquiry!")
return true;
}

function Cookie(document,name,hours,path,domain,secure) {
  // any VAR in "this" that does not start with a "$" will
  // be written into the cookie (read from also)
  this.$doc  = document
  this.$name = name
  if (hours)  this.$expiration=new Date((new Date()).getTime()+hours*3600000); else this.$expiration = null
  if (path)   this.$path   = path;                                             else this.$path       = null
  if (domain) this.$domain = domain;                                           else this.$domain     = null
  if (secure) this.$secure = true;                                             else this.$secure     = false
}

function CookieWrite() {
  var cookieval=""
  for(var prop in this) {
    if ((prop.charAt(0) == '$') || ((typeof this[prop]) == 'function') || prop == '') continue
	if (cookieval != "") cookieval += '&'
	cookieval+=prop+":"+escape(this[prop])
  }
  var cookie=this.$name+"="+cookieval
  if (this.$expiration) cookie+='; expires=' + this.$expiration.toGMTString()
  if (this.$path)       cookie+='; path='    + this.$path
  if (this.$domain)     cookie+='; domain='  + this.$domain
  if (this.$secure)     cookie+='; secure'
  this.$doc.cookie=cookie
}

function CookieRead() {
  var allcookies=this.$doc.cookie
  if (allcookies=="") {
    return false
  }
  var start= allcookies.indexOf(this.$name+'=')
  if (start== -1) {
    return false
  }
  start += this.$name.length+1
  var end=allcookies.indexOf(';',start)
  if (end == -1) end=allcookies.length
  var cookieval = allcookies.substring(start,end)
  var a = cookieval.split('&')
  for (var i=0;i < a.length;i++) a[i]=a[i].split(':')
  for (var i=0;i < a.length;i++) this[a[i][0]]=unescape(a[i][1])
  return true
}

function CookieDelete() {
  var cookie = this.$name+'='
  if (this.$path)   cookie+='; path='+this.$path
  if (this.$domain) cookie+='; domain='+this.$domain
  cookie+='; expires=Fri, 02-Jan-1970 00:00:00 GMT'  // MAKE IT EXPIRE!
  this.$doc.cookie=cookie
}

new Cookie()
Cookie.prototype.write = CookieWrite
Cookie.prototype.del   = CookieDelete
Cookie.prototype.read  = CookieRead

var myCookie = new Cookie(document,"cookie",24); // cookie lasts 24 hours
if (document.referrer.indexOf("faccents") == -1 && document.referrer.indexOf("atomz") == -1) {
  // the person arrived at this page from another web site, and not from an atomz search
  myCookie.referrer = document.referrer;
  myCookie.entrancepage = location.href;
  myCookie.write();
}

myCookie.read();
var REF = myCookie.referrer || "no referrer page";
var ENT = myCookie.entrancepage || "no entrance page";
