/* Script for Banner Rotator by Banner Designer Pro - put in <BODY> section of HTML */
function fnGetFlashMovie(movieName) {var isIE = (navigator.appName.indexOf("Microsoft") != -1);var ret = ((isIE)?window.document.getElementById(movieName):window.document.getElementsByTagName('EMBED')[movieName]);return ((ret) ? ret : document[movieName]);}function movieIsLoaded (theMovie) {  if (typeof(theMovie) != "undefined") {    return theMovie.PercentLoaded() == 100;  } else {    return false;  }}
/* Banner Object --*/
function BannerRotator(myobjName)
{
   this.myobj = myobjName;
   this.BannerArray = [];
   this.presentBanner = null;
};

/* -- Add Banner --*/
BannerRotator.prototype.add = function(BannerLike, BannerAddress, BannerLength, Height, Width, ImageLocation, Tooltip) {
 this.BannerArray[this.BannerArray.length] = new Node(this.myobj +"_"+ this.BannerArray.length, BannerLike, BannerAddress, BannerLength, Height, Width, Tooltip, ImageLocation);
};

/* -- Create Banner --*/
function Node(Name, BannerLike, BannerAddress, BannerLength, Height, Width, Tooltip, ImageLocation) {
	 this.Name = Name;
	 this.BannerLike = BannerLike;
	 this.BannerAddress= BannerAddress;
	 this.BannerLength = BannerLength;
	 this.Height = Height;
	 this.Width = Width;
	 this.Tooltip = Tooltip;
	 this.ImageLocation = ImageLocation;
};
	 function onBannerClickBlank(linkToOpen) {
	 window.open(banner_rotator.BannerArray[linkToOpen].ImageLocation, "_blank");
	 }
	 function onBannerClickSelf(linkToOpen) {
	 	window.open(banner_rotator.BannerArray[linkToOpen].ImageLocation, "_self");
	 }
/* -- Creates the HTML and places it on webpage --*/
BannerRotator.prototype.toString = function() {
	 var str = "";
	 var openType = "_blank" ;
	 for (var iCtr=0; iCtr < this.BannerArray.length; iCtr++){
	   str = str + '<span name="'+this.BannerArray[iCtr].Name+'" ';
	   str = str + 'id="'+this.BannerArray[iCtr].Name+'" ';
	   str = str + 'class="style_bannerhide" ';
	   str = str + 'align="center" ';
	   str = str + 'valign="top" >\n';
	   if (this.BannerArray[iCtr].ImageLocation != ""){
		 str = str + '<a href="'+this.BannerArray[iCtr].ImageLocation+'" ';
		 str = str + 'target="_blank"';
		 str = str + '>';
	  }

	  if ( this.BannerArray[iCtr].BannerLike == "FLASH" ){
			if(this.BannerArray[iCtr].Tooltip == "") {
				if (this.BannerArray[iCtr].ImageLocation != ""){
					if(openType == "_blank") {
       				str = str + '<OBJECT onmousedown="onBannerClickBlank('+iCtr+');"  '; 
					}else{
						str = str + '<OBJECT onmousedown="onBannerClickBlank('+iCtr+');"  '; 
					}
				}else {
					str = str + '<OBJECT ';
				}
			}else{
			if (this.BannerArray[iCtr].ImageLocation != ""){
				if(openType == "_blank") {
       			str = str + '<OBJECT onmousedown="onBannerClickBlank('+iCtr+');" title="'+this.BannerArray[iCtr].Tooltip+'" '; 
				}else{
					str = str + '<OBJECT onmousedown="onBannerClickBlank('+iCtr+');" title="'+this.BannerArray[iCtr].Tooltip+'" '; 
				}
			}else{
				str = str + '<OBJECT  title="'+this.BannerArray[iCtr].Tooltip+'" '; 
			}
			}
		 str = str + 'classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
		 str = str + 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ';
		 str = str + 'HEIGHT="'+this.BannerArray[iCtr].Height+'" ';
		 str = str + 'WIDTH="'+this.BannerArray[iCtr].Width+'"';
        str = str + 'target="_self"';
		 str = str + 'id="bnr_'+this.BannerArray[iCtr].Name+'" ';
		 str = str + 'ALIGN="middle" >';
		 str = str + '<PARAM NAME=movie VALUE="'+ this.BannerArray[iCtr].BannerAddress + '">';
		 str = str + '<PARAM NAME=quality VALUE=high>';
		 str = str + '<PARAM NAME=bgcolor VALUE=#FFFFFF>';
		 if(this.BannerArray[iCtr].Tooltip == "") { 
		 }else{
		 	str = str + '<PARAM NAME=wmode VALUE=transparent>'; 
		 }
       if(this.BannerArray[iCtr].Tooltip == "") {
			str = str + '<EMBED bgcolor="#ffffff" ';
       }else{
			str = str + '<EMBED bgcolor="#ffffff" title="'+this.BannerArray[iCtr].Tooltip+'" wmode="transparent"';
       }
		 str = str + 'src="'+this.BannerArray[iCtr].BannerAddress+'" ';
		 str = str + 'quality=high ';
		 str = str + 'HEIGHT="'+this.BannerArray[iCtr].Height+'" ';
		 str = str + 'WIDTH="'+this.BannerArray[iCtr].Width+'"';
		 str = str + 'NAME="bnr_'+this.BannerArray[iCtr].Name+'" ';
		 str = str + 'ALIGN="center" ';
		 str = str + 'TYPE="application/x-shockwave-flash" ';
		 str = str + 'PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">';
		 str = str + '</EMBED>';
		 str = str + '</OBJECT>';
	  }else if ( this.BannerArray[iCtr].BannerLike == "IMAGE" ){
		 str = str + '<img src="'+this.BannerArray[iCtr].BannerAddress+'" ';
		 str = str + 'border="0" ';
		 str = str + 'height="'+this.BannerArray[iCtr].Height+'" ';
		 str = str + 'width="'+this.BannerArray[iCtr].Width+'"';
		 str = str + 'alt="'+this.BannerArray[iCtr].Tooltip+'">';
	  }

	  if (this.BannerArray[iCtr].hyperlink != ""){
			str = str + '</a>';
	  }
	  str += '</span>';
	  }
	  return str;
};
/* -- Start the Banner Rotator --*/
	var b__1 = null;
BannerRotator.prototype.start = function()
{
	this.changeBanner();
	var BannerObject = this.myobj;
   setTimeout(BannerObject+".start()", this.BannerArray[this.presentBanner].BannerLength  * 1000);
}
/* -- Swap Banners --*/
BannerRotator.prototype.changeBanner = function()
{
	 if (this.presentBanner == null)
	 this.presentBanner= this.presentBanner=Math.round((this.BannerArray.length-1)*Math.random());
	 
	 var previousBanner=this.presentBanner;
	 
	 do{
		this.presentBanner=Math.floor((this.BannerArray.length)*Math.random());
	 }while(this.presentBanner==previousBanner)
	 if (document.getElementById(this.BannerArray[previousBanner].Name).className=='style_bannershow')
	 {
		document.getElementById(this.BannerArray[previousBanner].Name).className = "style_bannerhide";
	 }
	 document.getElementById(this.BannerArray[this.presentBanner].Name).className = "style_bannershow";
	b__1 = fnGetFlashMovie('bnr_'+this.BannerArray[this.presentBanner].Name);
	try{
	if(movieIsLoaded(b__1)){
		b__1.GotoFrame(1);
		b__1.Play();
	}
   }catch(e){
   }
}
