function link() {
//	(vtarget[atual]=='_blank') ? window.open(vlink[atual]) : location.href=vlink[atual];
	location.href=vlink[atual];
}
var paused = false;

function changeImage(id) {
	clearTimeout(timeoutId);
	atual+=parseInt(id);
	if(atual>vimg.length-1) atual = 0;
	if(atual<0) atual = vimg.length-1;
	if(document.all) {
		document.images.imagem.style.filter="blendTrans(duration=1)";
		document.images.imagem.filters.blendTrans.Apply();
		document.images.imagem.filters.blendTrans.Play();
	}
	document.imagem.src = imgDsp[atual].src;
	document.imagem.alt = vtxt[atual];
//	document.getElementById('texto').innerHTML = vtxt[atual];
	if(!paused)timeoutId = setTimeout("changeImage(1)",4000)
}

function startSlide() {
	timeoutId = setTimeout("changeImage(1)",10000);
}
function pausa(){
	if(paused){
		document.getElementById('pause').src='../images/bt_pause.jpg';
		document.getElementById('pause').title='Pause';
		document.getElementById('pause').alt = 'Pause';
		paused=false;
		timeoutId = setTimeout("changeImage(1)",4000);
	}else{
		clearTimeout(timeoutId);
		document.getElementById('pause').src='../images/bt_play.jpg';
		document.getElementById('pause').title='Play';
		document.getElementById('pause').alt = 'Play';
		paused = true;
	}
}
if(vtxt.length==1) document.write("<style>#anterior,#proxima{visibility:hidden}</style>"); // se só tem 1 imagem, some com proximo/anterior

//atual = Math.random().toString().substring(2,6) % vimg.length; // escolhe uma imagem inicial randomicamente
atual = 0; // escolhe a última imagem

imgDsp = new Array();
for(n=0;n<vimg.length;n++) {// pre-load das imagens
	imgDsp[n] = new Image();
	imgDsp[n].src = vimg[n];
}
timeoutId = 0;
startSlide();

document.write('<div id="destaque_foto"><a href="javascript:link()"><img src="' + vimg[atual] + '" name="imagem" border="0" width="290" heigth="290" id="link_img"></a></div>');
document.write('<div id="destaque_controle" align="right">');
document.write('<a id=anterior href="javascript:changeImage(-1)"><img src="../images/bt_prev.jpg" border="0" title="Previous"></a>');
document.write('&nbsp;');
document.write('<a href="javascript:pausa()"><img src="../images/bt_pause.jpg" width=21  height=21 border=0 title="Pause" id="pause"></a>');
document.write('&nbsp;');
document.write('<a id=proxima href="javascript:changeImage(1)"><img src="../images/bt_next.jpg" border="0" title="Next"></a>');
document.write('&nbsp;');
document.write('</div>');
