function telefon(telefondiv, div_height,max_count,speed,count)
{
	telefondiv.onmouseover= null;
	if (count <= max_count){
	window.setTimeout(function(){telefondiv.style.backgroundPosition ='0 0px';},0);
	window.setTimeout(function(){telefondiv.style.backgroundPosition ='0 -'+(div_height)+'px';},speed);
	window.setTimeout(function(){telefondiv.style.backgroundPosition ='0 -'+(2*div_height)+'px';},2*speed);
	window.setTimeout(function(){telefon(telefondiv,div_height,max_count,speed,count + 1)},3*speed);
	}
	else
	{
		telefondiv.style.backgroundPosition ='0 0px'
		telefondiv.onmouseover=function(){telefon(telefondiv, div_height,max_count,speed,0)};
	}
	
}


function telefon_init(div_id, pdiv_id, div_background,div_left, div_top, div_width, div_height,max_count,speed)
{
	var telefondiv = document.createElement('div');
	telefondiv.setAttribute('id', div_id);
	telefondiv.style.background =  'url('+div_background+') no-repeat 0 0px';
	telefondiv.style.zIndex = '5';
	if (div_top!=0)
		telefondiv.style.top = div_top;
	if (div_left!=0)
		telefondiv.style.left = div_left;
	telefondiv.style.width = div_width+'px';
	telefondiv.style.height = div_height+'px';
	if (pdiv_id!='')
	{
		ddd=document.getElementById(pdiv_id);
		ddd.appendChild(telefondiv);
	}
	else
	{
		telefondiv.style.position= 'absolute';
		document.body.appendChild(telefondiv);
	}
	telefondiv.onmouseover = function(){telefon(telefondiv, div_height,max_count,speed,0)};
}
function start_telefon(){
		telefon_init('telefon_bottom','div_phone2', '/scripts/telefon/s2.png', 0, 0, 49, 40,10,50);
	telefon_init('lamp','div_lamp', '/scripts/telefon/light.png', 0, 0, 26, 50,10,60);
	telefon_init('cart','cart_div', '/scripts/telefon/cart.png', 0, 0, 52, 33,10,60);
}
