
/*Example message arrays for the two demo scrollers*/

var tickercontent=new Array()
tickercontent[0]='The best time to increase your wealth was 10 years ago; the next best time is right now!'
tickercontent[1]='Contact us for a FREE Professional Consultation at <a href="mailto:Info@DifferWorld.com">Info@DifferWorld.com</a> or (65) 6338 5669 or (61) 39018 6790 now!'


/***********************************************
* DHTML Ticker script- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

function domticker(content, divId, divClass, delay, fadeornot){
    this.content  = content;
	//ID of master ticker div. Message is contained inside first child of ticker div
    this.tickerid = divId; 
	//Delay between msg change, in miliseconds.
    this.delay = delay; 
	//Boolean to indicate whether mouse is currently over 
	//ticker (and pause it if it is)
    this.mouseoverBol = 0; 
    this.pointer = 1;
    this.opacitystring = (typeof fadeornot!="undefined")? "width: 100%; filter:progid:DXImageTransform.Microsoft.alpha(opacity=100); -moz-opacity: 1" : "";
    
	//add 1/2 sec to account for fade effect, if enabled
	if (this.opacitystring!="") this.delay += 500;
    
	//Opacity value when reset. Internal use.
	this.opacitysetting = 0.1 ;
    
	document.write('<div id="'+divId+'" class="'+divClass+'"><div style="'+this.opacitystring+'">'+content[0]+'</div></div>');
    var instanceOfTicker = this;
    setTimeout (function() {instanceOfTicker.initialize()}, delay)
}

domticker.prototype.initialize = function(){
    var instanceOfTicker=this;
	
	//div of inner content that holds the messages
    this.contentdiv=document.getElementById(this.tickerid).firstChild 
    
	document.getElementById(this.tickerid).onmouseover=function(){instanceOfTicker.mouseoverBol=1};
    
	document.getElementById(this.tickerid).onmouseout=function(){instanceOfTicker.mouseoverBol=0};
    
	this.rotatemsg();
}

domticker.prototype.rotatemsg = function(){
    var instanceOfTicker=this;
	
    //if mouse is currently over ticker, do nothing (pause it)
	if (this.mouseoverBol==1) 
       setTimeout(function(){instanceOfTicker.rotatemsg()}, 100);
    else {
       //FADE EFFECT- RESET OPACITY
	   this.fadetransition("reset"); 
       this.contentdiv.innerHTML = this.content[this.pointer];
	   
       //FADE EFFECT- PLAY IT
	   this.fadetimer1 = setInterval(function(){instanceOfTicker.fadetransition('up', 'fadetimer1')}, 100);
       this.pointer = (this.pointer<this.content.length-1) ? this.pointer+1 : 0;
       setTimeout(function(){instanceOfTicker.rotatemsg()}, this.delay); //update container
     }
}

// -------------------------------------------------------------------
// fadetransition()- cross browser fade method for IE5.5+ and Mozilla/Firefox
// -------------------------------------------------------------------

domticker.prototype.fadetransition=function(fadetype, timerid){
      var contentdiv = this.contentdiv;
      if (fadetype=="reset") 
	     this.opacitysetting = 0.1;
		 
      if (contentdiv.filters && contentdiv.filters[0]){
         
		 if (typeof contentdiv.filters[0].opacity=="number") //IE6+
            contentdiv.filters[0].opacity=this.opacitysetting*100;
         else //IE 5.5
            contentdiv.style.filter = "alpha(opacity="+this.opacitysetting*100+")";
         }
         else if (typeof contentdiv.style.MozOpacity!="undefined" && this.opacitystring!=""){
            contentdiv.style.MozOpacity = this.opacitysetting;
}
else
     this.opacitysetting = 1;

 if (fadetype=="up")
    this.opacitysetting += 0.1;

if (fadetype=="up" && this.opacitysetting >= 1)
    clearInterval(this[timerid]);
}
