// JavaScript Document /* a few concepts were taken form: http://brainerror.net/scripts/javascript/blendtrans/ */ var timerID = new Array(); var which = 0; var which_2 = 0; var which_3 = 0; var which_4 = 0; var loop = 1; var rotate_time = 2000; function start() { if(loop == 1){ which += 1; if(which > 4 ) { which = 1; } blendimage('greg_div', 'greg_img', 'greg',rotate_time, which); //rob blendimage('rob_div', 'rob_img', 'rob', rotate_time, which); //blendimage('geoff_div', 'geoff_img', 'geoff',rotate_time, which); //blendimage('chelsea_div', 'chelsea_img', 'chelsea', rotate_time, which); } else if(loop == 2){ which_2 += 1; if(which_2 > 4 ) { which_2 = 1; } blendimage('amy_div', 'amy_img', 'amy', rotate_time, which_2); //chelsea blendimage('chelsea_div', 'chelsea_img', 'chelsea', rotate_time, which_2); //blendimage('laura_div', 'laura_img', 'laura', rotate_time, which_2); } else if(loop == 3){ which_3 += 1; if(which_3 > 4 ) { which_3 = 1; } blendimage('traci_div', 'traci_img', 'traci', rotate_time, which_3); //dana blendimage('dana_div', 'dana_img', 'dana', rotate_time, which_3); //blendimage('ray_div', 'ray_img', 'ray', rotate_time, which_3); //blendimage('rob_div', 'rob_img', 'rob', rotate_time, which_3); } //not used else if(loop == 4){ which_4 += 1; if(which_4 > 4 ) { which_4 = 1; } blendimage('rob_div', 'rob_img', 'rob', rotate_time, which_4); //blendimage('dana_div', 'dana_img', 'dana', rotate_time, which_4); //blendimage('reed_div', 'reed_img', 'reed', rotate_time, which_4); } loop += 1; if(loop > 3 ) { loop = 1; } timerID = setTimeout('start()', rotate_time); } /** ###################################################################### **/ function blendimage(divid, imageid, imagefolder, rotate_time, count) { var speed = Math.round(rotate_time / 150); var timer = 0; var timer_id = null; //fade in image for(i = 100; i >= 0; i--) { timer_id = setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed)); timer++; if(i == 0) { clearTimeout(timer_id); //switch background to the top image imagefile = 'http://www.bethelcollege.edu/blogs/custom/images/home/rotate/'+imagefolder+'/'+count+'.jpg'; document.getElementById(imageid).src = imagefile; //set opac to 100 for image changeOpac(100, imageid); //set new background count++; if(count > 4){ count = 1; } bg_image = 'http://www.bethelcollege.edu/blogs/custom/images/home/rotate/'+imagefolder+'/'+count+'.jpg'; document.getElementById(divid).style.background = " url('"+bg_image + "') 5px 5px no-repeat"; } } } //change the opacity for different browsers function changeOpac(opacity, id) { var object = document.getElementById(id).style; object.opacity = (opacity / 100); object.MozOpacity = (opacity / 100); object.KhtmlOpacity = (opacity / 100); object.filter = "alpha(opacity=" + opacity + ")"; } /**************************************/ /***************/ window.onload = function () { start(); }