function swapImages(strThisObjName){
	this.knownAs=strThisObjName;
	this.iWaitMillis=4000;
	this.swapImages=Array();
	this.imageSizes=Array();
	this.swapTitles=Array();
	this.swapLinks=Array();
	this.openSizes=Array();
	this.imageID="";
	this.titleID="";
	this.LinkID="";
	this.prevImage=-1;
	this.currImage=0;
	this.showFilter=(parseFloat(navigator.appVersion.split("MSIE")[1])>=5.5)?1:0;
}

swapImages.prototype.addImage=function(strURL,strTitle,strLink,imgWidth,imgHeight,linkHeight,linkWidth){
	if(document.images){
		var temp=new Image()
		temp.src=strURL;
	}
	this.swapImages[this.swapImages.length]=strURL;
	this.swapTitles[this.swapTitles.length]=strTitle;
	this.imageSizes[this.imageSizes.length]=new Array(imgWidth,imgHeight);
	this.swapLinks[this.swapLinks.length]=strLink?strLink:'#';
	this.openSizes[this.openSizes.length]=new Array(linkWidth,linkHeight);
	
}

swapImages.prototype.setOpacity=function(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;
}

swapImages.prototype.fade=function(objId,opacity,increment,delay) {
  increment=increment?increment:10;
  delay=delay?delay:100;
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity <= 100 && opacity >= 0) {
      this.setOpacity(obj, opacity);
      opacity += increment;
      window.setTimeout(this.knownAs+".fade('"+objId+"',"+opacity+","+increment+","+delay+")", delay);
    }else{
		document.getElementById(this.imageID).src=document.getElementById(this.imageID+'_over').src;
		document.getElementById(this.imageID+'_over').style.visibility='hidden';
	}
  }
}


swapImages.prototype.transImage=function(oImg) {
	oImg.filters(0).Apply();
    oImg.style.visibility = "visible";
    oImg.filters(0).Play();
}

swapImages.prototype.switchImage=function() {
	this.prevImage=this.currImage;
	this.currImage++;
	newImage = this.swapImages[this.currImage];
	if (this.showFilter == 1) {
		this.transImage(document.getElementById(this.imageID));
		document.getElementById(this.imageID).src = newImage;
	}else{
		this.swapImage(this.imageID,'',newImage);
	}if(document.getElementById(this.linkID))
		if(this.swapLinks[this.currImage])
			document.getElementById(this.linkID).href = this.swapLinks[this.currImage];
		else{
			if(document.getElementById(this.linkID))
				document.getElementById(this.linkID).href = '#';
		}
	if(document.getElementById(this.titleID))
		if(this.swapTitles[this.currImage])
			document.getElementById(this.titleID).innerHTML = this.swapTitles[this.currImage];
		else
			document.getElementById(this.titleID).innerHTML = '&nbsp;';
		
}

swapImages.prototype.swapImage=function() { 
	var i,j=0,x,a=this.swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

swapImages.prototype.swap=function() {
	if(this.currImage==this.swapImages.length-1) this.currImage=-1;
	this.switchImage();
}

swapImages.prototype.getRealLeft=function(obj) {
    xPos = obj.offsetLeft;
    tempEl = obj.offsetParent;
    while (tempEl != null) {
        xPos += tempEl.offsetLeft;
        tempEl = tempEl.offsetParent;
    }
    return xPos;
}

swapImages.prototype.getRealTop=function(obj) {
    yPos = obj.offsetTop;
    tempEl = obj.offsetParent;
    while (tempEl != null) {
        yPos += tempEl.offsetTop;
        tempEl = tempEl.offsetParent;
    }
    return yPos;
}

