﻿var  Testimonials= new Array();
     Testimonials[0] = "<img src=\"../images/image_main.jpg\" alt=\"\" title=\"\" />";
     Testimonials[1] = "<img src=\"../images/image_main2.jpg\" alt=\"\" title=\"\" />";
     Testimonials[2] = "<img src=\"../images/image_main3.jpg\" alt=\"\" title=\"\" />";

//var  Banners = new Array();
//       Banners[0] = "<a href=\"../pages/Donate.aspx\"><img alt=\"Make a donation\" title=\"Make a donation\" src=\"../images/butt_donate.jpg\" /></a>";
//       Banners[1] = "<a href=\"../pages/E-cards.aspx\"><img alt=\"Send an E-card\" title=\"Send an E-card\" src=\"../images/butt_ecard2.jpg\" /></a>";
       
       
    var restore1 = new Array();
    restore1[0] = "opacity:1,1000";
    
    var restore2 = new Array();
    restore2[0] = "opacity:0::setQuote('Testimonials'):1000,1000";
     
    var restore3 = new Array();
    restore3[0] = "opacity:0::setQuote('Banners'):1000,1000";
    
    var randomnumber;
    var randomnumber2;
    
    randomnumber =0;
    
//Read more: http://www.webdesign.org/web-programming/javascript/jquery-fade-in-fade-out.16979.html#ixzz0oHLPDsAi
//setInterval("Fadeout()",15000);
//setInterval("randomnumber=Math.floor(Math.random()*5);$(\"#RandomTestimonails\").html(Testimonials[randomnumber]);",6000);
//setInterval("$(\"#RandomTestimonails\").fadeTo(\"slow\", 1);",6050);
    
    function setQuote(DivID)
        {
          //randomnumber=Math.floor(Math.random()*Testimonials.length);
          $("#ImageFader").html(Testimonials[randomnumber]); 
          move( 0,restore1,'#ImageFader'); 
          
          if(randomnumber ==0)
          {
            randomnumber = 1;
          }
          else if(randomnumber ==1)
          {
            randomnumber = 2;
          }
          else if(randomnumber ==2)
          {
            randomnumber = 0;
          }
          
//          randomnumber2=Math.floor(Math.random()*Banners.length);
//          $("#RandomBanners").html(Banners[randomnumber2]); 
//          move( 0,restore1,'#RandomBanners'); 
        }
       
    
     var defaultEasing = "swing";

    function move(theIndex, TheAnimationSequence, objectToAnimate, Loop,LoopTime) {

                    
        if (theIndex < TheAnimationSequence.length) {
        
            var anim = {}; 
            var theEasing = defaultEasing;
            var theParams = TheAnimationSequence[theIndex].split(",")
            for (i = 0; i < theParams.length - 1; i++) {
                execParamaters = theParams[i].split(":");
             
              anim[execParamaters[0]] = execParamaters[1];
              if (execParamaters.length > 2) {
                    if(execParamaters[2] != ""){
                        theEasing = execParamaters[2];
                    }
                    if (execParamaters.length == 5) {
                        setTimeout(execParamaters[3], execParamaters[4]);
                    }
                    else
                    {
                        if (execParamaters.length == 4) {
                            eval(execParamaters[4]);
                        }
                    }
                }
            }
            
            // grab the last index of the array to get the time to execute the animation
            var theTime = theParams[theParams.length - 1];
            $(objectToAnimate).animate(anim, parseInt(theTime),theEasing, function() {
                move(theIndex + 1,TheAnimationSequence,objectToAnimate,Loop,LoopTime);
            });
        }
        else
        {
            if(Loop){
               move(0,TheAnimationSequence,objectToAnimate,Loop,LoopTime);
            }
        }
}
  
    
    
    
    
$(document).ready(function(){
setQuote();
 setInterval("move( 0,restore2,'#ImageFader')",5000); 
//setInterval("move( 0,restore3,'#RandomBanners')",15000); 

});
/*<div align="justify" style="color:#464646">…thank you for being fantastic to my late mom.<br /><br />
Their efficiency and kindness took a great weight off me… <br /><br />
Yeshar Koach to you all at Hatzolah."<br /><br />
…they go that extra mile to make the patient comfortable..<br /><br />
within minutes, they were there…<br /><br /></div>*/
