var propertyNumber = 0, tim, fade = 0, fadeOut = 0, ieFade = 0, pause = 0, fader, browser, scrollsteps, downscrolltimer, scrolledamount = 0;





browser = navigator.appName;



var obj                 = window.document.getElementById("fadeImg");



//PhotoCaptions

















function opacity( num, client)

 {

 switch ( num )

  {

  case 0:

         ief = 1;

         ff  = 100;

  break;



  case 1:

         ief = 0.9;

         ff  = 90;

  break;



  case 2:

         ief = 0.8;

         ff  = 80;

  break;



  case 3:

         ief = 0.7;

         ff  = 70;

  break;



  case 4:

         ief = 0.6;

         ff  = 60;

  break;



  case 5:

         ief = 0.5;

         ff  = 50;

  break;



  case 6:

         ief = 0.4;

         ff  = 40;

  break;



  case 7:

         ief = 0.3;

         ff  = 30;

  break;



  case 8:

         ief = 0.2;

         ff  = 20;

  break;



  case 9:

         ief = 0.1;

         ff  = 10;

  break;



  case 10:

         ief = 0;

         ff  = 0;

  break;

  }



  if ( client == 1 )

   {

    return ief;

   }

   else

   {

    return ff;

   }



 }



 function opacity1( num, client)

  {

  switch ( num )

   {

   case 0:

          ief = 0;

          ff  = 0;

   break;



   case 1:

          ief = 0.1;

          ff  = 10;

   break;



   case 2:

          ief = 0.2;

          ff  = 20;

   break;



   case 3:

          ief = 0.3;

          ff  = 30;

   break;



   case 4:

          ief = 0.4;

          ff  = 40;

   break;



   case 5:

          ief = 0.5;

          ff  = 50;

   break;



   case 6:

          ief = 0.6;

          ff  = 60;

   break;



   case 7:

          ief = 0.7;

          ff  = 70;

   break;



   case 8:

          ief = 0.8;

          ff  = 80;

   break;



   case 9:

          ief = 0.9;

          ff  = 90;

   break;



   case 10:

          ief = 100;

          ff  = 99;

   break;

   }



   if ( client == 1 )

    {

     return ief;

    }

    else

    {

     return ff;

    }



 }



function scroll_down()

 {

 //scrollsteps = scrollsteps - 1;

 

 scrolledamount = scrolledamount + 1;

 

 

 if(scrolledamount > 40  )

  {

  window.clearTimeout(downscrolltimer);

  fade = 0;

  fade_out();

  }

  else

  {

  obj.style.marginTop = "-" + scrolledamount	 + "px";

  downscrolltimer = window.setTimeout( "scroll_down()", 100);

  }

 

 }



function start_fade_in()

 {

       obj            = window.document.getElementById("fadeImg");

captionBox1    = window.document.getElementById("captionBox"); 





  if( browser !== "Microsoft Internet Explorer")

   {

    fadeValue = opacity1( fade , '1');



    obj.style.opacity              = fadeValue;

    captionBox1.style.opacity              = fadeValue;





   }



  if( browser == "Microsoft Internet Explorer")

   {

    fadeValue = opacity1( fade , '2');

    obj.filters.item("DXImageTransform.Microsoft.Alpha").opacity            = fadeValue;

    captionBox1.filters.item("DXImageTransform.Microsoft.Alpha").opacity       = fadeValue;

    }





  if(fade < 10)

   {

   fade = fade + 1;

   fader = window.setTimeout( "start_fade_in()", 100);

   }

     else

      {

        //terminate interval

	    window.clearTimeout( fader );

	     if( browser == "Microsoft Internet Explorer")

              {

              fadeValue = "100";

              obj.filters.item("DXImageTransform.Microsoft.Alpha").opacity            = fadeValue;

              }

              

              if(obj.height > 200)

               {

               scrollsteps = obj.height - 200 / 2;

               scrolledamount = 0;

               scroll_down();

               }

               else

               {

               fade = 0;

               fade_out();

               }

	

      }

 }



