/*Rollover effect on different image script-
By JavaScript Kit (http://javascriptkit.com)
Over 200+ free scripts here!
Majot revisions and additions by David Peters
to support text overlay and insertion
*/

// photoInfo object constructor

function photoInfo (elmntId,details1,details2,details3) {
	this.elmntId = elmntId;
	this.details1 = details1;
	this.details2 = details2;
	this.details3 = details3;
	return true;
}

// photoInfoList object constructor

function photoInfoList (elmntId,details1,details2,details3,details4,details5,details6) {
	this.elmntId = elmntId;
	this.details1 = details1;
	this.details2 = details2;
	this.details3 = details3;
	this.details4 = details4;
	this.details5 = details5;
	this.details6 = details6;
	return true;
}

// elementStyleInfo object constructor

function elementStyleInfo (elmntId,properties) {
	this.elmntId = elmntId;
	this.properties = properties;
	return true;
}


function changeImage(towhat,url){
	if (document.images)
	{
		document.images.targetimage.src=towhat.src
	}
}

var lastElmntIdDisplayed = '';

function changeImageAndText(towhatimage,towhattext,towhatstyle,url){
	if (document.images)
	{
		dinfo = document.getElementById(lastElmntIdDisplayed);
		//alert(dinfo);
		// turn off the visibility of the last element we showed
		if (dinfo) {
			dinfo.style.display = "none";
			lastElmntIdDisplayed = '';
		}
		// change the image to the new one associated with the mouseover thumbnail
		document.images.targetimage.src=towhatimage.src;
		// if there is an element in the towhattext array entry, make it visible
		if (towhattext.elmntId != "")
		{
			//alert(towhattext.elmntId + towhattext.details1 + towhattext.elmntId + towhattext.details2);
			dinfo = document.getElementById(towhattext.elmntId);
			//alert(dinfo);
			if (dinfo) {
				dinfo.style.display = "block";
				lastElmntIdDisplayed = towhattext.elmntId;
			}
		}
		else
		{
			// turn off visibility of the element last turned on
		}
		// now modify the newly visible element (maybe should do this in different order and incorporatet with above stuff)
		d1 = document.getElementById(towhattext.elmntId);
		if (d1) {
			// In IE, the childNodes array may be NULL if there is no text in it to begin with. (hakck) Fix with non-breaking space in the element in the HTML doc.
			// Or test for existence of the firstChild and then add the node if necessary is better fix.

			// clear old text
			d1.childNodes[0].data = '';
			
			// change the style attibutes for new text
			d1.style.cssText = '';
			d1.style.cssText = towhatstyle.properties;
			//d1.style.setExpression("towhatstyle.name1","towhatstyle.val1","JavaScript");
			//d1.style.position = towhatstyle.val1;
			//d1.style.top = towhatstyle.val2;	
			//d1.style.left = towhatstyle.val3;	
			//d1.style.color = towhatstyle.val4;	
			//d1.style.fontSize = towhatstyle.val5;
			
			// and insert new text
			d1.childNodes[0].data = towhattext.details1;
		}
		d2 = document.getElementById('fainfoText2');
		if (d2) {
			d2.childNodes[0].data = '';
			d2.childNodes[0].data = towhattext.details2;
			
		}
		d3 = document.getElementById('fainfoText3');
		if (d3) {
			d3.childNodes[0].data = '';
			d3.childNodes[0].data = towhattext.details3;
		}
		d4 = document.getElementById('fainfoText4');
		if (d4) {
			d4.childNodes[0].data = '';
			d4.childNodes[0].data = towhattext.details4;
		}
		d5 = document.getElementById('fainfoText5');
		if (d5) {
			d5.childNodes[0].data = '';
			d5.childNodes[0].data = towhattext.details5;
		}
		d6 = document.getElementById('fainfoText6');
		if (d6) {
			d6.childNodes[0].data = '';
			d6.childNodes[0].data = towhattext.details6;
		}
	}
	return true;
}

function warp(){
	window.location=gotolink
}
function newpage(newurl) {
	parent.location=newurl
}

var myImages=new Array()
var myThumbImages=new Array()

function preloadimages(images, thumbs){
	for ( i=0; i < images.length; i++ )
	{
		myImages[i]=new Image()
		myImages[i].src= images[i]
	}
	for ( i=0; i < thumbs.length; i++ )
	{
		myThumbImages[i]=new Image()
		myThumbImages[i].src= thumbs[i]
	}
	return true;
}
