var hex=new Array("00","14","28","3C","50","64","78","8C","A0","B4","C8","DC","F0")
var r=1;
var g=1;
var b=1;
var seq=1;
var storetext = "";

var message="";
var neonbasecolor="#000000";
var neontextcolor="#FF0000";
var neontextcolor2="YELLOW";
var flashspeed=150;						// speed of flashing in milliseconds
var flashingletters=4;						// number of letters flashing in neontextcolor
var flashingletters2=2;						// number of letters flashing in neontextcolor2 (0 to disable)
var flashpause=4;						// the pause between flash-cycles in milliseconds
var n=0;

var hash = new Array();

function blinkIt() {
 if (!document.all) return;
 else {
   for(i=0;i<document.all.tags('blink').length;i++){
      s=document.all.tags('blink')[i];
      s.style.visibility=(s.style.visibility=='visible')?'hidden':'visible';
   }
 }
}

/*********** RAINBOW TEXT STARTS HERE ****************************/
function rainbowcolor(intext,inSpeed){
	var text=intext // YOUR TEXT
	var speed=inSpeed // SPEED OF FADE

	if (document.all||document.getElementById){
		document.write('<span id="highlight" class="texteffect" align="center">' + text + '</span>')
		storetext=document.getElementById? document.getElementById("highlight") : document.all.highlight
	}
	else{
		document.write(text)
	}

	starteffect(inSpeed);	
}
	

function changetext(){
	rainbow="#"+hex[r]+hex[g]+hex[b]
	storetext.style.color=rainbow
}

function change(){
	if (seq==6){
		b--
		if (b==0)
			seq=1
	}

	if (seq==5){
		r++
		if (r==12)
			seq=6
	}

	if (seq==4){
		g--
		if (g==0)
			seq=5
	}

	if (seq==3){
		b++
		if (b==12)
			seq=4
	}

	if (seq==2){
		r--
		if (r==0)
		seq=3
	}

	if (seq==1){
		g++
		if (g==12)
			seq=2
	}

changetext()
}
/*********** RAINBOW TEXT ENDS HERE ****************************/

/*********** NEON TEXT STARTS HERE ****************************/
function startNeon(strInMessage){
	message = strInMessage;		
	if (document.all||document.getElementById){
		document.write('<font color="'+neonbasecolor+'" class="blackbig">')
		for (m=0;m<message.length;m++)
			document.write('<span id="neonlight'+m+'">'+message.charAt(m)+'</span>')
			document.write('</font>')
	}
	else{
		document.write(message)
	}
	beginneon();	
}

function starteffect(inspeed){
	if (document.all||document.getElementById)
	flash=setInterval("change()",inspeed)
}

function crossref(number){
var crossobj=document.all? eval("document.all.neonlight"+number) : document.getElementById("neonlight"+number)
return crossobj
}

function neon(){

//Change all letters to base color
if (n==0){
for (m=0;m<message.length;m++)
crossref(m).style.color=neonbasecolor
}

//cycle through and change individual letters to neon color
crossref(n).style.color=neontextcolor

if (n>flashingletters-1) crossref(n-flashingletters).style.color=neontextcolor2 
if (n>(flashingletters+flashingletters2)-1) crossref(n-flashingletters-flashingletters2).style.color=neonbasecolor


if (n<message.length-1)
n++
else{
n=0
clearInterval(flashing)
setTimeout("beginneon()",flashpause)
return
}
}

function beginneon(){
if (document.all||document.getElementById)
flashing=setInterval("neon()",flashspeed)
}
/*********** NEON TEXT ENDS ****************************/

/*********** FADE TEXT STARTS HERE ****************************/
function fadeObject(id, c1, c2, s1, s2) {
  var self = this;
  this.id      = id;
  this.elem    = false;
  this.colour  = {
    stt: [parseInt(c1.substr(0, 2), 16), parseInt(c1.substr(2, 2), 16), parseInt(c1.substr(4, 2), 16)],
    end: [parseInt(c2.substr(0, 2), 16), parseInt(c2.substr(2, 2), 16), parseInt(c2.substr(4, 2), 16)],
    now: [parseInt(c1.substr(0, 2), 16), parseInt(c1.substr(2, 2), 16), parseInt(c1.substr(4, 2), 16)]
  };
  this.steps   = [s1, s2];
  this.dir     = false;
  this.active  = false;
  this.queue   = [];
  this.msg     = [];
  this.message = 0;
  function d2h(num) {
    num = Math.round(num);
    return ((num < 16) ? "0" : "") + num.toString(16);
  }
  this.fade = function(message, direction) {
    this.elem = this.elem || document.getElementById(this.id);
    this.queue.push([message, direction]);
    for (var x = 0; x < this.queue.length; x++) {
      for (var y = x + 1; y < this.queue.length; y++) {
        if (this.queue[x][0] == this.queue[y][0] && this.queue[x][1] != this.queue[y][1]) {
          this.queue.splice(x, 1);
          this.queue.splice(y - 1, 1);
        }
      }
    }
    if (!this.active) setTimeout(function() { self.fadeLoop(); }, 10);
  };
  this.fadeLoop = function() {
    if (!this.active && this.queue.length) {
      if (this.dir && this.message != this.queue[0][0]) this.queue.unshift([this.message, false]);
      var msg = this.queue.shift();
      if (this.msg[msg[0]]) {
        this.active = true;
        this.elem.innerHTML = this.msg[this.message = msg[0]];
        this.dir = msg[1];
      }
    }
    if (this.dir) {
      var c1 = this.colour.stt, c2 = this.colour.end, s = this.steps[0];
    } else var c1 = this.colour.end, c2 = this.colour.stt, s = this.steps[1];
    for (var x = 0, cnow = "", inc = 0; x < 3; x++) {
      this.colour.now[x] += inc = (c2[x] - c1[x]) / s;
      cnow += this.colour.now[x] = (inc < 0) ? Math.max(this.colour.now[x], c2[x]) : Math.min(this.colour.now[x], c2[x]);
    } this.elem.style.color = "#" + d2h(this.colour.now[0]) + d2h(this.colour.now[1]) + d2h(this.colour.now[2]);
    if (cnow == c2.join("")) {
      this.active = false;
      if (!this.queue.length) {
        if (!this.dir) {
          if (this.msg[0]) {
            this.queue.push([0, true]);
            setTimeout(function() { self.fadeLoop(); }, 10);
          } else this.elem.innerHTML = "&nbsp;";
        }
      } else setTimeout(function() { self.fadeLoop(); }, 10);
    } else setTimeout(function() { self.fadeLoop(); }, 10);
  };
  if (window.addEventListener) {
    window.addEventListener('load', function() { self.fade(0, true); }, false); 
  } else if (window.attachEvent)
    window.attachEvent('onload', function() { self.fade(0, true); });
}

function throb(item) {

  // If the hash array does not have an entry for this item, initialise it at 2
  if (!hash[item]) hash[item] = 2;

  // Send a fade command, using the hash array to tell us what parameters we should use
  fader[item].fade(Math.floor(hash[item] / 2), !(hash[item] % 2));

  // Call this function again for this same item after a certain amount of time
  setTimeout(function() { throb(item); }, (hash[item] % 2) ? 100 : 5000);

  // If we have exceeded the number of messages in this fader, start over again at 2
  if (++hash[item] > fader[item].msg.length * 2 - 1) hash[item] = 2;
}

/*********** FADE TEXT ENDS HERE ****************************/
function openOfferWin(inId){	window.open('http://www.shibumilife.com/offers.php?offerid=' + inId,'offer','width=500,height=400,left=0,top=100,screenX=0,screenY=100,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes')}