/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Timothy Groves | http://www.brandspankingnew.net/ */
var useBSNnsDescrip;

if (useBSNnsDescrip) {
	 if (typeof(bsnDescrip) == "undefined")
		  bsnDescrip = {}
	   var _bsnDescrip = bsnDescrip;
} else {
	  var _bsnDescrip = this;
}

_bsnDescrip.CrossfaderDescrip = function (divsDescrip, fadetimeDescrip, delayDescrip ) {	
//


	 //this.nActDescrip = -1;
	 this.aDivsDescrip = divsDescrip;
	
	 for (var i=0;i<divsDescrip.length;i++) {
	   document.getElementById(divsDescrip[i]).style.opacity = 0;
   	document.getElementById(divsDescrip[i]).style.position = "absolute";
	   document.getElementById(divsDescrip[i]).style.filter = "alpha(opacity=0)";
 	  document.getElementById(divsDescrip[i]).style.visibility = "hidden";
	 }
	
	this.nDurDescrip = fadetimeDescrip;
	this.nDelayDescrip = delayDescrip;
	this._newfadeDescrip();
}


_bsnDescrip.CrossfaderDescrip.prototype._newfadeDescrip = function() {
  if (this.nID1Descrip)
    clearInterval(this.nID1Descrip);
	   this.nOldActDescrip = this.nActDescrip;
    this.nActDescrip++;

 	if (!this.aDivsDescrip[this.nActDescrip])	this.nActDescrip = 0;

 	if (this.nActDescrip == this.nOldActDescrip)
    return false;

  document.getElementById( this.aDivsDescrip[this.nActDescrip] ).style.visibility = "visible";
  this.nIntDescrip = 50;
  this.nTimeDescrip = 0;
  var pDescrip=this;
  this.nID2Descrip = setInterval(function() { pDescrip._fadeDescrip() }, this.nIntDescrip);
}

_bsnDescrip.CrossfaderDescrip.prototype._fadeDescrip = function(myNewArg) {	

	
  this.nTimeDescrip += this.nIntDescrip;
 	var ieopDescrip = Math.round( this._easeInOutDescrip(this.nTimeDescrip, 0, 1, this.nDurDescrip) * 100 );
 	var op = ieopDescrip / 100;
	
 	document.getElementById( this.aDivsDescrip[this.nActDescrip] ).style.opacity = op;
 	document.getElementById( this.aDivsDescrip[this.nActDescrip] ).style.filter = "alpha(opacity="+ieopDescrip+")";

  if (this.nOldActDescrip > -1) {
    document.getElementById( this.aDivsDescrip[this.nOldActDescrip] ).style.opacity = 1 - op;
  		document.getElementById( this.aDivsDescrip[this.nOldActDescrip] ).style.filter = "alpha(opacity="+(100 - ieopDescrip)+")";
	 }
	
	 if (this.nTimeDescrip == this.nDurDescrip) {
		 clearInterval( this.nID2Descrip );
		
  if (this.nOldActDescrip > -1)
	   document.getElementById( this.aDivsDescrip[this.nOldActDescrip] ).style.visibility = "hidden";	
    var pDescrip=this;
    this.nID1Descrip = setInterval(function() { pDescrip._newfadeDescrip() }, this.nDelayDescrip);
  }
}

_bsnDescrip.CrossfaderDescrip.prototype._easeInOutDescrip = function(tDescrip,bDescrip,cDescrip,dDescrip) {
  return cDescrip/2 * (1 - Math.cos(Math.PI*tDescrip/dDescrip)) + bDescrip;
}


function callCrossFaderDescrip(myFadeID){
	
	//alert(varState);
	//varState is set in fine-jewelry.php and is to keep track of the fade transition
	
//	 var cf = new CrossfaderDescrip( new Array('toggleTextItemDescription'), 500, 2000 );
	

}

