function RadRotator(clientID, FramesToShow, ScrollDirection)
{
	var oldRotator = window[clientID];	
	if (oldRotator && typeof(oldRotator.Dispose) == "function")
	{
		oldRotator.Dispose();
	}
	
   	this.ClientID = clientID;	
	this.SmoothScrollDelay = 10;
	this.ControlElement = document.getElementById(clientID+"_Div");
	
	this.FrameContainer = document.getElementById(clientID+"_FrameContainer");

	if(FramesToShow)
	{
		this.FramesToShow = FramesToShow;
	}
	else
	{
		this.FramesToShow = 1;
	}
	
	this.FrameContainer.style.top = "0px";
	this.FrameContainer.style.left = "0px";
	this.CurrentFrame = 0;

	var instance = this;
    
    
	this.ControlElement.RadResize = this.ControlElement.RadShow = function ()
	{
	    instance.FixHeight();
        instance.Start();
        
        this.style.cssText = this.style.cssText;
	}

    this.MouseEnterHandler = function (e){instance.OnMouseEnter(e);};
    this.MouseLeaveHandler = function (e){instance.OnMouseLeave(e);};
    this.MouseOverHandler = function (e){instance.OnMouseOver(e);};
    this.MouseOutHandler = function (e){instance.OnMouseOut(e);};
    this.OnLoadHandler = function (){instance.Start();};
    
	this.AttachEvent(this.ControlElement,"mouseenter",this.MouseEnterHandler);
	this.AttachEvent(this.ControlElement,"mouseleave",this.MouseLeaveHandler);
	this.AttachEvent(this.ControlElement,"mouseover",this.MouseOverHandler);	
	this.AttachEvent(this.ControlElement,"mouseout",this.MouseOutHandler);
	this.AttachEvent(window, "load", this.OnLoadHandler);
	
	this.UnLoadHandler = function()
    {
		instance.Dispose();
    };

    this.AttachEvent(window,"unload",instance.UnLoadHandler);
};

RadRotator.prototype.Dispose = function()
{	
	this.disposed = true;
	try
	{
		this.DetachEvent(window, "unload", this.UnLoadHandler);
		this.UnLoadHandler = null;
		
		this.ClearTimeouts();
		
		this.DetachEvent(this.ControlElement, "mouseenter", this.MouseEnterHandler);
		this.MouseEnterHandler = null;
		this.DetachEvent(this.ControlElement, "mouseleave", this.MouseLeaveHandler);
		this.MouseLeaveHandler = null;
		this.DetachEvent(this.ControlElement, "mouseover", this.MouseOverHandler);	
		this.MouseOverHandler = null;
		this.DetachEvent(this.ControlElement, "mouseout", this.MouseOutHandler);
		this.MouseOutHandler = null;
		this.DetachEvent(window, "load", this.OnLoadHandler);
		this.OnLoadHandler = null;
		
		this.ControlElement = null;
		this.FrameContainer = null;
	}
	catch (error)
	{
	}
}

RadRotator.prototype.attachEvent = function(eventName, eventHandler)  
{  
    var originalHandler = this.FunctionFromVariable(eventHandler);  
    var handler = function(sender, args)  
    {  
		return originalHandler(sender, args);       
    }  
       
     this[eventName + "Handler"] = handler;  
};

RadRotator.prototype.FunctionFromVariable = function(variable)  
{  
     var handler = function(sender, args) {};  
     if (typeof(variable).toString().toLowerCase() == "function")  
     {  
          handler = variable;  
     }  
     else if (typeof(variable).toString().toLowerCase() == "string")  
     {  
          try   
          {  
               handler = eval(variable)  
          }  
          catch(error)  
          {}  
     }  
       
     return handler;  
}

RadRotator.prototype.FireOnClientFrameChanging = function(sender)  
{
	if (this.OnClientFrameChangingHandler != null)  
    {  
		var handler = this.OnClientFrameChangingHandler;  
		return handler(this, {});  
	}  
} 

RadRotator.prototype.FireOnClientFrameChanged = function(sender)  
{
	this.FireTickers();
	var instance = this;
	if(this.RotatorMode.toLowerCase() == "scroll")
	{
		window.clearTimeout(this.scroll_timeout);
		this.scroll_timeout = 0;
		this.scroll_timeout = window.setTimeout(function() {instance.StartScroll()}, this.FrameTimeout);
	}
	if(this.RotatorMode.toLowerCase() == "slideshow")
	{	
		window.clearTimeout(this.show_timeout);
		this.show_timeout = 0;
		this.show_timeout = window.setTimeout(function() {instance.StartSlideShow()}, this.FrameTimeout);
	}
	if (this.OnClientFrameChangedHandler != null)  
    {  
		var handler = this.OnClientFrameChangedHandler;  
		return handler(this, {});  
	}  
}  

