function TNGBannerRotator(objSettings)
{this.strElementId=null;this.eleElement=null;this.strWidth=null;this.strHeight=null;this.intDefaultDisplayTime=4000;this.intTransitionTime=800;this.blnStretch=true;this.blnRandom=false;this.blnRotateSingle=true;this.arrBanners=new Array();this.intCurrentBannerIndex=-1;this.blnInitialized=false;this.objTimeout=null;this.blnRunning=false;this.objOutgoingBanner=null;this.objIncomingBanner=null;this.arrAvailable=new Array();if(objSettings)
{if(objSettings.id!=undefined)
this.strElementId=objSettings.id;if(objSettings.width!=undefined)
this.strWidth=objSettings.width;if(objSettings.height!=undefined)
this.strHeight=objSettings.height;if(objSettings.defaultDisplayTime!=undefined)
this.intDefaultDisplayTime=objSettings.defaultDisplayTime;if(objSettings.stretch!=undefined)
this.blnStretch=objSettings.stretch;if(objSettings.random!=undefined)
this.blnRandom=objSettings.random;if(objSettings.rotateSingle!=undefined)
this.blnRotateSingle=objSettings.rotateSingle;}
this.getElementId=function()
{return this.strElementId;};this.getElement=function()
{if(!this.eleElement)
if(document.getElementById(this.getElementId()))
this.eleElement=document.getElementById(this.getElementId());return this.eleElement;};this.getWidth=function()
{return this.strWidth;};this.setWidth=function(strWidth)
{this.strWidth=strWidth;this.getElement().style.width=this.getWidth();};this.getHeight=function()
{return this.strHeight;};this.setHeight=function(strHeight)
{this.strHeight=strHeight;this.getElement().style.height=this.getHeight();};this.isStretched=function()
{return this.blnStretch;};this.setStretched=function(blnStretch)
{this.blnStretch=blnStretch;};this.isRandom=function()
{return this.blnRandom;};this.setRandom=function(blnRandom)
{this.blnRandom=blnRandom;};this.isRotateSingle=function()
{return this.blnRotateSingle;};this.setRotateSingle=function(blnRotateSingle)
{this.blnRotateSingle=blnRotateSingle;};this.isRunning=function()
{return this.blnRunning;};this.setRunning=function(blnRunning)
{this.blnRunning=blnRunning;};this.addBanner=function(objBannerSettings)
{if(objBannerSettings)
{if(objBannerSettings.id!=undefined)
if(jQuery("#"+objBannerSettings.id).size())
{objBannerSettings.element=jQuery("#"+objBannerSettings.id);objBannerSettings.element.remove();if(objBannerSettings.element.css("display")=="none")
objBannerSettings.element.css("display","block");}
objBannerSettings.id=this.strElementId+"-banner-"+this.arrBanners.length;if(!objBannerSettings.displayTime)
objBannerSettings.displayTime=this.intDefaultDisplayTime;this.arrBanners.push(new TNGBanner(objBannerSettings));}};this.initialize=function()
{if(!this.blnInitialized)
{if(this.getElement())
{if(this.arrBanners.length>0)
{if(jQuery)
{this.getElement().style.position="relative";this.getElement().style.overflow="hidden";if(this.getWidth())
this.getElement().style.width=this.getWidth();if(this.getHeight())
this.getElement().style.height=this.getHeight();this.blnInitialized=true;}}}}
return this.blnInitialized;};this.start=function()
{if(this.initialize()&&!this.isRunning())
{this.setRunning(true);this.next();}};this.next=function()
{if(this.isRandom())
{var intLastBannerIndex=this.intCurrentBannerIndex;var blnNewRotation=(this.arrAvailable==undefined||this.arrAvailable.length==0);if(blnNewRotation)
for(var i=0;i<this.arrBanners.length;i++)
if(i!=this.intCurrentBannerIndex)
this.arrAvailable.push(i);if(this.arrAvailable.length>0)
{var intAvailableIndex=Math.floor(Math.random()*this.arrAvailable.length);this.intCurrentBannerIndex=this.arrAvailable[intAvailableIndex];this.arrAvailable.splice(intAvailableIndex,1);if(blnNewRotation&&intLastBannerIndex!=-1)
this.arrAvailable.push(intLastBannerIndex);}}
else
{this.intCurrentBannerIndex++;if(!this.arrBanners[this.intCurrentBannerIndex])
this.intCurrentBannerIndex=0;}
this.objOutgoingBanner=this.objIncomingBanner;this.objIncomingBanner=this.arrBanners[this.intCurrentBannerIndex];var setBannerDimensions=function(objEvent)
{var objRotator=objEvent.data.objRotator;if(objRotator.isStretched())
{jQuery(this).css("width",jQuery(objRotator.getElement()).css("width"));jQuery(this).css("height",jQuery(objRotator.getElement()).css("height"));}
else
{if(this.width)
jQuery(this).css("width",this.width);if(this.height)
jQuery(this).css("height",this.height);}};var insertBanner=function(objEvent)
{var blnRotate=true;var objRotator=objEvent.data.objRotator;var eleBanner=objEvent.data.eleBanner;if(objRotator.objOutgoingBanner)
{var strOutgoingBannerElementId=objRotator.objOutgoingBanner.getElementId();if(objRotator.objIncomingBanner==objRotator.objOutgoingBanner)
{if(objRotator.isRotateSingle())
{strOutgoingBannerElementId=objRotator.objOutgoingBanner.getElementId()+"-outgoing";jQuery("#"+objRotator.objOutgoingBanner.getElementId()).attr("id",strOutgoingBannerElementId);}
else
blnRotate=false;}}
if(blnRotate)
{if(jQuery("#"+objRotator.objIncomingBanner.getElementId()).size())
jQuery("#"+objRotator.objIncomingBanner.getElementId()).remove();jQuery("#"+objRotator.getElementId()).prepend(eleBanner);if(objRotator.objOutgoingBanner)
jQuery("#"+strOutgoingBannerElementId).fadeOut(objRotator.intTransitionTime,function(){jQuery(this).remove();});}};var eleBanner=document.createElement("div");eleBanner.id=this.objIncomingBanner.getElementId();eleBanner.style.position="absolute";if(this.objIncomingBanner.getUrl().length>0)
{var eleA=document.createElement("a");jQuery(eleA).attr("href",this.objIncomingBanner.getUrl());if(this.objIncomingBanner.isNewWindow())
jQuery(eleA).attr("target","_blank");jQuery(eleA).css("margin","0px");jQuery(eleA).css("padding","0px");jQuery(eleA).css("border-width","0px");}
switch(this.objIncomingBanner.getType())
{case(TNGBannerRotator.TYPE_FLASH):var strHtml="<object id=\""+this.objIncomingBanner.getElementId()+"-flash\" width=\""+jQuery(this.getElement()).css("width")+"\" height=\""+jQuery(this.getElement()).css("height")+"\" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.adobe.com/pub/shockwave/cabs/flash/\">"+
"<param name=\"movie\" value=\""+this.objIncomingBanner.getSrc()+"\" />"+
"<param name=\"wmode\" value=\"transparent\" />"+
"<param name=\"play\" value=\"true\" />"+
"<param name=\"loop\" value=\"true\" />"+
"<param name=\"quality\" value=\"high\" />"+
(this.isStretched()?"<param name=\"scale\" value=\"exactfit\" />":"")+
"<embed "+
" name=\""+this.objIncomingBanner.getElementId()+"-flash\""+
" width=\""+jQuery(this.getElement()).css("width")+"\" height=\""+jQuery(this.getElement()).css("height")+"\""+
" src=\""+this.objIncomingBanner.getSrc()+"\""+
" type=\"application/x-shockwave-flash\""+
" pluginspage=\"http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\""+
" wmode=\"transparent\""+
" play=\"true\""+
" loop=\"true\""+
" quality=\"high\""+
(this.isStretched()?" scale=\"exactfit\"":"")+
" />"+
"</object>";jQuery(eleBanner).html(strHtml);if(eleA!=undefined)
{jQuery(eleA).css("width",jQuery(this.getElement()).css("width"));jQuery(eleA).css("height",jQuery(this.getElement()).css("height"));jQuery(eleA).css("position","absolute");jQuery(eleBanner).prepend(eleA);}
var objEvent=new Object();objEvent.data=new Object();objEvent.data.objRotator=this;objEvent.data.eleBanner=eleBanner;jQuery(eleBanner).bind("load",{objRotator:this},setBannerDimensions);insertBanner.call(eleBanner,objEvent);break;case(TNGBannerRotator.TYPE_HTML):jQuery(eleBanner).append(this.objIncomingBanner.getElement());var objEvent=new Object();objEvent.data=new Object();objEvent.data.objRotator=this;objEvent.data.eleBanner=eleBanner;insertBanner.call(eleBanner,objEvent);break;case(TNGBannerRotator.TYPE_ANIMATED_GIF):var eleImage=document.createElement("img");jQuery(eleImage).attr("alt","");jQuery(eleImage).css("margin","0px");jQuery(eleImage).css("padding","0px");jQuery(eleImage).css("border-width","0px");if(eleA!=undefined)
{jQuery(eleA).append(eleImage);jQuery(eleBanner).append(eleA);}
else
{jQuery(eleBanner).append(eleImage);}
jQuery(eleImage).bind("load",{objRotator:this,eleBanner:eleBanner},setBannerDimensions);jQuery(eleImage).bind("load",{objRotator:this,eleBanner:eleBanner},insertBanner);var strConnector="?";if(eleImage.src.indexOf("?")!=-1)
strConnector="&";eleImage.src=this.objIncomingBanner.getSrc()+strConnector+"TNGBannerRotator="+Math.round(Math.random()*1000000);break;default:var eleImage=document.createElement("img");jQuery(eleImage).attr("alt","");jQuery(eleImage).css("margin","0px");jQuery(eleImage).css("padding","0px");jQuery(eleImage).css("border-width","0px");if(eleA!=undefined)
{jQuery(eleA).append(eleImage);jQuery(eleBanner).append(eleA);}
else
{jQuery(eleBanner).append(eleImage);}
jQuery(eleImage).bind("load",{objRotator:this,eleBanner:eleBanner},setBannerDimensions);jQuery(eleImage).bind("load",{objRotator:this,eleBanner:eleBanner},insertBanner);eleImage.src=this.objIncomingBanner.getSrc();break;}
var objRotator=this;this.objTimeout=window.setTimeout(function(){objRotator.next()},this.objIncomingBanner.getDisplayTime());return eleBanner;}
this.stop=function()
{this.setRunning(false);window.clearTimeout(this.objTimeout);};}
TNGBannerRotator.TYPE_IMAGE=1;TNGBannerRotator.TYPE_ANIMATED_GIF=2;TNGBannerRotator.TYPE_FLASH=3;TNGBannerRotator.TYPE_HTML=4;function TNGBanner(objSettings)
{this.strElementId=null;this.strSrc="";this.objElement=null;this.intType=TNGBannerRotator.TYPE_IMAGE;this.intDisplayTime=null;this.strUrl="";this.blnNewWindow=true;if(objSettings)
{if(objSettings.id!=undefined)
this.strElementId=objSettings.id;if(objSettings.src!=undefined)
this.strSrc=objSettings.src;if(objSettings.element!=undefined)
this.objElement=objSettings.element;if(objSettings.displayTime!=undefined)
this.intDisplayTime=objSettings.displayTime;if(objSettings.type!=undefined)
this.intType=objSettings.type;if(objSettings.url!=undefined)
this.strUrl=objSettings.url;if(objSettings.newWindow!=undefined)
this.blnNewWindow=objSettings.newWindow;}
this.getElementId=function()
{return this.strElementId;};this.setElementId=function(strElementId)
{this.strElementId=strElementId;};this.getSrc=function()
{return this.strSrc;};this.setSrc=function(strSrc)
{this.strSrc=strSrc;};this.getElement=function()
{return this.objElement;};this.setElement=function(objElement)
{this.objElement=objElement;};this.getType=function()
{return this.intType;};this.setType=function(intType)
{this.intType=intType;};this.getDisplayTime=function()
{return this.intDisplayTime;};this.setDisplayTime=function(intDisplayTime)
{this.intDisplayTime=intDisplayTime;};this.getUrl=function()
{return this.strUrl;};this.setUrl=function(strUrl)
{this.strUrl=strUrl;};this.isNewWindow=function()
{return this.blnNewWindow;};this.setNewWindow=function(blnNewWindow)
{this.blnNewWindow=blnNewWindow;};}
