// The functions below are for DHTML effects to make items on a page appear one at a time 
// after short intervals. On static page (example.html) set redirect immediately after body tag with 
//       <script type="text/javascript">
//      //<![CDATA[
//       changepage('dynamicexample.html');
//      //]]>
//    </script>

//Relies on divs in dynamicexample.html page having been given ids with numbers
//such as "paragrapgh1", "paragraph2" so you can call the function with appear('paragraph',2)
//Also need to set visibility in CSS style sheet to hidden #paragraph1{visibility : hidden;}

// Need to add onload event to the <body> tag in dynamicexample.html page in the form 
// <body onload="appear('paragraph',2);">
// Also need to edit the line beginning var t=setTimeout in the appear function to match div ids and set intervals in milliseconds

//following function is for page redirect if javascript is running. 
function changepage(url)
{
   var replacementurl=url;
   window.location=url;  
}

// global variable declared outside function
var itemnumber=1;

function appear(item,limit)
{
   var max = limit;
   var x;
   var itemid;
   var item = item;
   itemid = item+itemnumber;
   x=document.getElementById(itemid);
   x.style.visibility="visible";
      
   itemnumber=itemnumber+1;
   //adding lines with additional if statements as calling same script and functions from two pages on this site with different divs
   if (item=="dynamictestimonial"&&itemnumber<=limit)
   {
     //set the following line to match the div name and number of divs on html page and the number of milliseconds for the intervals 
     var t=setTimeout("appear('dynamictestimonial',4)",1500);
   }
   else if (item=="dynamicnews"&&itemnumber<=limit)
   {
     var t=setTimeout("appear('dynamicnews',5)",1500);
   }
}

