function addLoadEvent(func) {
	var ssArray = "";
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}




var sqImageArray = new Array();
var sqImageIterator = new imageIterator();

function showImages(sqImageObject) {
	sqImageId = 'sqPhoto';
	sqImage = document.getElementById(sqImageId);
	sqImage.style.visibility = 'visible';
	sqImage.setAttribute("src", sqImageObject.image.src);
	setOpacity(sqImage, 0);
	
	fadeIn(sqImageId, 0);
	
}



function fadeIn(objId2 ,opacity) {
	if (document.getElementById) {
		obj2 = document.getElementById(objId2);
		if (opacity > 101) {


        }
		if (opacity <= 100) {
			setOpacity(obj2, opacity);
			opacity += 10;
			window.setTimeout("fadeIn('"+objId2+"',"+opacity+")", 50);
		}
	}
}

function setOpacity(obj, opacity) {
  opacity = (opacity == 100)?99.999:opacity;
  
  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";
  
  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;
  
  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;
  
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}

function imageObject(s,h,c) {
	this.src = s;
	this.href = h;
	this.caption = c;
	var i = new Image();
	this.image = i;
	this.image.src = s;
}

function imageIterator(_imageArray) {
	this.iterator = 0;
	this.array = _imageArray;
	this.increment = function() { this.iterator = (this.iterator == (this.array.length - 1)) ? 0 : this.iterator+1; };
	this.decrement = function() { this.iterator = (this.iterator == 0) ? (this.array.length - 1) : this.iterator-1; };
	this.getNext = function() { this.increment(); next = this.array[this.iterator];  return next; };
	this.getPrevious = function() { this.decrement(); previous = this.array[this.iterator];  return previous; };
}

function executeInterval() {
	showImages(sqImageIterator.getNext());
}

addLoadEvent( function() {
	if (document.getElementById('sqPhoto')) { 
		showImages(sqImageArray[0]);
		showtime = setInterval("executeInterval()", 6000);
	}
} );

