function slideshow(objectname, filenumb,fid) {
		// load arguments as objects and set defaults
		var a = { objName:objectname, fadeSpeed:20 };
		for (var n in arguments[0]) 
		{ a[n]=arguments[0][n]; }
		
		this.slideBaseId = objectname+'_slide';		
		this.slideImageBaseId = objectname+'_slide_image'; 
			
		this.slides = [];
		this.last = 0;
		this.current = fid;//filenumb;
		this.fadeTimers = []; 
		this.hashNumber = fid;//filenumb;
		
		// loads all the slide images. This is run with addLoadEvent at the end
		this.loadSlides = function()
		{
			
			function loadMe(elem_id,array_num) {
				var elem = document.getElementById(elem_id);
				
				if (elem != null) {
				//	elem.src = slide_images[array_num];
					elem.src = eval(objectname+'_slide_images')[array_num];
				}
			}
			
			// load image after
			loadMe(this.slideImageBaseId + (parseInt(this.hashNumber)+1),this.hashNumber);
			// load image before
			loadMe(this.slideImageBaseId + (parseInt(this.hashNumber)-1),this.hashNumber-2);
			// load the rest
			for (i=1;i<=eval(objectname+'_slide_images').length;i++) {
				loadMe(this.slideImageBaseId + (String(i)),i-1);
			}
		};
		
		// this is used to move to a slide without a fade if need be
		this.showSlide = function()
		{
			this.current = this.hashNumber;
			this.slides[this.current].style.visibility = 'visible';
		};

		// registers a page view
		this.pageView = function()
		{
			var URLFull,URL,pageURL;
			// Register Pageview
			try {
				var pageNumber = this.current;
				
				URLFull=String(document.location).split("?"); 
				pageURL=URLFull[0];		
			}
			catch(e) {}
		};
		
		// moves to the next slide using the fade
		this.fadeNext = function(block_name) 
		{
			// if this.current has moved past the number of slides, bring it back to the beginning, otherwise, pick next slide
			if (this.current >= this.slides.length-1) 
			{this.current = 1;this.last = this.slides.length-1;}
			else 
			{this.last = this.current;this.current++;}
			
			// fade in current slide, fade out last one
			this.initFade(block_name + '_', this.current,0,this.slides[this.current],true,100); 
			
			this.initFade(block_name + '_', this.last,100,this.slides[this.last],false,0); 
		
			// count page view and refresh ads
			this.pageView();
		}; 
		
		// backs up a slide using the fade
		this.fadePrev = function(block_name) 
		{
			
			// if you are on slide 1, go back to last slide, otherwise, pick previous slide
			if (this.current == 1) 
			{this.current = this.slides.length-1;;this.last = 1;}
			else 
			{this.last = this.current;this.current--;}
			
			// fade out current slide, fade in last one
			this.initFade(block_name + '_', this.current,0,this.slides[this.current],true,100); 
			
			this.initFade(block_name + '_', this.last,100,this.slides[this.last],false,0); 
			
			// count page view and refresh ads
			this.pageView();			
		}; 
		
		// set absolute position on an element
		this.position = function(id, t, r, b, l) {
			var ele = document.getElementById(id);
			ele.style.top = t;
			ele.style.right = r;
			ele.style.bottom = b;
			ele.style.left = l;
		}
			
		// this initiaties a fade from one image to another
		this.initFade = function(bl_name, i,opacity,theObject,fadeIn,fadeLimit) 
		{
			// i = which timer you are using. I'm using the image numbers as its timer. This allows for multiple fades at once.
			// opacity = the opacity at which you start your fades. For example, you can start at 10 if you want. 
			// theObject = which object you are fading
			// fadeIn = true for a fade in, false for a fade out
			// fadeLimit = opacity at which you stop. For example, you could stop with the object at 90
			
			// clear timer in case another fade with same timer is going on
			clearInterval(this.fadeTimers[i]);
			// set object to chosen opacity before starting fade, and make sure its visible
			this.setOpacity(i,opacity,theObject);
			theObject.style.visibility = 'visible';

			// fade in, or fade out depending on arguments
			if (fadeIn) {
				setTheInterval = 'window.setInterval(function() { ' + a.objName + '.setOpacity(i,opacity,theObject,fadeIn,fadeLimit); opacity = opacity + 4;},a.fadeSpeed)';
				this.fadeTimers[i] = eval(setTheInterval);
			}
			else {
				setTheInterval = 'window.setInterval(function() { ' + a.objName + '.setOpacity(i,opacity,theObject,fadeIn,fadeLimit); opacity = opacity - 4; if (opacity == 0) theObject.style.visibility = "hidden"; },a.fadeSpeed)';
				this.fadeTimers[i] = eval(setTheInterval);}
				
			// we need to move the navigation and email link to a different spot in the last frame
			switch(this.current) {
				case (eval(objectname+'_slide_images').length+1):
					this.position('slideshowControls', '9px', '15px', 'auto', '0px');					
					break;
				default:
					this.position('slideshowControls', '9px', 'auto', 'auto', '0px');
					break;
			}
		}; 
		
		// function that is run on an interval to do the actual fade work
		this.setOpacity = function(i,opacity,theObject,fadeIn,fadeLimit) {
			// if you have reached whatever limit, clear timer
			if (opacity == fadeLimit) {clearInterval(this.fadeTimers[i]);}
			
			// set the opactity to whatever out of 100 and perform cross browser opacity move
			var setOpacity = opacity/100;
			theObject.style.filter = "alpha(opacity:"+opacity+")";
			theObject.style.KHTMLOpacity = setOpacity;
			theObject.style.MozOpacity = setOpacity;
			theObject.style.opacity = setOpacity;
		}; 
		
		this.init = function() {
			var count = 1;
			var ind = filenumb;
			var limiter = 1;
			var s;
			// setup slides and texts arrays
			
			while(ind >= 0 && limiter <= filenumb)
			{
				if (s = document.getElementById(this.slideBaseId + count)) {
					this.slides[ind] = s;
					count++;
					ind--;
					limiter++;
				}
				else
				{
					count++;
				}
			}
			count = 1;
	
			// shows whichever slide you are supposed to go to based on hash
			this.showSlide();
		}; 
}
/* Repeating Functions from WebMD scripts.js to create a standalone slideshow */
/* function to add an onload event */
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') 
  {
    window.onload = func;
  } else 
    {
       window.onload = function() 
    {
      oldonload();
      func();
    }
  }
}	
/* function to change a class */
function setClass(objectID,newClass) {
	var object = document.getElementById(objectID);
	if (object) {
		object.className = newClass;
	}
}

/* function to switch tabs in the last frame */
function showTab(n) {
	var content1 = document.getElementById('more_ss_content1');
	var content2 = document.getElementById('more_ss_content2');
	content1.style.display = 'none';
	content2.style.display = 'none';
	eval("content"+n+".style.display = 'block'");
	var tab1 = document.getElementById('more_ss_tab1');
	var tab2 = document.getElementById('more_ss_tab2');
	setClass(tab1.id, 'more_ss_tab_inactive_fmt');
	setClass(tab2.id, 'more_ss_tab_inactive_fmt');
	eval("tab"+n+".className = 'more_ss_tab_active_fmt'");
	return false;
}

/* cache the back and forward images */
/*var back_on = new Image();
back_on.src = '';//'sl/img/slideshow_alt2_back_on.gif';
var fwd_on = new Image();
fwd_on.src ='';//'sl/img/slideshow_alt2_forward_on.gif';*/
