
//*****************************************
// Blending Image Slide Show Script- 
// © Dynamic Drive (www.dynamicdrive.com)
// For full source code, visit http://www.dynamicdrive.com/
//*****************************************

//specify interval between slide (in milliseconds)
var slideInterval=50;
var stillInterval=3500;
var whiteInterval=10;

//Percent Opacity Change
var theOpacityInterval = 5;
//"adelphia.jpg", 
//"bezeq.jpg", 
//"matav.jpg", 

//specify images
var slideimages=new Array(
"blueridge.jpg", 
"bresnan.jpg", 
"brighthouse.jpg", 
"cablevision.jpg", 
"charter.jpg", 
"comcast.jpg", 
"comcor.jpg", 
"cox.jpg", 
"ekabel.jpg", 
"ericsson.jpg", 
"ewb.jpg", 
"fish.jpg", 
"gci.jpg", 
"hotdpov.jpg", 
"insight.jpg", 
"libertyglobal.jpg", 
"mediacom.jpg", 
"multikabel.jpg", 
"nt.jpg", 
"ntl.jpg", 
"ono.jpg", 
"rogers.jpg", 
"telefonica.jpg", 
"telenor.jpg", 
"telstra.jpg", 
"timewarner.jpg", 
"vtr.jpg", 
"wow.jpg"
);

//specify corresponding links
var slidelinks=new Array("http://www.dynamicdrive.com","http://javascriptkit.com","http://www.geocities.com")
var oneLink = "http://www.c-cor.com:81";

var prevSource1 = "";
var prevSource2 = "";

var newwindow=1 //open links in new window? 1=yes, 0=no

var imageholder=new Array()

var whichlink=0

for (i=0; i<slideimages.length; i++)
{
	imageholder[i] = new Image();
	imageholder[i].src = "/graphics/companies/logos/" + slideimages[i];
}

function fadeIn(theImageID, opacity)
{
	if (document.getElementById)
	{
		var theImage = document.getElementById(theImageID);

		if (opacity <= 100)
		{
			setOpacity(theImage, opacity);
			opacity = opacity + theOpacityInterval;
			setTimeout("fadeIn('"+theImageID+"',"+opacity+")", slideInterval);
		}
		else
		{
			setTimeout("fadeOut('" + theImageID + "', 100)", stillInterval);
		}
	}
}

function fadeOut(theImageID, opacity)
{
	if (document.getElementById)
	{
		var theImage = document.getElementById(theImageID);
		
		if (opacity >= 0)
		{
			setOpacity(theImage, opacity);
			opacity = opacity - theOpacityInterval;
			setTimeout("fadeOut('"+theImageID+"',"+opacity+")", slideInterval);
		}
		else
		{
			setTimeout("doSlide('"+theImageID+"')", whiteInterval);
		}
	}
}


function setOpacity(theImage, opacity) 
{
	opacity = (opacity == 100)?99.999:opacity;

	// IE/Win
	theImage.style.filter = "alpha(opacity:"+opacity+")";
  
	// Safari<1.2, Konqueror
	theImage.style.KHTMLOpacity = opacity/101;
  
	// Older Mozilla and Firefox
	theImage.style.MozOpacity = opacity/101;
  
	// Safari 1.2, newer Firefox and Mozilla, CSS3
	theImage.style.opacity = opacity/101;
}

function doSlide(theImageID)
{
	switchImage(theImageID);
	fadeIn(theImageID, 0);
}

function switchImage(theImageID)
{
	var theImage = document.getElementById(theImageID);

	var imageIndex = Math.floor(Math.random() * imageholder.length);
	whichlink = imageIndex;

	if ((imageholder[imageIndex].src == prevSource1) || 
		(imageholder[imageIndex].src == theImage.src))
	{
		switchImage(theImageID);
	}
	else
	{
		// Set previous two sources
		
		prevSource2 = prevSource1;
		prevSource1 = theImage.src;
		theImage.src = imageholder[imageIndex].src;

	}

	
}