RadRotator.prototype.Random = function(max)
{
	return parseInt(((max * Math.random()) % max));
};

RadRotator.prototype.PauseToggle = function(state)
{
	if(state)
	{
		this.Paused = true;
	}
	else
	{
		this.Paused = false;
	}
};

//duplicated in RadTicker.js
RadRotator.prototype.AttachEvent = function(element, eventName, eventHandler)
{
	try
	{
		if (element.attachEvent)
		{
			  element.attachEvent("on" + eventName, eventHandler);
		}
		else
		{
			  element.addEventListener(eventName, eventHandler, true);
		}
	}
	catch(error)
	{
		//
	}
};

//duplicated in RadTicker.js
RadRotator.prototype.DetachEvent = function(element, eventName, eventHandler)
{
	if (element == null || eventName == null || eventHandler == null)
		return;
		
	try
	{
		if (element.detachEvent)
		{
			  element.detachEvent("on" + eventName, eventHandler);
		}
		else
		{
			  element.removeEventListener(eventName, eventHandler, true);
		}
	}
	catch(error)
	{
		//
	}
};

RadRotator.prototype.OnMouseEnter = function(e)
{	
	if(!this.AutoAdvance)
	{
		return;
	}

	if(this.PauseOnMouseOver)
	{
		this.PauseToggle(true);
	}
}

RadRotator.prototype.OnMouseLeave = function()
{
	if(!this.AutoAdvance)
	{
		return;
	}
	
	if(this.PauseOnMouseOver)
	{
		this.PauseToggle(false);
	}
};

RadRotator.prototype.OnMouseOver = function()
{		
	if(!this.AutoAdvance)
	{
		return;
	}
	
	if(document.all && !window.opera)
	{
		return;
	}
	
	if(this.PauseOnMouseOver)
	{
		this.PauseToggle(true);
	}
};


RadRotator.prototype.OnMouseOut = function()
{
	if(!this.AutoAdvance)
	{
		return;
	}
	
	if(document.all && !window.opera)
	{
		return;
	}
	
	if(this.PauseOnMouseOver)
	{
		this.PauseToggle(false);
	}
};

RadRotator.prototype.OnMouseClick = function(id)
{
	var postBack = "__doPostBack('" + this.UniqueID + "','" + id + "')";	
	eval(postBack);
	
	return;
};

RadRotator.prototype.StartRotator = function()
{
	this.Frozen = false;
	if(this.stopped == 0)
	{
		return;
	}
	//if(this.FrameChaning)
	//{
	//	return;
	//}
	this.stopped = 0;
	this.AutoAdvance = 1;
	if(this.RotatorMode.toLowerCase() == "scroll")
	{
		this.StartScroll();
	}
	else
	{
		this.StartSlideShow();
	}
};


RadRotator.prototype.StopRotator = function()
{
	if(this.RotatorMode.toLowerCase() == "scroll")
	{
		this.StopScroll();
	}
	else
	{
		this.StopSlideShow();
	}
};

RadRotator.prototype.StopSlideShow = function()
{
	this.stopped = 1;
	this.AutoAdvance = 0;
};

RadRotator.prototype.StopScroll = function()
{
	this.stopped = 1;
	this.AutoAdvance = 0;
};


RadRotator.prototype.Start = function()
{	
	if (this.disposed == true)
		return;
		
	if (this.ControlElement.offsetWidth == 0)
	{
		return;
	}
	
	this.FixHeight();
	this.FireTickers();
	if(this.RotatorMode != null && this.RotatorMode.toLowerCase() == "scroll")
	{
	    this.InitScroll();
		var instance = this;
		window.clearTimeout(this.scroll_timeout);
		this.scroll_timeout = window.setTimeout(function() {instance.StartScroll()}, this.FrameTimeout);
	}
	
	if(this.RotatorMode != null && this.RotatorMode.toLowerCase() == "slideshow")
	{
		var instance = this;
		window.clearTimeout(this.show_timeout);
		if (this.UseRandomSlide)
		{
			instance.StartSlideShow();
		}
		else
		{
			this.show_timeout = window.setTimeout(function() {instance.StartSlideShow()}, this.FrameTimeout);
		}
	}
};

