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 = oUl.childNodes[32].innerHTML;

    oUl.childNodes[32].innerHTML = oUl.childNodes[33].innerHTML;

    oUl.childNodes[33].innerHTML = oUl.childNodes[34].innerHTML;

    oUl.childNodes[34].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 < 9 )

    {

      pause = pause + 1;

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



    }



      if( pause > 8 )

	   {

	   pause = 0;

	    propertyNumber = propertyNumber + 1;

	   window.clearTimeout( tim );



	  if(propertyNumber == 34)

	    {

	    propertyNumber = 0;

	  	    	    

	    }

	    

	    start_fade_out();

	     

	    }



















 }



function set_ul()

 {

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

 if( browser == "Microsoft Internet Explorer")

   {

  oUl.childNodes[0].innerHTML  = 'Boulder is nestled at the base of the foothills and is known for its many parks, open spaces, and hiking trails';

      oUl.childNodes[1].innerHTML  = 'Boulder, as seen from Flagstaff Mountain';

      oUl.childNodes[2].innerHTML  = 'Chatauqua Park is famous for its views of the Flat Irons and many scenic hiking trails';

      oUl.childNodes[3].innerHTML  = 'The Boulder Flat Irons and Chatauqua Park'; 

      oUl.childNodes[4].innerHTML  = 'Some of Boulders most breathtaking scenery can be enjoyed at Chatauqua Park';

      oUl.childNodes[5].innerHTML  = 'Chatauqua Parks beauty inspires all who see it';

      oUl.childNodes[6].innerHTML  = "Boulder residents enjoy Colorado's outdoor activities all year around";

      oUl.childNodes[7].innerHTML  = 'The Rocky Mountain high country as seen from Flagstaff Mountain';

      oUl.childNodes[8].innerHTML  = 'Flagstaff Nature Center';

      oUl.childNodes[9].innerHTML  = 'Mule deer are plentiful and can often be seen in and around Boulder';

      oUl.childNodes[10].innerHTML = 'The Boulder school district is known as one of the best in the area';

      oUl.childNodes[11].innerHTML = 'There are many outdoor cafes to be enjoyed in and around Boulder';

      oUl.childNodes[12].innerHTML = 'Boulder Creek';

      oUl.childNodes[13].innerHTML = 'Boulder is home to CU - The University of Colorado and the CU Buffs';

      oUl.childNodes[14].innerHTML = 'The Pearl Street Mall is a very popular pedestrian mall with many unique shops, great restaurants, entertainment, and outdoor cafes';

      oUl.childNodes[15].innerHTML = 'Another view of the popular Pearl Street Mall';

      oUl.childNodes[16].innerHTML = 'At the Pearl Street Mall shoppers are often entertained by street musicians, magicians, and various other entertainers';

      oUl.childNodes[17].innerHTML = 'The East Boulder Community Center is a very popular destination among Boulder homeowners and residents';

      oUl.childNodes[18].innerHTML = "Boulder offers a wide variety of housing options for its' residents";

      oUl.childNodes[19].innerHTML = 'Homes in Boulder range from quaint Bungalows to spectacular custom homes';

      oUl.childNodes[20].innerHTML = 'A typical home located near Chatauqua Park';

      oUl.childNodes[21].innerHTML = 'Another beautiful Boulder home';

      oUl.childNodes[22].innerHTML = 'Homes in Boulder offer residents a wide variety of architectural choices and styles';

      oUl.childNodes[23].innerHTML = 'Just one of the spectacular mountain views to be enjoyed in and around Boulder';

      oUl.childNodes[24].innerHTML = 'The University of Colorado Boulder campus';

      oUl.childNodes[25].innerHTML = 'Folsom Field - Home of the CU Buffs - Go Buffs!';

      oUl.childNodes[26].innerHTML = 'CU students enjoy relaxing at one of the outdoor coffee shops in the Hill District';

      oUl.childNodes[27].innerHTML = "CU Boulder is a beautiful campus with it's many stone and red tile roofed buildings, tree lined streets and boulevards";

      oUl.childNodes[28].innerHTML = 'Just one of the beautiful buildings on the University of Colorado Boulder campus';

      oUl.childNodes[29].innerHTML = 'Many parks can be found in Boulder and they are widely used and enjoyed by Boulder residents of all ages';

      oUl.childNodes[30].innerHTML = 'The Boulder History Museum';

      oUl.childNodes[31].innerHTML = 'Colorado and Boulder residents are known for leading a healthy lifestyle.  Bicycling is a very popular among young and old alike';

      oUl.childNodes[32].innerHTML = 'Another Boulder bike and hiking path';

    oUl.childNodes[33].innerHTML = 'Residents enjoy the many challenging golf courses in and around Boulder';

    



    }else{

oUl.childNodes[1].innerHTML  = 'Boulder is nestled at the base of the foothills and is known for its many parks, open spaces, and hiking trails';

    oUl.childNodes[2].innerHTML  = 'Boulder, as seen from Flagstaff Mountain';

    oUl.childNodes[3].innerHTML  = 'Chatauqua Park is famous for its views of the Flat Irons and many scenic hiking trails';

    oUl.childNodes[4].innerHTML  = 'The Boulder Flat Irons and Chatauqua Park'; 

    oUl.childNodes[5].innerHTML  = 'Some of Boulders most breathtaking scenery can be enjoyed at Chatauqua Park';

    oUl.childNodes[6].innerHTML  = 'Chatauqua Parks beauty inspires all who see it';

    oUl.childNodes[7].innerHTML  = "Boulder residents enjoy Colorado's outdoor activities all year around";

    oUl.childNodes[8].innerHTML  = 'The Rocky Mountain high country as seen from Flagstaff Mountain';

    oUl.childNodes[9].innerHTML  = 'Flagstaff Nature Center';

    oUl.childNodes[10].innerHTML  = 'Mule deer are plentiful and can often be seen in and around Boulder';

    oUl.childNodes[11].innerHTML = 'The Boulder school district is known as one of the best in the area';

    oUl.childNodes[12].innerHTML = 'There are many outdoor cafes to be enjoyed in and around Boulder';

    oUl.childNodes[13].innerHTML = 'Boulder Creek';

    oUl.childNodes[14].innerHTML = 'Boulder is home to CU - The University of Colorado and the CU Buffs';

    oUl.childNodes[15].innerHTML = 'The Pearl Street Mall is a very popular pedestrian mall with many unique shops, great restaurants, entertainment, and outdoor cafes';

    oUl.childNodes[16].innerHTML = 'Another view of the popular Pearl Street Mall';

    oUl.childNodes[17].innerHTML = 'At the Pearl Street Mall shoppers are often entertained by street musicians, magicians, and various other entertainers';

    oUl.childNodes[18].innerHTML = 'The East Boulder Community Center is a very popular destination among Boulder homeowners and residents';

    oUl.childNodes[19].innerHTML = "Boulder offers a wide variety of housing options for its' residents";

    oUl.childNodes[20].innerHTML = 'Homes in Boulder range from quaint Bungalows to spectacular custom homes';

    oUl.childNodes[21].innerHTML = 'A typical home located near Chatauqua Park';

    oUl.childNodes[22].innerHTML = 'Another beautiful Boulder home';

    oUl.childNodes[23].innerHTML = 'Homes in Boulder offer residents a wide variety of architectural choices and styles';

    oUl.childNodes[24].innerHTML = 'Just one of the spectacular mountain views to be enjoyed in and around Boulder';

    oUl.childNodes[25].innerHTML = 'The University of Colorado Boulder campus';

    oUl.childNodes[26].innerHTML = 'Folsom Field - Home of the CU Buffs - Go Buffs!';

    oUl.childNodes[27].innerHTML = 'CU students enjoy relaxing at one of the outdoor coffee shops in the Hill District';

    oUl.childNodes[28].innerHTML = "CU Boulder is a beautiful campus with it's many stone and red tile roofed buildings, tree lined streets and boulevards";

    oUl.childNodes[29].innerHTML = 'Just one of the beautiful buildings on the University of Colorado Boulder campus';

    oUl.childNodes[30].innerHTML = 'Many parks can be found in Boulder and they are widely used and enjoyed by Boulder residents of all ages';

    oUl.childNodes[31].innerHTML = 'The Boulder History Museum';

    oUl.childNodes[32].innerHTML = 'Colorado and Boulder residents are known for leading a healthy lifestyle.  Bicycling is a very popular among young and old alike';

    oUl.childNodes[33].innerHTML = 'Another Boulder bike and hiking path';

    oUl.childNodes[34].innerHTML = 'Residents enjoy the many challenging golf courses in and around Boulder';

    }



 }





