function ol(){document.cf.email.focus();}

function toggle_display(elem) {
	if (document.getElementById(elem).style.display != 'none') {
		document.getElementById(elem).style.display = 'none'
	}
	else {
		document.getElementById(elem).style.display = 'block'
	}
}

function sendOff(){
   emailCheck = document.cf.email.value
   msgCheck = document.cf.Message.value
   if (emailCheck.length <1) {
      alert('Please enter your email address.')
      return
   }         
   if (msgCheck.length <1) {
      alert('Please write a message.')
      return
   }
   if (!emailValidate(emailCheck)) {
     /* That function provides its own error messages */
      /* alert('Please check your email address.') */
      return
   }
   /* success! */
   document.cf.submit();
   /*
   good = false
   checkEmailAddress(document.TheForm.em)
   if ((document.TheForm.em.value ==
        document.TheForm.emx.value)&&(good)){
      // This is where you put your action
      // if name and email addresses are good.
      // We show an alert box, here; but you can
      // use a window.location= 'http://address'
      // to call a subsequent html page, 
      // or a Perl script, etc.
      alert("Name and email address fields verified good.")
   }     
   if ((document.TheForm.em.value !=
          document.TheForm.emx.value)&&(good)){
          alert('Both e-mail address entries must match.')
   }
   */
}

function emailValidate (emailStr) {
/*
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- V1.1.3: Sandeep V. Tamhankar (stamhankar@hotmail.com) -->
*/

/* The following variable tells the rest of the function whether or not
to verify that the address ends in a two-letter country or well-known
TLD.  1 means check it, 0 means don't. */

var checkTLD=1;

/* The following is the list of known TLDs that an e-mail address must end with. */

var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;

/* The following pattern is used to check if the entered e-mail address
fits the user@domain format.  It also is used to separate the username
from the domain. */

var emailPat=/^(.+)@(.+)$/;

/* The following string represents the pattern for matching all special
characters.  We don't want to allow special characters in the address. 
These characters include ( ) < > @ , ; : \ " . [ ] */

var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";

/* The following string represents the range of characters allowed in a 
username or domainname.  It really states which chars aren't allowed.*/

var validChars="\[^\\s" + specialChars + "\]";

/* The following pattern applies if the "user" is a quoted string (in
which case, there are no rules about which characters are allowed
and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
is a legal e-mail address. */

var quotedUser="(\"[^\"]*\")";

/* The following pattern applies for domains that are IP addresses,
rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
e-mail address. NOTE: The square brackets are required. */

var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;

/* The following string represents an atom (basically a series of non-special characters.) */

var atom=validChars + '+';

/* The following string represents one word in the typical username.
For example, in john.doe@somewhere.com, john and doe are words.
Basically, a word is either an atom or quoted string. */

var word="(" + atom + "|" + quotedUser + ")";

// The following pattern describes the structure of the user

var userPat=new RegExp("^" + word + "(\\." + word + ")*$");

/* The following pattern describes the structure of a normal symbolic
domain, as opposed to ipDomainPat, shown above. */

var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

/* Finally, let's start trying to figure out if the supplied address is valid. */

/* Begin with the coarse pattern to simply break up user@domain into
different pieces that are easy to analyze. */

var matchArray=emailStr.match(emailPat);

if (matchArray==null) {

/* Too many/few @'s or something; basically, this address doesn't
even fit the general mould of a valid e-mail address. */

alert("Email address seems incorrect (check @ and .'s)");
return false;
}
var user=matchArray[1];
var domain=matchArray[2];

// Start by checking that only basic ASCII characters are in the strings (0-127).

for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {
alert("Ths username contains invalid characters.");
return false;
   }
}
for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {
alert("Ths domain name contains invalid characters.");
return false;
   }
}

// See if "user" is valid 

if (user.match(userPat)==null) {

// user is not valid

alert("The username doesn't seem to be valid.");
return false;
}

/* if the e-mail address is at an IP address (as opposed to a symbolic
host name) make sure the IP address is valid. */

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("Destination IP address is invalid!");
return false;
   }
}
return true;
}

// Domain is symbolic name.  Check if it's valid.
 
var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++) {
if (domArr[i].search(atomPat)==-1) {
alert("The domain name does not seem to be valid.");
return false;
   }
}

/* domain name seems valid, but now make sure that it ends in a
known top-level domain (like com, edu, gov) or a two-letter word,
representing country (uk, nl), and that there's a hostname preceding 
the domain or country. */

if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) {
alert("The address must end in a well-known domain or two letter " + "country.");
return false;
}

// Make sure there's a host name preceding the domain.

if (len<2) {
alert("This address is missing a hostname!");
return false;
}

// If we've gotten this far, everything's valid!
return true;
}

function validate(the_form) {
  if(the_form.street1.value    == "" ||
     the_form.firstName.value  == "" ||
     the_form.lastName.value   == "" ||
     the_form.phone.value      == "" ||
     the_form.city.value       == "" ||
     the_form.state.value      == "" ||
     the_form.zip.value        == "" ||
     the_form.ccName.value     == "" ||
     the_form.ccNumber.value   == "" ||
     the_form.ccexpmonth.value == "" ||
     the_form.ccexpyear.value  == "") {
    alert('Fields marked with a red asterisk (*) are required');
    return false;
  }
  return true;
}

function pad(num){
  temp=num.split(".");
  if(temp[1]) while(temp[1].length<2) temp[1]+="0"; else temp[1]="00";
  return temp[0]+"."+temp[1];
}

function order(id) {
  window.open('order.php?id=' + id.value,'','channel=no,toolbar=no,fullscreen=no,menubar=no,scrollbars=no,status=no,titlebar=yes,height=350,width=550');
}

function gotoSite(obj) {
  var s;
  s=obj.options[obj.selectedIndex].value
  location.href=s;
}


function createview(imageid,width,height){
  var daHeight = eval(height)
  daView=window.open('view.php?imageid=' + imageid + '&width=' + width + '&height=' + daHeight, '_new', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=' + width + ','+ 'height=' + daHeight)
  if (daView.opener == null) daView.opener = window;
  daView.opener.name = "opener";
}

function nsclick(e){
  error="Copyright � 2002 Rick Canham";
  if (e.which==2||e.which==3) alert (error);
  return false;
}

function disablerc(){
  if(document.layers){
    document.captureEvents(Event.MOUSEDOWN);
    document.onmousedown=nsclick;
  } else if(event) if (event.button==2) alert(error);
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		navigation_02_over = newImage("images/navigation_02-over.gif");
		navigation_03_over = newImage("images/navigation_03-over.gif");
		navigation_05_over = newImage("images/navigation_05-over.gif");
		navigation_06_over = newImage("images/navigation_06-over.gif");
		navigation_07_over = newImage("images/navigation_07-over.gif");
		navigation_08_over = newImage("images/navigation_08-over.gif");
		navigation_09_over = newImage("images/navigation_09-over.gif");
		navigation_10_over = newImage("images/navigation_10-over.gif");
		navigation_11_over = newImage("images/navigation_11-over.gif");
		navigation_12_over = newImage("images/navigation_12-over.gif");
		navigation_13_over = newImage("images/navigation_13-over.gif");
		navigation_14_over = newImage("images/navigation_14-over.gif");


		preloadFlag = true;
	}
}