RadRotator.prototype.FireTickers = function()
{
	if (this.disposed == true || !this.ControlElement.parentNode)
		return;
		
	if(this.HasTickers)
	{
		this.ResetTickers();
		var slides = this.FrameIdArray;
		var big_rect = RadRotator.RadGetElementRect(this.ControlElement);
		
		for(var i=0 ; i<this.NumberOfFrames ; i++)
		{
			var _slide = document.getElementById(slides[i]);
			var small_rect = RadRotator.RadGetElementRect(_slide);
			//debugger;
            //Fixed a bug with ticker - when the document is not loaded we can't get the rectangle of the frame and start the first ticker!
			if(big_rect.Intersects(small_rect) || ((null != document.readyState && "complete" != document.readyState)))
			{
				eval(this[_slide.id+"_s"]);
			}
		}
	}
};

RadRotator.prototype.ResetTickers = function()
{
	if(this.HasTickers)
	{
		for(var i=0 ; i<this.NumberOfTickers ; i++)
		{
			eval(this.TickerIdArray[i]).ResetTicker();
		}
	}
};

RadRotator.prototype.Freeze = function()
{
	this.Frozen = true;
}

RadRotator.prototype.FixHeight = function()
{
	var width;
	var height;
	
	this.ControlElement.style.zoom = "1";
	
	if(parseInt(this.ControlElement.offsetWidth) > 0)
	{
		width = this.ControlElement.offsetWidth;
	}
	else
	{
		width = this.ControlElement.style.width;
	}
	
	if(parseInt(this.ControlElement.offsetHeight) > 0)
	{
		height = this.ControlElement.offsetHeight;
	}
	else
	{
		height = this.ControlElement.style.height;
	}
	
	if(this.RotatorMode.toLowerCase() == "scroll" && (this.ScrollDirection.toLowerCase() == "left" || this.ScrollDirection.toLowerCase() == "right"))
	{
		this.FrameWidth = parseInt(width)/this.FramesToShow;
		this.FrameHeight = parseInt(height);
		this.FrameContainer.style.width = (this.FrameWidth*this.NumberOfFrames)+"px";
	}
	if(this.RotatorMode.toLowerCase() == "scroll" && (this.ScrollDirection.toLowerCase() == "up" || this.ScrollDirection.toLowerCase() == "down"))
	{
		this.FrameWidth = parseInt(width);
		this.FrameHeight = parseInt(height)/this.FramesToShow;
		this.FrameContainer.style.height = (this.FrameHeight*this.NumberOfFrames)+"px";	
	}
	if(this.RotatorMode.toLowerCase() == "slideshow")
	{
		this.FrameWidth = parseInt(width);
		this.FrameHeight = parseInt(height);
	}
	
	var slides = this.FrameIdArray;
	
	for(var i=0 ; i<this.NumberOfFrames ; i++)
	{
		var _slide = document.getElementById(slides[i]);
		_slide.style.height = this.FrameHeight+"px";
		_slide.style.width = this.FrameWidth+"px";
	}
};

RadRotator.prototype.StartSlideShow = function()
{
	if (this.disposed == true)
		return;
		
	if(this.NumberOfFrames/this.FramesToShow <= 1)
	{
		return;
	}	
	if(this.AutoAdvance)
	{
		this.ShowNextFrame();
	}
};

RadRotator.prototype.InitScroll = function()
{
	if(this.ScrollDirection.toLowerCase() == 'down')
	{
		this.FrameContainer.style.top = (this.NumberOfFrames-this.FramesToShow)*this.FrameHeight*(-1)+"px";
	}
	if(this.ScrollDirection.toLowerCase() == 'right')
	{
		this.FrameContainer.style.left = (this.NumberOfFrames-this.FramesToShow)*this.FrameWidth*(-1)+"px";
	}
	this.FireTickers();
}

RadRotator.prototype.StartScroll = function()
{
	if (this.disposed == true)
		return;
		
	if(this.NumberOfFrames/this.FramesToShow <= 1)
	{
		return;
	}
	if(this.FireOnClientFrameChanging(this) == false)
	{
		return;
	}
	if(this.AutoAdvance)
	{
		this.ScrollShow();
	}
};

RadRotator.prototype.ScrollShow = function()
{
	switch(this.ScrollDirection.toLowerCase())
	{
		case 'up':
		{
			this.ScrollUpNextFrame();
			break;
		}
		case 'down':
		{
			this.ScrollDownNextFrame();
			break;
		}
		case 'left':
		{
			this.ScrollLeftNextFrame();
			break;
		}
		case 'right':
		{
			this.ScrollRightNextFrame();
			break;
		}
	}
};

