/* Here are the basics of the things you need in your page.

For any page that uses this script, put in head section:

	<script language="javascript" src="imagechanger.js"></script>

For the Home Page for the logo intro:
	<body onload="start()">

	<div id="targetimagediv">
	<img src="black.png" id=targetimage name="targetimage">
	</div>
	
For anywhere else in the site to have a mouseover image change:

	<div id="reddiv">
	<img src="red_tn_f.gif" name="red" id="red" onmouseover="multimouse('targetimage','red.gif','.25','red','red_tn.gif','.25')" onmouseout="mouse('red','red_tn_f.gif','.25')"/>
	</div>

For the above, onmouseover calls the function multimouse.  This function accepts parameters in units of three.
The first parameter should be the id of the image that will be changed (the division containing this image should 
be of the same size and have the same id as the image, except with the addition of "div" on the end.
The second parameter should be the image to be changed to.  
The third parameter should be the length of the fade transition in seconds.
Repeat this set of three for as many images and image locations you want changed all at the same time.

For a two-image slide show on mouseover:
Use the same coding as above, except use the fuction automouse instead.

onmouseover="autoimouse('targetimage','red.gif','.25','green.gif','2','red','red_tn.gif','.25',null,null)" onmouseout="mouse('red','red_tn_f.gif','.25')"

The first three terms behave the same as in "multimouse"
but the fourth term is the second image in the slideshow,
and the fifth term is the display time of the image in seconds.
The function multimouse will stop the slideshow, so to do any image changes while keeping the slidshow running,
use either the function "mouse" or the function "automouse" with the fourth and fifth terms in each grouping set to null.
*/
	
 	var image1 = new Array("images/home_logo/circle_hole.png","images/home_logo/circle_gd.png");  // these are the images for the homepage
	
 	var i = 0; 
	var ready = 1;
	var famt = 0;
	var fade = "yes"			    // Optional fade transition for Internet Explorer
	var transdur = ".5"			 // Length of this transition in seconds (accepts decimals)
	var tofadenotie = 0;
	var autochange = 0;
  	
	function change(towhere,what,fadedur){
		if (fade == "yes" && navigator.appName == "Microsoft Internet Explorer"){
	 		document.images[towhere].style.filter="blendTrans(duration='"+fadedur+"')";
	 		document.images[towhere].filters.blendTrans.apply();
			document.images[towhere].src=what;
	 		document.images[towhere].filters.blendTrans.play();
		}
		else if (fade == "yes" && fadedur > 0){
			var from = document.images[towhere].src
			document.getElementById(towhere+'div').style.backgroundImage="url('"+from+"')";
			document.images[towhere].style.opacity=0;
			setTimeout("quickpause('"+towhere+"','"+what+"','"+fadedur+"')",10);
		}
	  	else {
	  		document.images[towhere].src=what;
  		}
	}
	function quickpause(towhere,what,fadedur){
		document.images[towhere].src=what;
		for (i=0; i<=25; i++) {
			setTimeout("fadenotie('"+towhere+"',"+i+")",i*fadedur*1000/25);
		}
	}
	function fadenotie(towhere,famt){
			document.images[towhere].style.opacity=famt/25;
	}
	function setready(){
		ready = 1;
	}
	function start(){
		if (document.images){
  			pic1=new Image(); 
			pic1.src=image1[0]; 
			pic2=new Image();
			pic2.src=image1[1];
		}
		ready = 0;
		tofadenotie = 1;
	  	setTimeout("change('targetimage',image1[0],transdur)",1000);
		setTimeout("change('targetimage',image1[1],transdur)",2000);
	   	setTimeout("setready()",3000);
	}
	function mouse(mtowhere,mwhat,mfadedur){
		if (ready == 1){
			pic1=new Image();
			pic1.src=mwhat;
			change(mtowhere,mwhat,mfadedur);
		}
	}
	function multimouse(){
		autochange=0;
		for (i=0;i<multimouse.arguments.length;i=i+3){
			mouse(multimouse.arguments[i],multimouse.arguments[i+1],multimouse.arguments[i+2]);
		}
	}
	function automouse(){
		autochange=1;
		for (i=0;i<automouse.arguments.length;i=i+5){
			if (automouse.arguments[i+3] == null){
				mouse(automouse.arguments[i],automouse.arguments[i+1],automouse.arguments[i+2]);
			}
			else {
				autochanger(automouse.arguments[i],automouse.arguments[i+1],automouse.arguments[i+2],automouse.arguments[i+3],automouse.arguments[i+4]);
			}
		}
	}
	function autochanger(awhere,awhat,atrans,awhat2,ahold){
		if (autochange == 1){
			mouse(awhere,awhat,atrans);
			setTimeout("autochanger('"+awhere+"','"+awhat2+"','"+atrans+"','"+awhat+"','"+ahold+"')",ahold*1000);
		}
	}