function switch_caption_txt()

 {

 

  var oUl = document.getElementById("captionList");

    

     

    if( browser == "Microsoft Internet Explorer")

      {

       tmp = oUl.childNodes[0].innerHTML;

       }else{

       tmp = oUl.childNodes[1].innerHTML;

       }

    

       oUl.childNodes[0].innerHTML  = oUl.childNodes[1].innerHTML;

       oUl.childNodes[1].innerHTML  = oUl.childNodes[2].innerHTML;

       oUl.childNodes[2].innerHTML  = oUl.childNodes[3].innerHTML;

       oUl.childNodes[3].innerHTML  = oUl.childNodes[4].innerHTML; 

       oUl.childNodes[4].innerHTML  = oUl.childNodes[5].innerHTML;

       oUl.childNodes[5].innerHTML  = oUl.childNodes[6].innerHTML;

       oUl.childNodes[6].innerHTML  = oUl.childNodes[7].innerHTML;

       oUl.childNodes[7].innerHTML  = oUl.childNodes[8].innerHTML;

       oUl.childNodes[8].innerHTML  = oUl.childNodes[9].innerHTML;

       oUl.childNodes[9].innerHTML  = oUl.childNodes[10].innerHTML;

       oUl.childNodes[10].innerHTML = oUl.childNodes[11].innerHTML;

       oUl.childNodes[11].innerHTML = oUl.childNodes[12].innerHTML;

       oUl.childNodes[12].innerHTML = oUl.childNodes[13].innerHTML;

       oUl.childNodes[13].innerHTML = oUl.childNodes[14].innerHTML;

       oUl.childNodes[14].innerHTML = oUl.childNodes[15].innerHTML;

       oUl.childNodes[15].innerHTML = oUl.childNodes[16].innerHTML;

       oUl.childNodes[16].innerHTML = oUl.childNodes[17].innerHTML;

       oUl.childNodes[17].innerHTML = oUl.childNodes[18].innerHTML;

       oUl.childNodes[18].innerHTML = oUl.childNodes[19].innerHTML;
	   
	   oUl.childNodes[19].innerHTML = oUl.childNodes[20].innerHTML;

       oUl.childNodes[20].innerHTML = oUl.childNodes[21].innerHTML;

       oUl.childNodes[21].innerHTML = oUl.childNodes[22].innerHTML;

       oUl.childNodes[22].innerHTML = oUl.childNodes[23].innerHTML;

       oUl.childNodes[23].innerHTML = oUl.childNodes[24].innerHTML;

       oUl.childNodes[24].innerHTML = oUl.childNodes[25].innerHTML;

       oUl.childNodes[25].innerHTML = oUl.childNodes[26].innerHTML;

       oUl.childNodes[26].innerHTML = oUl.childNodes[27].innerHTML;

       oUl.childNodes[27].innerHTML = oUl.childNodes[28].innerHTML;
	   
	   oUl.childNodes[28].innerHTML = oUl.childNodes[29].innerHTML;

       oUl.childNodes[29].innerHTML = oUl.childNodes[30].innerHTML;

       oUl.childNodes[30].innerHTML = oUl.childNodes[31].innerHTML;

       oUl.childNodes[31].innerHTML = tmp;;

       //oUl.childNodes[39].innerHTML = tmp;

       //oUl.childNodes[20].innerHTML = tmp;

       

       

   

     if(propertyNumber == 0)

    	      {

    	    	    set_ul();

    	    	  	    	    

	      }

 





 

  start_fade_in();

 }



function start_fade_out()

 {



 obj            = window.document.getElementById("fadeImg");



 captionBox1    = window.document.getElementById("captionBox"); 

 

 next = propertyNumber + 1;

 var preload = new Image();

preload.src = a[next];



  if( browser !== "Microsoft Internet Explorer")

   {

    fadeValue = opacity( fade , '1');



    obj.style.opacity                      = fadeValue;

    captionBox1.style.opacity              = fadeValue;





   }



  if( browser == "Microsoft Internet Explorer")

   {

    fadeValue = opacity( fade , '2');

    captionBox1.filters.item("DXImageTransform.Microsoft.Alpha").opacity       = fadeValue;

    obj.filters.item("DXImageTransform.Microsoft.Alpha").opacity               = fadeValue;

    



    }







  if(fade < 11)

   {

   fade = fade + 1;

   fader = window.setTimeout( "start_fade_out()", 100);

   }

     else

      {

        //terminate interval

	    window.clearTimeout( fader );

	    fade = 0;

	    

	    obj.src                  = a[propertyNumber];

            obj.style.marginTop = "0px";

            switch_caption_txt();

        

      }

 }







