// Global variables
var isCSS = false;
var isW3C = false;
var isIE4 = false;
var isNN4 = false;
var isIE6 = false;
var isGecko = false;
var isOpera = false;
var isDHTML = false;
// initialize upon load to let all browsers establish content objects
function autoconfig()
{
if(document && document.images)
{
isCSS = (document.body && document.body.style) ? true : false;
isW3C = (isCSS && document.getElementById) ? true : false;
isIE4 = (isCSS && document.all && readIEVer() >= 4.0) ? true : false;
isNN4 = (document.layers) ? true : false;
isGecko = (isCSS && navigator && navigator.product && navigator.product == "Gecko");
isOpera = (isCSS && navigator.userAgent.indexOf( "Opera") != -1 );
isIE6CSS = (document.compatMode && document.compatMode.indexOf("CSS1") >= 0) ? true : false;
isIE6 = ( isIE6CSS && readIEVer() >= 6.0 );
isDHTML = isCSS && ( isIE4 || isGecko || isOpera );
}
}
function readIEVer()
{
var agent = navigator.userAgent;
var offset = agent.indexOf( "MSIE" );
if( offset < 0 )
{
return 0;
}
return parseFloat( agent.substring( offset + 5, agent.indexOf( ";", offset ) ) );
}
function readOperaVer()
{
var agent = navigator.userAgent;
var offset = agent.indexOf( "Opera" );
if( offset < 0 )
{
return 0;
}
return parseFloat( agent.substring( offset + 6 ) );
}
// Seek nested NN4 layer from string name
function seekLayer(doc, name)
{
var theObj;
for (var i = 0; i < doc.layers.length; i++)
{
if (doc.layers[i].name == name)
{
theObj = doc.layers[i];
break;
}
// dive into nested layers if necessary
if (doc.layers[i].document.layers.length > 0)
{
theObj = seekLayer(document.layers[i].document, name);
}
}
return theObj;
}
//
// montage.js
//
var monImg = null;
var monAlt = null;
var monLnk = null;
var monIdx = 0;
function montageEffects()
{
var container = document.getElementById("container");
var html = "";
// simple case where there's only one thing in the rotation... and no transitions
if( monImg.length <= 1 )
{
container.innerHTML = html;
return;
}
// run the transition
if( readIEVer() >= 4.0 )
{
container.style.filter = "blendTrans(duration=2) revealTrans(duration=1.5,transition=5)";
container.filters(0).apply();
container.filters(1).apply();
container.innerHTML = html;
container.filters(0).play();
container.filters(1).play();
}
else
{
container.innerHTML = html;
}
// asked to be called again in 7 seconds
setTimeout( "montageSwap()", 7000 );
}
function montageSwap()
{
if( monImg[monIdx].complete )
{
// move the image index along
monIdx = (monIdx + 1) % monImg.length;
montageEffects();
}
else
{
// check again 3 seconds
setTimeout( "montageSwap()", 3000 );
}
}
function montage( href, src, caption, width )
{
// this is the case for browsers that don't support filters...
var cycle = Math.floor( Math.random() * href.length );
if( typeof(document.body) == "undefined" || typeof(document.body.innerHTML) == "undefined" )
{
picker( href, src, caption, cycle );
return;
}
if( isIE4 || isW3C )
{
monLnk = href;
monImg = new Array( src.length );
monAlt = caption;
// get just the first image right now...
img = new Image( width );
// pick a random image to start from
monIdx = cycle;
img.src = src[monIdx];
img.border = 0;
monImg[monIdx] = img;
// set up a placeholder
document.write( "