﻿//------------------------------
//   DrUGS Team shOwit
//------------------------------

function dTshOwit(picFront,picBack,slideSpeed,fadeSpeed,fadeStep) {
 imgs = new Array(); dir = 'imgs/';
 imgs[0]  = dir +'head_black.jpg';
 imgs[1]  = dir +'head_blackkarmann.jpg';
 imgs[2]  = dir +'head_bluekarmann.jpg';
 imgs[3]  = dir +'head_drappkarmann.jpg';
 imgs[4]  = dir +'head_hubcap.jpg';
 imgs[5]  = dir +'head_hubcap2.jpg';
 imgs[6]  = dir +'head_karmanncabrio.jpg';
 imgs[7]  = dir +'head_lastblueback.jpg';
 imgs[8]  = dir +'head_lastbluefront.jpg';
 imgs[9]  = dir +'head_lastinside.jpg';
 imgs[10] = dir +'head_lastwhitefront.jpg';
 imgs[11] = dir +'head_lastwhiteside.jpg';
 imgs[12] = dir +'head_lovebus.jpg';
 imgs[13] = dir +'head_redback.jpg';
 imgs[14] = dir +'head_redcabrio.jpg';
 imgs[15] = dir +'head_roadster.jpg';
 imgs[16] = dir +'head_rometsch.jpg';
 imgs[17] = dir +'head_sambaback.jpg';
 imgs[18] = dir +'head_sambafront.jpg';
 imgs[19] = dir +'head_yellowsp.jpg';
 d = document;
 i = 100;
 sSpeed = slideSpeed;
 fSpeed = fadeSpeed;
 fStep  = fadeStep;
 pFront = picFront;
 pBack  = picBack;
 rnd1   = Math.floor(Math.random()*imgs.length)
 d.getElementById(pFront).style.opacity = 1;
 d.getElementById(pFront).style.filter  = 'alpha(opacity=100)';
 dTrunFadeshow();
}

function dTsurelyRandom() {
 rnd2=Math.floor(Math.random()*imgs.length)
 if (rnd1==rnd2) dTsurelyRandom();
 rnd1=rnd2;
}

function dTrunFadeshow() {
 dTsurelyRandom();
 if (d.getElementById(pFront).style.opacity==1) {
  d.getElementById(pBack).style.background = 'url('+imgs[rnd2]+')';
  dTfadeOff(); 
 }
 if (d.getElementById(pFront).style.opacity==0) {
  d.getElementById(pFront).src = imgs[rnd2];
  dTfadeOn();
 }
 setTimeout('dTrunFadeshow()', sSpeed);
}

function dTfadeOff() {
 i = i-fStep;
 d.getElementById(pFront).style.opacity = i/100;
 d.getElementById(pFront).style.filter  = 'alpha(opacity='+i+')';
 if (i!=0) setTimeout('dTfadeOff()', fSpeed);
}

function dTfadeOn() {
 i = i+fStep;
 d.getElementById(pFront).style.opacity = i/100;
 d.getElementById(pFront).style.filter  = 'alpha(opacity='+i+')';
 if (i!=100) setTimeout('dTfadeOn()', fSpeed);
}