function fade_out()

 {











   if(pause < 6 )

    {

      pause = pause + 1;

     tim = window.setTimeout( "fade_out()", 1000);



    }



      if( pause > 5 )

	   {

	   pause = 0;

	    propertyNumber = propertyNumber + 1;
		
		//alert(propertyNumber);

	   window.clearTimeout( tim );



	   if(propertyNumber == 33)

	    {

	    propertyNumber = 0;

	    }

	    start_fade_out();

	    }



















 }



function set_ul()

 {

var oUl = document.getElementById("captionList");

 if( browser == "Microsoft Internet Explorer")

   {

  oUl.childNodes[0].innerHTML  = 'Brightons State of the Art Recreational Center is very popular among Brighton\'s residents of all ages';

  oUl.childNodes[1].innerHTML  = 'The fishing pond located at the Brighton Recreational Center is a great place to catch a couple of fish and spend some great time with the kids';

  oUl.childNodes[2].innerHTML  = 'A great place to meet with family and friends, eat a meal and watch the game';

  oUl.childNodes[3].innerHTML  = "Another one of Brighton\'s favorite restaurant choices";

  oUl.childNodes[4].innerHTML  = 'The Brighton Depot is very  popular among local residents and while it is now a restaurant, it originally served as the Brighton train depot';

  oUl.childNodes[5].innerHTML  = 'Brighton residents have many choices for relaxed outdoor dining';

  oUl.childNodes[6].innerHTML  = 'Starbucks and other coffee shops are always a popular place to meet friends or business acquaintances';

  oUl.childNodes[7].innerHTML  = 'Visitors at the Pavilions have many dining choices';

  oUl.childNodes[8].innerHTML  = 'The movie theater at the Pavilions is a favorite destination for area residents of all ages';

  oUl.childNodes[9].innerHTML  = "Brighton has great shopping opportunities... everything you may want or need can be found in Brighton";

  oUl.childNodes[10].innerHTML  = 'The Home Depot is a great place to find everything you need for that home improvement project';

  oUl.childNodes[11].innerHTML  = 'There are plenty of choices for grocery shopping.  In Brighton residents can choose between King Soopers, Safeway, and Super WalMart';

  oUl.childNodes[12].innerHTML  = 'The Palizzi Market is one of several great local markets where you are always assured to find the freshest area produce';

  oUl.childNodes[13].innerHTML  = 'The Bella Sera Event Center is a wonderful venue for special parties, weddings, and meetings';

  oUl.childNodes[14].innerHTML  = 'The historic downtown area is always bustling with activity and is home to the new Brighton Cultural Center and Library';
  
  oUl.childNodes[15].innerHTML  = 'The Platte Valley Medical Center is a State of the Art medical facility.';

  oUl.childNodes[16].innerHTML  = 'Residents of Brighton are able to use and enjoy many great golf courses';

  oUl.childNodes[17].innerHTML  = 'Many of the area golf courses provide spectacular views of the mountains and snow covered peaks';
  
  oUl.childNodes[18].innerHTML  = 'Brighton has housing opportunities for every taste and budget.  This is an example of an upscale neighborhood which is surrounded by a golf course';
  
  

  oUl.childNodes[19].innerHTML  = 'Country living at its best.  This is an example of an area home set on a 1 - 2 acre lot';

  oUl.childNodes[20].innerHTML  = "Another beautiful Brighton home";

  oUl.childNodes[21].innerHTML  = 'This is a very popular custom neighborhood built entirely by local custom home builders';

  oUl.childNodes[22].innerHTML  = 'Another example of homes available in the Brighton area';

  oUl.childNodes[23].innerHTML  = 'A beautiful two story... Brighton has the perfect home for every taste and budget';

  oUl.childNodes[24].innerHTML  = 'Barr Lake Recreational Park is a favorite destination for kids of all ages.  Here you can take a nature hike, watch birds, enjoy a ranger led tour, ride your horse and much more.';

  oUl.childNodes[25].innerHTML  = 'Brighton offers many trails and walking paths for residents young and old to enjoy';
  
  oUl.childNodes[26].innerHTML  = 'One of the many trails to be enjoyed';

  oUl.childNodes[27].innerHTML  = 'Brighton residents have many parks to enjoy throughout the city';

  oUl.childNodes[28].innerHTML  = 'Another popular park enjoyed by Brighton residents of all ages';

  oUl.childNodes[29].innerHTML  = '27J is the fastest growing school district in Colorado.  This is a photo of one of the new high schools';
  
  oUl.childNodes[30].innerHTML  = 'One of the Brighton elementary schools';

  oUl.childNodes[31].innerHTML  = 'Vikan Middle School';
  
  oUl.childNodes[32].innerHTML  = 'Brighton High School – Home of the Brighton Bulldogs!';


 

    }else{

oUl.childNodes[1].innerHTML  = 'Brightons State of the Art Recreational Center is very popular among Brighton\'s residents of all ages';

  oUl.childNodes[2].innerHTML  = 'The fishing pond located at the Brighton Recreational Center is a great place to catch a couple of fish and spend some great time with the kids';

  oUl.childNodes[3].innerHTML  = 'A great place to meet with family and friends, eat a meal and watch the game';

  oUl.childNodes[4].innerHTML  = "Another one of Brighton\'s favorite restaurant choices";

  oUl.childNodes[5].innerHTML  = 'The Brighton Depot is very  popular among local residents and while it is now a restaurant, it originally served as the Brighton train depot';

  oUl.childNodes[6].innerHTML  = 'Brighton residents have many choices for relaxed outdoor dining';

  oUl.childNodes[7].innerHTML  = 'Starbucks and other coffee shops are always a popular place to meet friends or business acquaintances';

  oUl.childNodes[8].innerHTML  = 'Visitors at the Pavilions have many dining choices';

  oUl.childNodes[9].innerHTML  = 'The movie theater at the Pavilions is a favorite destination for area residents of all ages';

  oUl.childNodes[10].innerHTML  = "Brighton has great shopping opportunities... everything you may want or need can be found in Brighton";

  oUl.childNodes[11].innerHTML  = 'The Home Depot is a great place to find everything you need for that home improvement project';

  oUl.childNodes[12].innerHTML  = 'There are plenty of choices for grocery shopping.  In Brighton residents can choose between King Soopers, Safeway, and Super WalMart';

  oUl.childNodes[13].innerHTML  = 'The Palizzi Market is one of several great local markets where you are always assured to find the freshest area produce';

  oUl.childNodes[14].innerHTML  = 'The Bella Sera Event Center is a wonderful venue for special parties, weddings, and meetings';

  oUl.childNodes[15].innerHTML  = 'The historic downtown area is always bustling with activity and is home to the new Brighton Cultural Center and Library';
  
  oUl.childNodes[16].innerHTML  = 'The Platte Valley Medical Center is a State of the Art medical facility.';

  oUl.childNodes[17].innerHTML  = 'Residents of Brighton are able to use and enjoy many great golf courses';

  oUl.childNodes[18].innerHTML  = 'Many of the area golf courses provide spectacular views of the mountains and snow covered peaks';
  
  oUl.childNodes[19].innerHTML  = 'Brighton has housing opportunities for every taste and budget.  This is an example of an upscale neighborhood which is surrounded by a golf course';
  
  

  oUl.childNodes[20].innerHTML  = 'Country living at its best.  This is an example of an area home set on a 1 - 2 acre lot';

  oUl.childNodes[21].innerHTML  = "Another beautiful Brighton home";

  oUl.childNodes[22].innerHTML  = 'This is a very popular custom neighborhood built entirely by local custom home builders';

  oUl.childNodes[23].innerHTML  = 'Another example of homes available in the Brighton area';

  oUl.childNodes[24].innerHTML  = 'A beautiful two story... Brighton has the perfect home for every taste and budget';

  oUl.childNodes[25].innerHTML  = 'Barr Lake Recreational Park is a favorite destination for kids of all ages.  Here you can take a nature hike, watch birds, enjoy a ranger led tour, ride your horse and much more.';

  oUl.childNodes[26].innerHTML  = 'Brighton offers many trails and walking paths for residents young and old to enjoy';
  
  oUl.childNodes[27].innerHTML  = 'One of the many trails to be enjoyed';

  oUl.childNodes[28].innerHTML  = 'Brighton residents have many parks to enjoy throughout the city';

  oUl.childNodes[29].innerHTML  = 'Another popular park enjoyed by Brighton residents of all ages';

  oUl.childNodes[30].innerHTML  = '27J is the fastest growing school district in Colorado.  This is a photo of one of the new high schools';
  
  oUl.childNodes[31].innerHTML  = 'One of the Brighton elementary schools';

  oUl.childNodes[32].innerHTML  = 'Vikan Middle School';
  
  oUl.childNodes[33].innerHTML  = 'Brighton High School – Home of the Brighton Bulldogs!';

    }



 }




