//find the browser

var browser = navigator.appName



// Set slideShowSpeed (milliseconds)

var slideShowSpeed = 4000



// Duration of crossfade (seconds)

var crossFadeDuration = 4



// Specify the image files

var Pic = new Array() // don't touch this

// to add more images, just continue

// the pattern, adding to the array below



Pic[0] = 'images/Bar_Pics/036.JPG'

Pic[1] = 'images/Bar_Pics/038.JPG'

Pic[2] = 'images/Bar_Pics/03.jpg'

Pic[3] = 'images/Bar_Pics/040.JPG'

Pic[4] = 'images/Bar_Pics/044.JPG'

Pic[5] = 'images/Bar_Pics/046.JPG'

Pic[6] = 'images/Bar_Pics/047.JPG'

Pic[7] = 'images/Bar_Pics/01.jpg'

Pic[8] = 'images/Bar_Pics/039.JPG'



// =======================================

// do not edit anything below this line

// =======================================



var t

var j = 0

var p = Pic.length



var preLoad = new Array();

for (i = 0; i < p; i++){

   preLoad[i] = new Image();

   preLoad[i].src = Pic[i];

}



function runSlideShow(){

   if (document.all){
	  	  
      //document.images.SlideShow.style.filter="blendTrans(duration=2)"

    //  document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"

    //  document.images.SlideShow.filters.blendTrans.Apply()
   
 //blendimage("imgpos", "SlideShow", "images/Bar_Pics/", 3000);
 
  }

   document.images.SlideShow.src = preLoad[j].src;

  if (document.all){

      //document.images.SlideShow.filters.blendTrans.Play()
      
     // a = blendimage("imgpos", "SlideShow", "asdf", 1000);
      //alert(preLoad[j].src);

   }

   

  j = j + 1;

  if (j > (p-1)) j=0;

   t = setTimeout('runSlideShow()', slideShowSpeed);

}

function opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
} 

//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")";
    
       j = j + 1;

   if (j > (p-1)) j=0;

    
    a = blendimage("imgpos", "SlideShow", preload[j].src, 1000);
    
    
}

function shiftOpacity(id, millisec) { 
    //if an element is invisible, make it visible, else make it ivisible 
    if(document.getElementById(id).style.opacity == 0) { 
        opacity(id, 0, 100, millisec); 
    } else { 
        opacity(id, 100, 0, millisec); 
    } 
} 

function blendimage(divid, imageid, imagefile, millisec) { 
alert("asdf");
    var speed = Math.round(millisec / 100); 
    var timer = 0; 
     
    //set the current image as background 
    document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")"; 
     
    //make image transparent 
    changeOpac(0, imageid); 
     
    //make new image 
    document.getElementById(imageid).src = preLoad[j]; 

    //fade in image 
    for(i = 0; i <= 100; i++) { 
        setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed)); 
        timer++; 
    } 
} 
