var fader = new Array(), fadeQ = new Array();
var RGB = new Array(256), k = 0, hex = ["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];
for (var i = 0; i < 16; i++) for (var j = 0; j < 16; j++) RGB[k++] = hex[i] + hex[j];

function fadeObj(number, id, colOff, colOn, spdIn, spdOut, def) {
this.number = number;
this.id = id;
this.colOff = [parseInt(colOff.substr(0, 2), 16), parseInt(colOff.substr(2, 2), 16), parseInt(colOff.substr(4, 2), 16)];
this.colOn = [parseInt(colOn.substr(0, 2), 16), parseInt(colOn.substr(2, 2), 16), parseInt(colOn.substr(4, 2), 16)];
this.colNow = [parseInt(colOff.substr(0, 2), 16), parseInt(colOff.substr(2, 2), 16), parseInt(colOff.substr(4, 2), 16)];
this.spdIn = spdIn;
this.spdOut = spdOut;
this.def = def;
this.direction = false;
this.active = false;
this.message = new Array();
this.messageNow = 0;
}

function fadeCmd(number, message, direction) {
this.number = number;
this.message = message;
this.direction = direction;
}

function fade(number, message, direction) {
if (fader[number].def && fader[number].messageNow == 0 && fader[number].direction) {
fadeQ[fadeQ.length] = new fadeCmd(number, 0, false);
fadeQ[fadeQ.length] = new fadeCmd(number, message, direction);
message = 0;
direction = false;
} else fadeQ[fadeQ.length] = new fadeCmd(number, message, direction);
setTimeout("fadeBegin(" + number + ");", 20);
}

function fadeBegin(number) {
for (var x = 0; x < fadeQ.length; x++) {
for (var y = x + 1; y < fadeQ.length; y++) {
  if (fadeQ[x].number == fadeQ[y].number && fadeQ[x].message == fadeQ[y].message && fadeQ[x].direction != fadeQ[y].direction) {
	fadeQ.splice(x, 1);
	fadeQ.splice(y - 1, 1);
  }
}
}
if (!fader[number].active) {
for (var x = 0; x < fadeQ.length; x++) {
  if (fadeQ[x].number == number && fadeQ[x].direction != fader[number].direction) {
	var del = fadeQ.splice(x, 1);
	setTimeout("fadeEng(" + number + ", " + del[0].message + ", " + del[0].direction + ");", 0);
	break;
  }
}
}
}

function fadeEng(number, message, direction) {
if (!fader[number].active) {
fader[number].active = true;
fader[number].direction = direction;
fader[number].messageNow = message;
document.getElementById(fader[number].id).innerHTML = fader[number].message[message];
}
var iniCol = (direction) ? fader[number].colOff : fader[number].colOn;
var endCol = (direction) ? fader[number].colOn : fader[number].colOff;
var incCol = fader[number].colNow;
var spd = (direction) ? fader[number].spdIn : fader[number].spdOut;
for (var x = 0; x < 3; x++) {
var incr = (endCol[x] - iniCol[x]) / spd;
incCol[x] = (incr < 0) ? Math.max(incCol[x] + incr, endCol[x]) : Math.min(incCol[x] + incr, endCol[x]);
}
document.getElementById(fader[number].id).style.color = "#" + RGB[parseInt(incCol[0])] + RGB[parseInt(incCol[1])] + RGB[parseInt(incCol[2])];
if (incCol[0] == endCol[0] && incCol[1] == endCol[1] && incCol[2] == endCol[2]) {
fader[number].active = false;
for (var x = 0; x < fadeQ.length; x++) {
  if (fadeQ[x].number == number) {
	var del = fadeQ.splice(x, 1);
	setTimeout("fadeEng(" + number + ", " + del[0].message + ", " + del[0].direction + ");", 0);
	return false;
  }
}
if (!direction) {
  if (fader[number].def) {
	setTimeout("fadeEng(" + number + ", 0, true);", 0);
  } else document.getElementById(fader[number].id).innerHTML = "&nbsp;";
}
} else setTimeout("fadeEng(" + number + ", " + message + ", " + direction + ");", 0);
}
/* ***** End: GreyWyvern's Buffered Text-fade Effect - v2.2 ******** */


/* ***** User defined fade objects and messages ******************** */


// Flexible Image Slideshow- By JavaScriptKit.com (http://www.javascriptkit.com)
// For this and over 400+ free scripts, visit JavaScript Kit- http://www.javascriptkit.com/
// This notice must stay intact for use

function StringArray (n) {
  this.length = n;
  for (var i =1; i <= n; i++) {
    this[i] = ' '

  }
}

quote = new StringArray(15)
quote[0] = '$7,100,000.00 recovery for a woman who suffered severe brain damage following delivery of her child resulting in a permanent vegetative state' ;
quote[1] = '$4,300,000.00 structured guaranteed payment in Brooklyn for an infant who suffered an ankle injury during delivery ' ;
quote[2] = '$3,075,000.00 structured guaranteed payment for a young, pregnant woman who suffered partial nerve paralysis in her legs during prenatal care ';	
quote[3] = '$2,500,000.00 recovery for a man who suffered a skull fracture and hip fracture in an automobile accident.' ;
quote[4] = '$2,700,000.00 partially structured guaranteed payment for a young woman who suffered injuries to her hips following surgery' ;
quote[5] = '$1,750,000.00 recovery for an infant who suffered brain damage during delivery.' ;
quote[6] = '$1,450,000.00 recovery for a woman who suffered multiple body fractures when struck by a vehicle while crossing the street.' ;
quote[7] = '$1,400,000 recovery for the failure to diagnose cancer in young man who was in complete remission at the time of trial. ' ;
quote[8] = '$1,250,000.00 recovery for the failure to treat an ankle infection, requiring several operations' ;
quote[9] = '$1,000,000 recovery for a man who sustained a fractured leg, requiring surgery, due to a fall in a NYC park' ;
quote[10] = '$990,000.00 recovery for a woman who suffered a severe fracture of her foot in an indoor amusement park ' ;
quote[11] = '$975,000.00 recovery for an infant who suffered moderate learning disabilities following a delay in performing a C-section.' ;
quote[12] = '$875,000.00 recovery for the family of an elderly woman, who died, as a result of the failure to diagnose and treat an allergic reaction to medication.' ;
quote[13] = '$875,000.00 recovery for the failure to timely diagnose kidney cancer' ;
quote[14] = '$775,000.00 recovery for the family of an elderly woman who died shortly after receiving burns in a fire negligently started by her home health aide. ' ;


//configure the below 3 variables to set the dimension/background color of the slideshow
var slidewidth="159px" //set to width of LARGEST image in your slideshow
var slideheight="116px" //set to height of LARGEST iamge in your slideshow
var slidecycles="continous" //number of cycles before slideshow stops (ie: "2" or "continous")
var randomorder="no" //randomize the order in which images are displayed? "yes" or "no"
var preloadimages="no" //preload images? "yes" or "no"
var slidebgcolor=''

//configure the below variable to determine the delay between image rotations (in miliseconds)
var slidedelay=8000

////Do not edit pass this line////////////////

var ie=document.all
var dom=document.getElementById
var curcycle=0

var currentslide=0

function randomize(targetarray){
quoteCopy=new Array()
var the_one
var z=0
while (z<targetarray.length){
the_one=Math.floor(Math.random()*targetarray.length)
if (targetarray[the_one]!="_selected!"){
quoteCopy[z]=targetarray[the_one]
targetarray[the_one]="_selected!"
z++
}
}
}

if (randomorder=="yes")
randomize(quote)
else
quoteCopy=quote
var thebegin = ''
var thebreak = ''
var theq = ''
var theend = ''
var theauthorbreak = ''

function rotateimages(){
curcycle=(currentslide==0)? curcycle+1 : curcycle
ultcontainer=''
if (quoteCopy[currentslide][1]!="")
{
var thequote = quote[currentslide]
var theauthor = '' ; //author[currentslide]
ultcontainer+= thebegin + theq +  thequote + theq + thebreak +  theauthorbreak + theauthor + theend
}
ultcontainer+=''
fader[0] = new fadeObj(0, 'fade0', '555555', 'ffffff', 30, 50, true);
fader[0].message[0] = ultcontainer;

/*if (ie||dom)
crossrotateobj.innerHTML=ultcontainer*/
fade(0, 0, true);
if (currentslide==quote.length-1) currentslide=0
else currentslide++
if (curcycle==parseInt(slidecycles) && currentslide==0)
return
setTimeout("rotateimages()",slidedelay)
}

/*if (ie||dom)
document.write('<div id="slidedom" style="width:'+slidewidth+';"></div>')*/

function start_slider(){
crossrotateobj=dom? document.getElementById("slidedom") : document.all.slidedom
rotateimages()
}


