// www.ctemag.com/adtest/adMatrix.js 
// Revised TUE 06/02/08 @ 06:00am by ch - Removed Makino from the ad rotation - 2 ads now in leaderboard
// Revised SUN 06/15/08 @ 06:00am by ch - Removed Amamco from the ad rotation - 1 ad now in leaderboard
// Revised MON 07/07/08 @ 10:00am by ch - Back on AD box re-activated amamco.gif ad
// Revised FRI 08/01/08 @ 04:00am by ch - micromanfall.jpg = only ad in leaderboard positon
// Revised MON 08/25/08 @ 10:30am by ch - sandvik_imts.jpg becomes sole ad in leaderboard ( backup = _v02 )
// Revised FRI 10/03/08 @ 05:00am by ch - amamco1008.jpg becomes sole ad in leaderboard ( backup = _v03 )
// Revised SUN 12/07/08 @ 02:00am by ch - house ad "Winter 2008(?) edition" := exclusive leaderboard ad per Dennis

// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 12000;
// Duration of crossfade (seconds)
var crossFadeDuration = 3;
// Specify the image files
var Pic = new Array();
// Pic[1] = 'kennametal.gif'
Pic[0] = 'cteWinter.jpg'
// Pic[0] = 'sandvik_imts.jpg'
// Pic[2] = 'amamco.gif'
// Pic[3] = 'leaderboard04.gif'
// Pic[4] = 'leaderboard05.jpg'
var Pic2 = new Array();
Pic2[0] = 'micro_writers_needed_2.jpg'
Pic2[1] = 'ctead_2.jpg'
// Pic2[2] = 'skyscraper03.jpg'
// Pic2[3] = 'skyscraper04.jpg'
// Pic2[4] = 'skyscraper05.jpg'

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();
}
document.images.SlideShow.src = preLoad[j].src;
if (document.all) {
document.images.SlideShow.filters.blendTrans.Play();
}
j = j + 1;
if (j > (p - 1)) j = 0;
t = setTimeout('runSlideShow()', slideShowSpeed);
changeLink(j);
}

function runSlideShow2() {
if (document.all) {
document.images.SlideShow2.style.filter="blendTrans(duration=2)";
document.images.SlideShow2.style.filter="blendTrans(duration=crossFadeDuration)";
document.images.SlideShow2.filters.blendTrans.Apply();
}
document.images.SlideShow2.src = preLoad2[j].src;
if (document.all) {
document.images.SlideShow2.filters.blendTrans.Play();
}
j = j + 1;
if (j > (p - 1)) j = 0;
t = setTimeout('runSlideShow2()', slideShowSpeed);
}


var tX;
var tX2;

var slideShowSpeed = 12000;
// Set slideShowSpeed for SlideShow2 (milliseconds : 1000 milliseconds = 1 second)
var slideShowSpeed2 = 12000;
// Set slideShowSpeed for SlideShow3 (milliseconds)

function runSlideShowX() {
if (document.all) {
document.images.SlideShow2.style.filter="blendTrans(duration=2)";
document.images.SlideShow2.style.filter="blendTrans(duration=crossFadeDuration)";
document.images.SlideShow2.filters.blendTrans.Apply();
document.images.SlideShow.style.filter="blendTrans(duration=2)";
document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";
document.images.SlideShow.filters.blendTrans.Apply();
}
document.images.SlideShow2.src = preLoad2[j].src;
document.images.SlideShow.src = preLoad[j].src;

if (document.all) {
document.images.SlideShow2.filters.blendTrans.Play();
document.images.SlideShow.filters.blendTrans.Play();
// changeLink();

}
j = j + 1;
if (j > (p - 1)) j = 0;
tX = setTimeout('runSlideShow2()', slideShowSpeed2);
tX2 = setTimeout('runSlideShow()', slideShowSpeed);
// changeLink();
}


var preLoad2 = new Array();
for (i = 0; i < p; i++) {
preLoad2[i] = new Image();
preLoad2[i].src = Pic2[i];
}

function changeLink(j)
// GA 2.0 tracking is not yet functional
// OpenAds 2.4.2 tracking is more important at this point - 12/30/07 - ch
// Revised SUN 03/09/08 @ 04:00am by ch - force j to change based on time to randomize
// attempt to randomize using getTime(0 not working / set back to orig until why determined
// zeit = getTime();
// modulusZeit = (zeit % 2);
// if (modulusZeit == 0) {
//   j = 0;
// } else {
//   j = 1;
// }

