/////////////////////////////////////////////////////////////////////////////
//                                                                         //
//                     rollover.js - V1.2, 11.12.2000                      //
//                                                                         //
//                        Final Release wwwcg00                            //
//                                                                         //
//                  Funktioniert mit IE >=4 und NN >=4                     //
//                                                                         //
//                    www Deutscher Tele Markt GmbH                        //
/////////////////////////////////////////////////////////////////////////////

var STAY=-1;
var imgCount=0;

function createArrays()
{

	IMG_SRC= new Array ();
	IMG_ROLL= new Array ();

	if (document.images)
	{
	i=0;j=0;
	while (document.images[i])
		{
			var stX=document.images[i].src;
			var stA=document.images[i].name;
			if (stA.indexOf("but") != -1)
			{
			imgCount++;
			IMG_SRC[j]=stX;
			reg=/(\.[a-zA-Z]+)$/;
			reg.exec(stX);
			stY = stX.replace(reg,"-1"+RegExp.$1);
			IMG_ROLL[j]=stY;
			j++;
			imgCount++;
			}
			i++;
		}
	}
preload();
}

function preload()
{


for (i=0;i<imgCount;i++)
{
	IMG_PRELOAD1= new Array ();
	IMG_PRELOAD2= new Array ();
	IMG_PRELOAD1[j]=new Image();IMG_PRELOAD1[j].src=IMG_SRC[i];
	IMG_PRELOAD2[j]=new Image();IMG_PRELOAD2[j].src=IMG_ROLL[i];
}
}


function SwitchImg()
{
  var rem, keep=0, store, obj, switcher=new Array, history=document.Data;
    for (rem=0; rem < (SwitchImg.arguments.length-1); rem+=2)
	 {
       store = SwitchImg.arguments[rem];
       if ((store.indexOf('document.layers[')==0 && document.layers==null) ||
          (store.indexOf('document.all[')==0 && document.all==null))
          store = 'document'+store.substring(store.lastIndexOf('.'),store.length);
       obj = eval(store);
       if (obj != null)
	    {
   	     switcher[keep++] = obj;
         switcher[keep++] = (history==null || history[keep-1]!=obj)?obj.src:history[keep];
         obj.src = SwitchImg.arguments[rem+1];
        }
	 }
    document.Data = switcher;
}

function RestoreImg()
{
status='';
  if (document.Data != null)
   for (var rem=0; rem<(document.Data.length-1); rem+=2)
    document.Data[rem].src=document.Data[rem+1];
}

function change(i)
{
	ch=''+i;
	SwitchImg('document.but'+ch,IMG_ROLL[i-1])
}

function stay(i)
{
	if (STAY != i)
	{
		if (STAY > -1) {SwitchImg('document.but'+eval(STAY),IMG_SRC[STAY-1])};

		SwitchImg('document.but'+eval(i),IMG_ROLL[i-1])
		STAY=i;
	}
}