RadRotator.prototype.ShowPrevFrame = function()
{
	if(this.RotatorMode.toLowerCase() != "slideshow")
	{
		alert("Do not call this function when rotator is in scrolling mode!");
		return;
	}
	this.CurrentFrame = (this.CurrentFrame-2) % this.NumberOfFrames;
	if(this.CurrentFrame < -1)
	{
		this.CurrentFrame = this.NumberOfFrames - 2;	
	}
	this.ShowNextFrame();
};

RadRotator.prototype.ShowNextFrame = function()
{
	if (this.disposed == true)
		return;
		
	if(this.RotatorMode.toLowerCase() != "slideshow")
	{
		alert("Do not call this function when rotator is in scrolling mode!");
		return;
	}
	if(this.Paused)
	{
		var instance = this;
		window.clearTimeout(this.show_timeout);
		this.show_timeout = 0;
		this.show_timeout = window.setTimeout(function() {instance.ShowNextFrame()}, this.FrameTimeout);
		return;
	}
	
	if(this.FireOnClientFrameChanging(this) == false)
	{
		return;
	}
	
	var Height;
	if(this.UseRandomSlide)
	{
		do
		{
			Height = this.Random(this.NumberOfFrames)*this.FrameHeight*(-1);
		}
		while(Height == parseInt(this.FrameContainer.style.top))
	}
	else
	{
		this.CurrentFrame = (this.CurrentFrame+1) % this.NumberOfFrames;
		Height = this.CurrentFrame * this.FrameHeight * (-1);		
	}

	if(this.UseTransition && document.all && !window.opera)
	{
		try
		{
			if(this.UseRandomEffect)
			{
				this.ControlElement.style.filter = this.TransitionStrings[this.Random(17)];
			}
			else
			{
				this.ControlElement.style.filter = this.TransitionString;
			}
			this.ControlElement.filters[0].Apply();
			
			this.ControlElement.filters[0].Play();
		}
		catch(e)
		{
		}
	}
	
	this.FrameContainer.style.top = Height + "px";
	this.FireOnClientFrameChanged();
};

RadRotator.prototype.ScrollLeftNextFrame = function()
{	
	if (this.disposed == true)
		return;
		
	if(this.RotatorMode.toLowerCase() != "scroll")
	{
		alert("Do not call this function when rotator is in slideshow mode!");
		return;
	}
	if(this.ScrollDirection.toLowerCase() == "up" || this.ScrollDirection.toLowerCase() == "down")
	{
		alert("Do not call this function when rotator is in vertical scrolling mode!");
		return;
	}
	if(this.Frozen)
	{
		return;
	}
	if(this.Paused)
	{
		var instance = this;
		this.frame_timeout = 0;
		this.frame_timeout = window.setTimeout(function() {instance.ScrollLeftNextFrame()}, this.ScrollSpeed)
		return;
	}
	
	if(parseInt(this.FrameContainer.style.left) > this.FrameWidth*(-1))
	{
		this.FrameChaning = true;
		if(!this.UseSmoothScroll)
		{
			this.FrameContainer.style.left = (parseInt(this.FrameContainer.style.left) - 1) + "px";
		}
		else
		{
			var step = (this.FrameWidth*(-1) - parseInt(this.FrameContainer.style.left)) / this.SmoothScrollDelay;	
			this.FrameContainer.style.left = (parseInt(this.FrameContainer.style.left) + step - 1) + "px";
		}
		var instance = this;
		this.frame_timeout = 0;
		this.frame_timeout = window.setTimeout(function() {instance.ScrollLeftNextFrame()}, this.ScrollSpeed);
	}
	else
	{	
		var dummyNode = this.FrameContainer.firstChild.firstChild.firstChild;
		this.FrameContainer.firstChild.firstChild.removeChild(this.FrameContainer.firstChild.firstChild.firstChild);
		this.FrameContainer.firstChild.firstChild.appendChild(dummyNode);
		this.FrameContainer.style.left = "0px";
		this.CurrentFrame = (this.CurrentFrame+1) % this.NumberOfFrames;
		this.FireOnClientFrameChanged();
		this.FrameChaning = false;
	}
};

