SMImgRotate=function(name,imgID){this.imgID=imgID; this.name=name;}
SMImgRotate.prototype.imgs=new Array();
SMImgRotate.prototype.intTimeInterval=5000;
SMImgRotate.prototype.boolRandomDisplay=1;
SMImgRotate.prototype.intCurrentImg=0;
SMImgRotate.prototype.timer="";
SMImgRotate.prototype.imgObj=function(src,url,target){
	if(typeof target=='undefined') target="_self";
	if(typeof url=='undefined') url="";
	this.src=src;
	this.url=url;
	this.target=target;
}
SMImgRotate.prototype.add=function(url,text,target){ this.imgs[this.imgs.length]=new this.imgObj(url,text,target); }

SMImgRotate.prototype.getNext=function(){
	if(this.intCurrentImg+1 < this.imgs.length){
		this.intCurrentImg++;
		return this.intCurrentImg;
	}else{
		this.intCurrentImg=0;
		return 0;
	}
}

SMImgRotate.prototype.rotate=function(){
	var imageID = this.getNext();
	document.getElementById(this.imgID).src = this.imgs[imageID].src;
	document.getElementById(this.imgID+"_link").href=this.imgs[imageID].url;
}

SMImgRotate.prototype.start=function(){
	this.timer=window.setInterval(this.name+".rotate()", this.intTimeInterval);
}
