function WM_imageSwap(daImage, daSrc){
  var objStr,obj;

  /*
    WM_imageSwap()
    Changes the source of an image.

    Source: Webmonkey Code Library
    (http://www.hotwired.com/webmonkey/javascript/code_library/)

    Author: Shvatz
    Author Email: shvatz@wired.com

    Usage: WM_imageSwap(originalImage, 'newSourceUrl');

    Requires: WM_preloadImages() (optional, but recommended)
    Thanks to Ken Sundermeyer (ksundermeyer@macromedia.com) for his help
    with variables in ie3 for the mac. 
    */

  // Check to make sure that images are supported in the DOM.
  if(document.images){
    // Check to see whether you are using a name, number, or object
    if (typeof(daImage) == 'string') {
      // This whole objStr nonesense is here solely to gain compatability
      // with ie3 for the mac.
      objStr = 'document.' + daImage;
      obj = eval(objStr);
      obj.src = daSrc;
    } else if ((typeof(daImage) == 'object') && daImage && daImage.src) {
      daImage.src = daSrc;
    }
  }
}


//roll-over layers
function changeBackY() {
  var obj,args=changeBackY.arguments;
  eval ("obj="+args[0]+"; obj.style.backgroundColor='#0066FF'; obj.style.color='#FFFFFF'");}

//roll-out layers
function changeBackW() {
  var args=changeBackW.arguments;
  eval ("obj="+args[0]+"; obj.style.backgroundColor=''; obj.style.color='#0066FF'");}  

//preload spacers
function MM_findObj(n, d) { //v4.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);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

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];}}
}

//flip-flop layer visibility
// Copyright 2003, Marja Ribbers (FlevOOware.nl)
function flvFTL1(){// v1.0
var v1=arguments,v2,v3,v4,v5;
for (v3=0;v3<v1.length;v3++){v2=MM_findObj(v1[v3]);
if (v2){if (document.layers){v4=v2;v5="show";}
else {v4=v2.style;v5="visible";}v4.visibility=(v4.visibility==v5)?"hidden":"visible";}}}







//  Force getElementById to work
if(!document.getElementById){
	if(document.all)
	document.getElementById=function(){
		if(typeof document.all[arguments[0]]!="undefined")
		return document.all[arguments[0]]
		else
		return null
	}
	else if(document.layers)
	document.getElementById=function(){
		if(typeof document[arguments[0]]!="undefined")
		return document[arguments[0]]
		else
		return null
	}
}


function changeClass(id, c) {
	document.getElementById(id).className = c;
}




//  Alternative to "voided" links

function Hello() {
	// Empty function
}




//  Show and Hide objects

function showObject(id) {
	document.getElementById(id).style.display = "";
	
}
function hideObject(id) {
	document.getElementById(id).style.display = "none";
}




//  Get visible thumbnails from index.html

function getVisible() {

	var visibleObjects = "";
	var visibleStatus = "";
	for (i = 0; i < slideMax; i++) {

		id = "thumbnail" + i;
		visibleStatus = document.getElementById(id).style.display;
		if (visibleStatus != "none") {

			if (visibleObjects) visibleObjects += ",";
			visibleObjects += slideId[i];
		}
	}
	return visibleObjects;
}



// open iframe
function makeFrame(url) {

	document.getElementById('slide').style.display = "block";
	document.getElementById('fadebg').style.display = "block";
	
	// start the FADE!
	Loader();
	
	document.getElementById('sframe').innerHTML ="<iframe src=\""+url+"\" width=\"540px\" height=\"550px\" frameborder=\"0\" framespacing=\"0\" marginheight=\"0\"  marginwidth=\"0\" hspace=\"0\" vspace=\"0\" scrolling=\"no\" name=\"slide_frame\" id=\"slide_frame\"></iframe>";
	
	
}


// close iframe
function closeFrame() {
	document.getElementById('slide').style.display = "none";
	document.getElementById('fadebg').style.display = "none";
}





function showContact() {
	document.getElementById('contactDiv').style.display = "";
	document.getElementById('fadebg').style.display = "block";
	// start the FADE!
	Loader();
	
}
function hideContact() {
	document.getElementById('contactDiv').style.display = "none";
	document.getElementById('fadebg').style.display = "none";
}







// ----------------------------------------
// FADE Code

var fadeArray = new Array(0, 6, 11, 17, 23, 30, 38, 47, 56, 66, 75);
var currentFade = 0;
var totalFade = fadeArray.length;


