function elem(aim){
	return document.getElementById(aim);
}
function top_change(num){
        if (num>td_max_num)num=0;
        if (num<0)num=td_max_num;
        cur_td_num=num;
        try
        {
        imgObj.filters[0].apply();
        }
        catch(err)
        {
        }
        elem('top_img').src='http://www.chilenos.ru'+top_news[num]['pic_file'];
        elem('top_header').innerHTML=top_news[num]['mark'];
        elem('top_short').innerHTML=top_news[num]['model'];
        if (elem('top_short').innerHTML=='')elem('top_short').style.display='none';
		else elem('top_short').style.display='block';
		if (top_news[num]['url']){
        elem('top_link').href=top_news[num]['url'];
        elem('top_link2').href=top_news[num]['url'];
		} else {
				if (top_news[num]['sufix']){
				elem('top_link').href='http://www.chilenos.ru/noticia_'+top_news[num]['sufix']+'.htm';
				elem('top_link2').href='http://www.chilenos.ru/noticia_'+top_news[num]['sufix']+'.htm';
				} else {
				elem('top_link').href='http://www.chilenos.ru/noticia_'+top_news[num]['article_id']+'.htm';
				elem('top_link2').href='http://www.chilenos.ru/noticia_'+top_news[num]['article_id']+'.htm';
				}
		}
        imgObj.filters[0].play();
}
function next_top(){
        top_change(cur_td_num-1);
		fnStopInterval();
}
function prev_top(){
        top_change(cur_td_num+1);
		fnStopInterval();
}
function fnStartInterval(){
	elem('playpause').src='http://www.chilenos.ru/i/bt_pause.gif';
	elem('playpauselink').href='javascript:fnStopInterval()';
	top_change(cur_td_num-1);
	if(oInterval==""){
		oInterval=window.setInterval("top_change(cur_td_num-1)",18000);
	}
	else{
		fnStopInterval();
	}
}
function fnStopInterval(){
		elem('playpause').src='http://www.chilenos.ru/i/bt_play.gif';
		elem('playpauselink').href='javascript:fnStartInterval()';
	if(oInterval!=""){
		window.clearInterval(oInterval);
		oInterval="";
	}
}
window.onload = function ultimominuto(){
	var enlaces = ' <div align="left" class="pad1">Enlaces</div> <div align="center" class="pad12"><a href="http://www.aquamater.ru" title="AquaMater" target="_blank"><img src="/images/aquamater.jpg" border="0" alt="Aquamater"></a></div> <div class="shadow"></div>';
	elem('enlaces').innerHTML=enlaces;
}

function show_hint(texta){
        sp_hint.style.posLeft=event.clientX+10+document.body.scrollLeft;
        sp_hint.style.posTop=event.clientY+4+document.body.scrollTop;
        sp_hint2.style.posLeft=event.clientX+12+document.body.scrollLeft;
        sp_hint2.style.posTop=event.clientY+6+document.body.scrollTop;
        sp_hint.innerHTML=texta;
        sp_hint2.innerHTML=texta;
        sp_hint.style.visibility="visible";
        sp_hint2.style.visibility="visible";
}
function hide_hint(){
        sp_hint.style.visibility="hidden";
        sp_hint.style.posLeft=0;
        sp_hint.style.posTop=0;
        sp_hint.innerHTML='';
        sp_hint2.style.visibility="hidden";
        sp_hint2.style.posLeft=0;
        sp_hint2.style.posTop=0;
        sp_hint2.innerHTML='';
}