{
// as of SUN 12/07/08 only 1 ad, a house ad creWinter.jpg has exclusive leaderboard position - ch
/*if (j == 2) {
// removed TUE 06/02/08
// THU 05/01/08 @ 03:00pm by ch - made Makino ad second in rotation
var oa_m3_r = Math.floor(Math.random() * 99999999999);
document.getElementById('myAnchor').href="http://www.ctemag.com/admin/ads/www/delivery/ck.php?oaparams=2__bannerid=20__zoneid=2__cb=" + oa_m3_r + "__maxdest=http://clk.atdmt.com/CSH/go/cttngmak0030000003csh/direct/01/";
document.getElementById('lg').src='http://www.ctemag.com/admin/ads/www/delivery/lg.php?bannerid=20&campaignid=25&zoneid=2&cb=' + oa_m3_r + "'";
}
*/

/*
if (j == 0) {
// SUN 06/15/08 @ 06:00am by ch - new ad for Kennametal, exclusive in leaderboard position
var oa_m3_r = Math.floor(Math.random() * 99999999999);
document.getElementById('myAnchor').href="http://www.ctemag.com/admin/ads/www/delivery/ck.php?oaparams=2__bannerid=21__zoneid=2__cb=" + oa_m3_r + "__maxdest=http://www.kennametal.com/konnect";
document.getElementById('lg').src='http://www.ctemag.com/admin/ads/www/delivery/lg.php?bannerid=21&campaignid=27&zoneid=2&cb=' + oa_m3_r + "'";
}
*/

// sandvik_imts.jpg := exclusive leaderboard ad MON 08/25/08 @ 11:00am by ch per Dennis
/*
if (j == 0) {
// FRI 08/01/08 @ 04:00am by ch - new ad for Micromanufacturing, exclusive in leaderboard position
var oa_m3_r = Math.floor(Math.random() * 99999999999);
document.getElementById('myAnchor').href="http://www.ctemag.com/admin/ads/www/delivery/ck.php?oaparams=2__bannerid=17__zoneid=2__cb=" + oa_m3_r + "__maxdest=http://www.coromant.sandvik.com/us";
document.getElementById('lg').src='http://www.ctemag.com/admin/ads/www/delivery/lg.php?bannerid=17&campaignid=24&zoneid=2&cb=' + oa_m3_r + "'";
}
*/

/* - taken down MON 08/25/08 - ch
if (j == 0) {
// FRI 08/01/08 @ 04:00am by ch - new ad for Micromanufacturing, exclusive in leaderboard position
var oa_m3_r = Math.floor(Math.random() * 99999999999);
document.getElementById('myAnchor').href="http://www.ctemag.com/admin/ads/www/delivery/ck.php?oaparams=2__bannerid=8__zoneid=2__cb=" + oa_m3_r + "__maxdest=http://www.micromanufacturing.com/register.php";
document.getElementById('lg').src='http://www.ctemag.com/admin/ads/www/delivery/lg.php?bannerid=8&campaignid=12&zoneid=2&cb=' + oa_m3_r + "'";
}
*/

// Revised MON 07/07/08 @ 10:00am by ch - reactivated amamco.gif ad
// Revised FRI 10/03/08 @ 05:00am by ch - activated amamco1008.jpg (pulled from OA)
if (j == 1) {
// house ad for MicroManufacturing -> as of SUN 12/07.08 - ch
var oa_m3_r = Math.floor(Math.random() * 99999999999);
document.getElementById('myAnchor').href="http://www.ctemag.com/admin/ads/www/delivery/ck.php?oaparams=2__bannerid=24__zoneid=2__cb=" + oa_m3_r + "__maxdest=http://www.micromanufacturing.com/past_editions/pdf/Winter08.pdf";
document.getElementById('lg').src='http://www.ctemag.com/admin/ads/www/delivery/lg.php?bannerid=25&campaignid=12&zoneid=2&cb=' + oa_m3_r + "'";
}

/*
if (j == 3) {
document.getElementById('myAnchor').href="http://www.iscar.com/";
document.getElementById('myAnchor').href="http://www.ctemag.com/admin/ads/www/delivery/ck.php?oaparams=2__bannerid=7__zoneid=2__cb=2345678901__maxdest=http://iscar.com";
// document.getElementById('myAnchor').onclick="javascript:urchinTracker('/bannerads/iscar');";
}
if (j == 4) {
document.getElementById('myAnchor').href="http://www.moriseiki.com/";
document.getElementById('myAnchor').href="http://www.ctemag.com/admin/ads/www/delivery/ck.php?oaparams=2__bannerid=1__zoneid=2__cb=3456789012__maxdest=http://www.moriseiki.com/";
document.getElementById('myAnchor').onclick="javascript:urchinTracker('/bannerads/moriseiki');";
}
if (j == 1) {
// ad for www.coromant.sandvik.com
var oa_m3_r = Math.floor(Math.random() * 99999999999);
document.getElementById('myAnchor').href="http://www.ctemag.com/admin/ads/www/delivery/ck.php?oaparams=2__bannerid=17__zoneid=2__cb=" + oa_m3_r + "__maxdest=http://www.coromant.sandvik.com/us";
document.getElementById('lg').src='http://www.ctemag.com/admin/ads/www/delivery/lg.php?bannerid=17&campaignid=24&zoneid=2&cb=' + oa_m3_r + "'";
}
*/


}
