function slideShow(slideDiv,object){
	//setup our global var that will store our images array.
	//make sure our constructor only runs once
	this.setupCheck=false;
	//the array! this will be populated by AJAX
	this.images=new Array();
	//this is what stores our fading div name
	this.slideDiv=slideDiv;	
	//keeps track of what slide we are at.
	this.slideNum=0;
	//this is the nmae of the object because it refers to itself in a third person kind of way at points.
	this.name=object;

	//util functions used in later code for things that need to be in the setTimeout function.
	this.appear=function(){
		Effect.Appear(this.slideDiv);
	}
	
	this.newBack=function(){
		document.getElementById(this.slideDiv).style.backgroundImage="url('"+this.images[this.slideNum]+"')";
		document.getElementById(this.slideDiv).style.backgroundPosition="top right";
	}	

	//function that will request a list of images in the slides folder from a php file(see PHP_lib/getSlides.php)
	this.setup = function(){
		var requestURL="images/createSlides.php?object="+this.name;
		var xmlhttp;
		if (window.XMLHttpRequest){
			  // code for IE7+, Firefox, Chrome, Opera, Safari
			  xmlhttp=new XMLHttpRequest();
		  }
		else if (window.ActiveXObject){
		  	// code for IE6, IE5
		  	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		else{
		  	alert("Your browser does not support XMLHTTP!");
		  }

		xmlhttp.onreadystatechange=function(){
			if(xmlhttp.readyState==4)
			  {

			 	eval(xmlhttp.responseText);
			  }
		}
		xmlhttp.open("GET",requestURL,true);
		xmlhttp.send(null);
	}

	//get and display the next slide in the the array.
	this.nextSlide = function(){
		
		if(this.slideNum < this.images.length-1){
			this.slideNum++;

				Effect.Fade(this.slideDiv);
					setTimeout(this.name+".newBack();",1000);
				setTimeout(this.name+'.appear();',1000);
			return true;
		}else{
			this.slideNum=0;
				Effect.Fade(this.slideDiv);
					setTimeout(this.name+'.newBack();',1000);
				setTimeout(this.name+'.appear();',1000);
			return true;
		}
		return false;
	}

	this.init = function(){
		setInterval(this.name+".nextSlide();",8000);
	}

	// constructor
	this.start=function(){
		this.setup();
		this.init();		
	}
}
//mailing functions used on contact.php
function sendStart(){
	Effect.Fade("text");
	setTimeout('Effect.Appear("send");',1000);
}

function sendEnd(){
	Effect.Fade("send");
	setTimeout('Effect.Appear("thankyou");',1000);
}

//fixes the PNG issue in IE
$(document).ready(function(){ 
        $(document).pngFix(); 
    }); 
