function image_obj(src){
	this.img=new Image()
	this.img.src=src
}

function image_obj_onoff(src_on, src_off){
	this.img=new Array()
	this.img['on']=new image_obj(src_on)
	this.img['off']=new image_obj(src_off)
}

function image_set(obj, obj_set){
	if(obj && obj_set) obj.src=obj_set.img.src
}

function image_set_onoff(obj, obj_off, onoff){
	if(obj_off) { image_set(obj, obj_off.img[onoff]) }
}

function filterChange(){
        this.filterChange=0
}

function changeImg(img,src,filter,new_img){
    filter  = (filter) ? filter : -1
			
		if ( ! img.filters  || filter == -1 ) {
			new_img = new image_obj(src)
			image_set(img,new_img)
			return true
		}
        if( img.filterChange ) return false
        if( IE4 && filter >= 0 ){
                img.onfilterchange=filterChange
                img.filterChange=1
                img.filters.item(0).Transition=filter
                img.filters.item(0).Apply()
        }
        img.src=src
        if(IE4 && filter>=0) img.filters.item(0).Play()
        return true
}

function slideShow (obj,iarray,timeout,next,filter,loop,i) {
        next = (next) ? next : 0
		if (next < 0) return -100;
        filter  = (filter) ? filter : -1
        i = new image_obj(iarray[next])
        eval ("setTimeout('changeImg(document.images[\""+obj.name+"\"],\""+i.img.src+"\","+filter+")',"+timeout+")")
        if (next < iarray.length-1)
			next++
        else if (loop)
			next=0;
		else
			next =-1
        return next;
}

function load_img_array (iarray, img) {
	if (!iarray.length)
		return
	for ( i=0; i<iarray.length; i++ ){
        eval ("img"+i+" = new image_obj('"+iarray[i]+"')");
	}
}