RadRotator.prototype.ScrollRightNextFrame = function()
{
	if (this.disposed == true)
		return;
		
	if(this.RotatorMode.toLowerCase() != "scroll")
	{
		alert("Do not call this function when rotator is in slideshow mode!");
		return;
	}
	if(this.ScrollDirection.toLowerCase() == "up" || this.ScrollDirection.toLowerCase() == "down")
	{
		alert("Do not call this function when rotator is in vertical scrolling mode!");
		return;
	}
	if(this.Frozen)
	{
		return;
	}
	if(this.Paused)
	{
		var instance = this;
		this.frame_timeout = 0;
		this.frame_timeout = window.setTimeout(function() {instance.ScrollRightNextFrame()}, this.ScrollSpeed)
		return;
	}
		
	if(parseInt(this.FrameContainer.style.left) < this.FrameWidth*(this.NumberOfFrames-this.FramesToShow-1)*(-1))
	{
		this.FrameChaning = true;	
		if(!this.UseSmoothScroll)
		{
			this.FrameContainer.style.left = parseInt(this.FrameContainer.style.left) + 1 + "px";
		}
		else
		{
			var step = (((this.NumberOfFrames-this.FramesToShow)*this.FrameWidth*(-1)+this.FrameWidth) - parseInt(this.FrameContainer.style.left)) / this.SmoothScrollDelay;
			this.FrameContainer.style.left = parseInt(this.FrameContainer.style.left) + step + "px";	
		}
		var instance = this;
		this.frame_timeout = 0;
		this.frame_timeout = window.setTimeout(function() {instance.ScrollRightNextFrame()}, this.ScrollSpeed);
	}
	else
	{	
		var dummyNode = this.FrameContainer.firstChild.firstChild.lastChild;
		this.FrameContainer.firstChild.firstChild.removeChild(this.FrameContainer.firstChild.firstChild.lastChild);
		this.FrameContainer.firstChild.firstChild.insertBefore(dummyNode,this.FrameContainer.firstChild.firstChild.firstChild);
		this.FrameContainer.style.left = (this.NumberOfFrames-this.FramesToShow)*this.FrameWidth*(-1) + "px";
		this.CurrentFrame = (this.CurrentFrame+1) % this.NumberOfFrames;
		this.FireOnClientFrameChanged();
		this.FrameChaning = false;
	}
};

RadRotator.prototype.ScrollDownNextFrame = function()
{
	if (this.disposed == true)
		return;
		
	if(this.RotatorMode.toLowerCase() != "scroll")
	{
		alert("Do not call this function when rotator is in slideshow mode!");
		return;
	}
	if(this.ScrollDirection.toLowerCase() == "right" || this.ScrollDirection.toLowerCase() == "left")
	{
		alert("Do not call this function when rotator is in horizontal scrolling mode!");
		return;
	}
	if(this.Frozen)
	{
		return;
	}
	if(this.Paused)
	{
		var instance = this;
		this.frame_timeout = 0;
		this.frame_timeout = window.setTimeout(function() {instance.ScrollDownNextFrame()}, this.ScrollSpeed)
		return;
	}
	
	if(parseInt(this.FrameContainer.style.top) < (this.NumberOfFrames-this.FramesToShow)*this.FrameHeight*(-1)+this.FrameHeight)
	{
		this.FrameChaning = true;
		if(!this.UseSmoothScroll)
		{
			this.FrameContainer.style.top = parseInt(this.FrameContainer.style.top) + 1 + "px";
		}
		else
		{
			var step = (((this.NumberOfFrames-this.FramesToShow)*this.FrameHeight*(-1)+this.FrameHeight) - parseInt(this.FrameContainer.style.top)) / this.SmoothScrollDelay;	
			this.FrameContainer.style.top = parseInt(this.FrameContainer.style.top) + step + "px";	
		}
		var instance = this;
		this.frame_timeout = 0;
		this.frame_timeout = window.setTimeout(function() {instance.ScrollDownNextFrame()}, this.ScrollSpeed);
	}
	else
	{	
		var dummyNode = this.FrameContainer.lastChild;
		this.FrameContainer.removeChild(this.FrameContainer.lastChild);
		this.FrameContainer.insertBefore(dummyNode,this.FrameContainer.firstChild);
		this.FrameContainer.style.top = (this.NumberOfFrames-this.FramesToShow)*this.FrameHeight*(-1)+"px";
		this.CurrentFrame = (this.CurrentFrame+1) % this.NumberOfFrames;
		this.FireOnClientFrameChanged();
		this.FrameChaning = false;
	}
};

