//fade part of this script is adapted from Richard Rutter's fade script at http://clagnut.com/

function setOpacity(obj, opacity) {
  opacity = (opacity == 100)?99.999:opacity;
  
  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";
  
  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;
  
  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;
  
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}

function fadeIn(objId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity <= 100) {
      setOpacity(obj, opacity);
      opacity += 10;
      window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 100);
    }
  }
}

function initImage() {
  var imageId = 'splash';
  var image = document.getElementById(imageId);
  var captionId = 'caption';
  var ImageCaption = document.getElementById(captionId);
  setOpacity(image, 0);
  setOpacity(ImageCaption, 0);
  image.style.visibility = 'visible';
  ImageCaption.style.visibility = 'visible';
  fadeIn(imageId,0);
  fadeIn(captionId,0); 
}

function RotateIndexImages(Start)
  {
	
	var Images = new Array('images/index_big_pic1.jpg',
				  			'images/index_big_pic4.jpg',
							'images/index_big_pic5.jpg',
							'images/index_big_pic3.jpg',
							'images/index_big_pic2.jpg');

	var Hospice_Names = new Array('neighbor serving neighbor',
						   		  'quality care first',
						    	  'stewardship always',
						          'home-grown and home-owned',
						   		  'best for texas');
						
	var Left_Values = new Array('255px',
								 '340px',
								 '210px',
								 '30px',
								 '75px');
							
  								if(screen.width>1280 && screen.height>1024)
									{
										var Top_Values = new Array('-65px',
															'-300px',
															'-420px',
															'-430px',
															'-420px');
									}
								else
									{
										var Top_Values = new Array('-65px',
																'-300px',
																'-410px',
																'-420px',
																'-400px');
									}
							
	
	

								
	var Width_Values = new Array('420px',
							   '300px',
							   '320px',
							   '500px',
							   '250px');											

	var ImageTag = document.getElementById('splash');
	var ImageCaption = document.getElementById('caption');
    var CaptionStyle = document.getElementById('quote');

	var a = eval("Images");
  	var b = eval("ImageTag");

    var c = eval("Hospice_Names");
	var d = eval("ImageCaption");
	
	var e = eval("CaptionStyle");
	var f = eval("Left_Values");
	var g = eval("Top_Values");
	var h = eval("Width_Values");

  	if(Start>=a.length)
  		Start=0;
  	b.src = a[Start];

	d.innerHTML = c[Start];
    
    e.style.left = f[Start];
    e.style.top = g[Start];
	e.style.width = h[Start];

   window.setTimeout("RotateIndexImages("+(Start+1)+")",7500);
   window.setTimeout("initImage()",7500);
  }

  RotateIndexImages(0);
  
