function showPic (whichpic) {
	if (document.getElementById) {
		// Fade out current image, change img src to new image and fade back in
		w = Effect.toggle('photolink', 'appear', {duration: 0.2});
		links = whichpic.href.tokenize("/", ".jpg", true);
		currentLink = links[links.length-1];
		x = Effect.toggle('showImage', 'appear', {duration: 0.5, afterFinish:function() { $('showImage').src = ""; $('showImage').src = whichpic.href; Effect.toggle('showImage', 'appear', {delay: 1.5,duration: 0.5}); $('photolink').href = "#"; Effect.toggle('photolink', 'appear', {delay: 1.5,duration: 0.5});} });
		return false;
	} else {
  		return true;
	}
}

/* 
had to change the href's in this line to '#' because pages are now dynamic. Hard coded links from home page gallery will not work. 2010-02-18
x = Effect.toggle('showImage', 'appear', {duration: 0.5, afterFinish:function() { $('showImage').src = ""; $('showImage').src = whichpic.href; Effect.toggle('showImage', 'appear', {delay: 1.5,duration: 0.5}); if (currentLink == "solutions") { $('photolink').href = currentLink + ".htm"; } else { $('photolink').href = "products-" + currentLink + ".htm"; } Effect.toggle('photolink', 'appear', {delay: 1.5,duration: 0.5});} });
*/
function loadLink (pic) {
	
}

function loadGallery() {
  if (!document.getElementsByTagName) return false;
  // Get all links on page
  var links = document.getElementsByTagName("a");
  for (var i=0; i < links.length; i++) {
    // Attach showPic function to onclick event of all galleryimage links
	if (links[i].className.match("galleryimage")) {
      links[i].onclick = function() {
        return showPic(this);
      }
    }
  }
  if ($('photo-aircraft'))
  	$('photo-aircraft');
}

/*******************************************************************/
/***                                                             ***/
/***   Tokenizer.js - JavaScript String Tokenizer Function       ***/
/***                                                             ***/
/***   Version   : 0.2                                           ***/
/***   Date      : 01.05.2005                                    ***/
/***   Copyright : 2005 Adrian Zentner                           ***/
/***   Website   : http://www.adrian.zentner.name/               ***/
/***                                                             ***/
/***   This library is free software. It can be freely used as   ***/
/***   long as this this copyright notice is not removed.        ***/
/***                                                             ***/
/*******************************************************************/

String.prototype.tokenize = tokenize;

function tokenize()
  {
     var input             = "";
     var separator         = " ";
     var trim              = "";
     var ignoreEmptyTokens = true;

     try {
       String(this.toLowerCase());
     }
     catch(e) {
       window.alert("Tokenizer Usage: string myTokens[] = myString.tokenize(string separator, string trim, boolean ignoreEmptyTokens);");
       return;
     }

     if(typeof(this) != "undefined")
       {
          input = String(this);
       }

     if(typeof(tokenize.arguments[0]) != "undefined")
       {
          separator = String(tokenize.arguments[0]);
       }

     if(typeof(tokenize.arguments[1]) != "undefined")
       {
          trim = String(tokenize.arguments[1]);
       }

     if(typeof(tokenize.arguments[2]) != "undefined")
       {
          if(!tokenize.arguments[2])
            ignoreEmptyTokens = false;
       }

     var array = input.split(separator);

     if(trim)
       for(var i=0; i<array.length; i++)
         {
           while(array[i].slice(0, trim.length) == trim)
             array[i] = array[i].slice(trim.length);
           while(array[i].slice(array[i].length-trim.length) == trim)
             array[i] = array[i].slice(0, array[i].length-trim.length);
         }

     var token = new Array();
     if(ignoreEmptyTokens)
       {
          for(var i=0; i<array.length; i++)
            if(array[i] != "")
              token.push(array[i]);
       }
     else
       {
          token = array;
       }

     return token;
  }