RadRotator.prototype.ScrollUpNextFrame = function()
{
	if (this.disposed == true)
		return;
		
	if(this.RotatorMode.toLowerCase() != "scroll")
	{
		alert("Do not call this function when rotator is in slideshow mode!");
		return;
	}
	if(this.ScrollDirection.toLowerCase() == "right" || this.ScrollDirection.toLowerCase() == "left")
	{
		alert("Do not call this function when rotator is in horizontal scrolling mode!");
		return;
	}
	if(this.Frozen)
	{
		return;
	}
	if(this.Paused)
	{
		var instance = this;
		this.frame_timeout = 0;
		this.frame_timeout = window.setTimeout(function() {instance.ScrollUpNextFrame()}, this.ScrollSpeed)
		return;
	}
	
	if(parseInt(this.FrameContainer.style.top) > this.FrameHeight*(-1))
	{
		this.FrameChaning = true;
		if(!this.UseSmoothScroll)
		{
			this.FrameContainer.style.top = (parseInt(this.FrameContainer.style.top) - 1) + "px";
		}
		else
		{
			var step = (this.FrameHeight*(-1) - parseInt(this.FrameContainer.style.top)) / this.SmoothScrollDelay;	
			this.FrameContainer.style.top = (parseInt(this.FrameContainer.style.top) + step - 1) + "px";	
		}
		var instance = this;
		this.frame_timeout = 0;
		this.frame_timeout = window.setTimeout(function() {instance.ScrollUpNextFrame()}, this.ScrollSpeed);
	}
	else
	{	
		try {
		    var dummyNode = this.FrameContainer.firstChild;
		    this.FrameContainer.removeChild(this.FrameContainer.firstChild);
		    this.FrameContainer.appendChild(dummyNode);
		    this.FrameContainer.style.top = "0px";
		    this.CurrentFrame = (this.CurrentFrame+1) % this.NumberOfFrames;
		    this.FireOnClientFrameChanged();
		    this.FrameChaning = false;
		} catch (e) 
		{
		}

	}
};

function Rectangle(left, top, width, height) 
{ 
	this.left = (null != left ? left : 0); 
	this.top = (null != top ? top : 0); 
	this.width = (null != width ? width : 0); 
	this.height = (null != height ? height : 0); 
	  
	this.right = left + width; 
	this.bottom = top + height;
};

Rectangle.prototype.Clone = function() 
{ 
	return new Rectangle(this.left, this.top, this.width, this.height);
};

Rectangle.prototype.PointInRect = function(x, y) 
{ 
	return (this.left <= x && x <= (this.left + this.width) 
	&& this.top <= y && y <= (this.top + this.height));
}; 

Rectangle.prototype.Intersects = function(rect) 
{ 
	if (null == rect)
	{ 
		return false;
	}
  
	if (this == rect)
	{ 
		return true; 
	}
  
	return (rect.left < this.right 
		&& rect.top < this.bottom 
		&& rect.right > this.left 
		&& rect.bottom > this.top);
}; 

Rectangle.prototype.Intersection = function(rect) 
{ 
	if (null == rect) 
	{
		return false;
	}
  
	if (this == rect) 
	{
		return this.Clone();
	}
  
	if (!this.Intersects(rect)) 
	{
		return new Rectangle();
	}
  
	var left = Math.max(this.left, rect.left); 
	var top = Math.max(this.top, rect.top); 
	var right = Math.min(this.right, rect.right); 
	var bottom = Math.min(this.bottom, rect.bottom); 
  
	return new Rectangle(left, right, right - left, bottom - top);
}; 

RadRotator.prototype.ClearTimeouts = function()
{ 
	window.clearTimeout(this.scroll_timeout);
	window.clearTimeout(this.show_timeout);
	window.clearTimeout(this.frame_timeout);
};

RadRotator.RadGetElementRect = function(element) 
{ 
	if (!element) 
	{ 
		element = this;
	} 

	var left = 0; 
	var top = 0; 
	var width = element.offsetWidth; 
	var height = element.offsetHeight; 

	while (element.offsetParent) 
	{ 
		left += element.offsetLeft; 
		top += element.offsetTop; 
		element = element.offsetParent;
	} 
	
	if (element.x) 
	{
		left = element.x;
	}
	if (element.y) 
	{
		top = element.y;
	}
	
	return new Rectangle(left, top, width, height);
};

//BEGIN_ATLAS_NOTIFY
if (typeof(Sys) != "undefined")
{
    if (Sys.Application != null && Sys.Application.notifyScriptLoaded != null)
    {
        Sys.Application.notifyScriptLoaded();
    }
}
//END_ATLAS_NOTIFY