function Loader() {
	setZero();
	window.setTimeout("Fader();", 20);
}


function setZero() {
	setOpac(0);
}

function Fader() {
	setOpac(fadeArray[currentFade]);
	currentFade++;
	if (currentFade < totalFade) {
		window.setTimeout("Fader();", 20);
	} else {
		currentFade = 0;
	}
}

function setOpac(opacity) {
	// Fix for math error in some browsers
	opacity = (opacity == 100) ? 99.999 : opacity;
	
	// IE/Windows
	document.getElementById('imgsDisplay').style.filter = "alpha(opacity:"+opacity+")";
	// Safari < 1.2, Konqueror
	document.getElementById('imgsDisplay').style.KHTMLOpacity = opacity/100;	
	// Older Mozilla and Firefox
	document.getElementById('imgsDisplay').style.MozOpacity = opacity/100;
	// Safari 1.2, newer Firefox and Mozilla, CSS3
	document.getElementById('imgsDisplay').style.opacity = opacity/100;

}

// -------------------------------------------------------





//  Popup windows

function popWindow(url, id, width, height) {

	var x = (screen.width  / 2) - (width  / 2);
	var y = (screen.height / 2) - (height / 2) - 20;
	newWindow = window.open(url,id,"width="+ width +",height="+ height +",scrollbars=no,resizable=no,left="+ x +",top="+ y);
	newWindow.focus();
}




//  Slide Controls

function slideNext() {

	hideObject("slide"+ slideCurrent);
	slideCurrent++;
	if (slideCurrent > slideMax) slideCurrent = 0;
	showObject("slide"+ slideCurrent);
}
function slidePrev() {

	hideObject("slide"+ slideCurrent);
	slideCurrent--;
	if (slideCurrent < 0) slideCurrent = slideMax;
	showObject("slide"+ slideCurrent);
}




// TOOLTIP

// ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// 
// Coded by Travis Beckham
// http://www.squidfingers.com | http://www.podlob.com
// If want to use this code, feel free to do so, but please leave this message intact.
//
// ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// --- version date: 06/13/04 ---------------------------------------------------------

tooltip = {
	name : "tooltipDiv",
	offsetX : 10,
	offsetY : 10,
	tip : null
};
tooltip.init = function () {
	if (!document.getElementById) return;
	
	// It would be nice to be able to generate the tooltip div, 
	// but when using document.createElement Explorer5/MacOS9, 
	// the tooltip div becomes 100% of the window height.
	// Therefore, we have to use document.getElementById to access
	// a div that is already in the body.
	
	// this.tip = document.createElement ("div");
	// this.tip.setAttribute ("id", this.name);
	// document.body.appendChild (this.tip);
	
	this.tip = document.getElementById (this.name);
	if (this.tip) document.onmousemove = function (evt) {tooltip.move (evt)};
};
tooltip.move = function (evt) {
	var x=0, y=0;
	if (document.all) {// Explorer
	
		// Explorer5 contains the documentElement object but it's empty, 
		// so we must check if the scrollLeft property is available.
		
		// If Explorer6 is in Quirks mode, the documentElement properties 
		// will still be defined, but they will contain the number 0.
		
		// If Explorer6 is in Standards compliant mode, the document.body 
		// properties will still be defined, but they will contain the number 0.
		
		x = (document.documentElement && document.documentElement.scrollLeft) ? document.documentElement.scrollLeft : document.body.scrollLeft;
		y = (document.documentElement && document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop;
		x += window.event.clientX;
		y += window.event.clientY;
		
	} else {// Mozilla
		x = evt.pageX;
		y = evt.pageY;
	}
	// If the style property value is not a string containing the unit measurement,
	// browsers in standard compliant mode will not set the property.
	this.tip.style.left = (x + this.offsetX) + "px";
	this.tip.style.top = (y + this.offsetY) + "px";
};
tooltip.show = function (text) {
	if (!this.tip) return;
	this.tip.innerHTML = text;
	// Without the next line, Explorer5/Mac has a redraw problem.
	this.tip.style.visibility = "visible";
	this.tip.style.display = "block";
};
tooltip.hide = function () {
	if (!this.tip) return;
	// Without the next line, Explorer5/Mac has a redraw problem.
	this.tip.style.visibility = "hidden";
	this.tip.style.display = "none";
	this.tip.innerHTML = "";
};






