
// Example: obj = findObj("image1");
function findObj(theObj, theDoc)
{
  var p, i, foundObj;

  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  return foundObj;
}

function addEvent(obj, evType, fn){ 
 if (obj.addEventListener){ 
   obj.addEventListener(evType, fn, false); 
   return true; 
 } else if (obj.attachEvent){ 
   var r = obj.attachEvent("on"+evType, fn); 
   return r; 
 } else { 
   return false; 
 } 
}

var delay=5500 //set delay in miliseconds
var imageCol = new Array();
var counters = new Array();

function imageChanger(){
 for(propID in imageCol){
		var currentCol=imageCol[propID];
		var actCount=counters[propID];
		actCount=actCount+1;
		if (currentCol.length<=actCount){
			actCount=0
		}
		counters[propID]=actCount;
		
		actSrc=currentCol[actCount];
		//alert (actSrc)
		if (actSrc==undefined){
			actSrc="noimage.jpg";
		}
		actImage=findObj("id_"+propID)
		actImage.src='/Files/'+actSrc;
		
	}
		
}

function startChange(){
	var imageTimer= setInterval("imageChanger()", delay)
}
addEvent(window, 'load', startChange);


