// ISF1.11 :: Image swap-fade // ***************************************************** // DOM scripting by brothercake -- http://www.brothercake.com/ //****************************************************** //global object var isf = { 'clock' : null, 'fade' : true, 'count' : 0.099999, 'getDom' : ''} /******************************************************* /***************************************************************************** List the images that need to be cached *****************************************************************************/ isf.imgs = [ "./images/mouseover/img_0_0_0.jpg", "./images/mouseover/img_1_0_0.jpg", "./images/mouseover/img_2_0_0.jpg", "./images/mouseover/img_3_0_0.jpg", "./images/mouseover/img_4_0_0.jpg", "./images/mouseover/img_5_0_0.jpg", "./images/mouseover/img_6_0_0.jpg", "./images/mouseover/img_7_0_0.jpg", ]; /***************************************************************************** *****************************************************************************/ //cache the images isf.imgsLen = isf.imgs.length; isf.cache = []; for(var i=0; i 0 && typeof isf.obj.filters.alpha == 'object' && typeof isf.obj.filters.alpha.opacity == 'number') ? 'ie' : 'none'; } else { isf.type = 'none'; } //change the image alt text if defined if(typeof arguments[3] != 'undefined' && arguments[3] != '') { isf.obj.alt = arguments[3]; } //if any kind of opacity is supported if(isf.type != 'none') { //copy and convert fade duration argument //the duration specifies the whole transition //but the swapfade is two distinct transitions isf.length = parseInt(arguments[2], 10) * 150; //create fade resolution argument as 20 steps per transition //again, split for the two distrinct transitions isf.resolution = parseInt(arguments[2], 10) * 3; //start the timer var string_1 = findString("img", ".jpg", isf.src); var string_2 = findString("img", ".jpg", isf.obj.src); if (string_1 != string_2) { isf.clock = setInterval('isf.swapfade()', isf.length/isf.resolution); isf.count = 0.099999; //newDOM = document.getElementById('theslide'); //stringb = findString('%68%61%6E%64%6C%65%4F%76%65%72%28', '%29', pillatt); //if (stringa != stringb) { //} //document.write(stringa); } } //otherwise if opacity is not supported else { //just do the image swap isf.obj.src = isf.src; } } else { //added by jvh on Sept 12 //isf.clock = null; //isf.obj.src = isf.src; isf.count = 1; //isf.src = arguments[1]; } }; //swapfade timer function isf.swapfade = function() { //increase or reduce the counter on an exponential scale isf.count = isf.count * (1/0.81); //if the counter has reached the bottom if(isf.count < (1 / isf.resolution)) { //clear the timer clearInterval(isf.clock); isf.clock = null; //do the image swap isf.obj.src = isf.src; //reverse the fade direction flag isf.fade = false; //restart the timer isf.clock = setInterval('isf.swapfade()', isf.length/isf.resolution); } //if the counter has reached the top if(isf.count > (1 - (1 / isf.resolution))) { //clear the timer clearInterval(isf.clock); isf.clock = null; //reset the fade direction flag isf.fade = true; //reset the counter isf.count = 1; var maincmp = getCmpString(1); var seccmp = getCmpString(2); var thcmp = getCmpString(3); //alert(getCmpString(3)); //alert(stringa); // Handle main menu and list items //if (maincmp != globid && (aboutrace == 0 || servicerace == 0 || toolrace == 0)) { if (maincmp != globid && (service == 0 && tool == 0)) { swapfade(document.getElementById('theslide'), './images/mouseover/img_'+globid+'_0_0.jpg', '1'); } else if (race == 0 && globid != 7 && seccmp != globid && (service != 0 && tool == 0)) { swapfade(document.getElementById('theslide'), './images/mouseover/img_'+industry+'_'+globid+'_0.jpg', '1'); } else if (race != 1 && race != 2 && maincmp != 0 && seccmp != 0 && thcmp != 0 && globid != 7 && thcmp != globid && (service != 0 && tool != 0)) { swapfade(document.getElementById('theslide'), './images/mouseover/img_'+industry+'_'+service+'_'+globid+'.jpg', '1'); } //} else { // Handle location pills and about box if (race == 3 && globid == 7 && industry != 0) { race = 0; swapfade(document.getElementById('theslide'), './images/mouseover/img_7_0_0.jpg', '1'); } if (race == 1 && seccmp != globid && service != 0) { swapfade(document.getElementById('theslide'), './images/mouseover/img_'+industry+'_0_0.jpg', '1'); } if (race == 2 && (thcmp != 0 || seccmp != service) && (service != 0 && tool != 0)) { swapfade(document.getElementById('theslide'), './images/mouseover/img_'+industry+'_'+service+'_0.jpg', '1'); } if (race == 4 && seccmp == 0) { swapfade(document.getElementById('theslide'), './images/mouseover/img_0_0_0.jpg', '1'); } //alert (maincmp); race = 0; //} } //set new opacity value on element //using whatever method is supported switch(isf.type) { case 'ie' : isf.obj.filters.alpha.opacity = isf.count * 100; break; case 'khtml' : isf.obj.style.KhtmlOpacity = isf.count; break; case 'moz' : //restrict max opacity to prevent a visual popping effect in firefox isf.obj.style.MozOpacity = (isf.count == 1 ? 0.9999999 : isf.count); break; default : //restrict max opacity to prevent a visual popping effect in firefox isf.obj.style.opacity = (isf.count == 1 ? 0.9999999 : isf.count); } };