// JavaScript Document
var tmrProductImages;
var tmrScrollImages;
var divBanner = 'bnr_promo';
var scrollDelay = 10000;

function preloadProductImages(){
	MM_preloadImages('/images/products_head_tam.jpg', '/images/products_head_vision.jpg', '/images/products_head_doris.jpg', '/images/home/bnr_tam.jpg', '/images/home/bnr_vision.jpg', '/images/home/bnr_doris.jpg');
}
function assignEvents(){
	tmrScrollImages = setTimeout('scrollPromo()', scrollDelay);
	oDiv = document.getElementById('productImages');
	if (oDiv) {
		oDiv.onmouseover = function(){ clearTimeout(tmrProductImages); clearTimeout(tmrScrollImages);  };
		oDiv.onmouseout = function(){startBannerTimer();};
	}
	
	/*
	oDiv = document.getElementById('productImages');
	if (oDiv) {
		oDiv.onmouseover = function(){ clearTimeout(tmrProductImages); };
		oDiv.onmouseout = function(){startBannerTimer();};
	}
	*/
}
function scrollPromo(){
	oDiv = document.getElementById('productImages');
	if (oDiv) {
		switch(divBanner){
			case 'bnr_promo':
				selectBanner('bnr_home');
				break;
			case 'bnr_home':
				selectBanner('bnr_tam');
				break;
			case 'bnr_tam':
				selectBanner('bnr_vision');
				break;
			case 'bnr_vision':
				selectBanner('bnr_doris');
				break;
			case 'bnr_doris':
				selectBanner('bnr_promo');
				break;
		}
	}
}
function selectBanner(sDiv){
	divBanner = sDiv;
	hideDivs();
	show(sDiv);
	clearLinkHovers();
	oLinkDiv = document.getElementById(sDiv.replace('bnr_', ''));
	if ( oLinkDiv ) oLinkDiv.firstChild.src = oLinkDiv.firstChild.src.replace('.jpg', '_ovr.jpg');
	tmrScrollImages = setTimeout('scrollPromo()', scrollDelay);
}
function startBannerTimer(){
	//tmrProductImages = setTimeout('resetPromo()', 5000);
	tmrScrollImages = setTimeout('scrollPromo()', scrollDelay);
} 
function resetPromo(){
	clearTimeout(tmrProductImages);
	clearLinkHovers();
	hideDivs();
	show('bnr_promo');
}
function mOver(oLink){
	clearLinkHovers();
	oLink.firstChild.src = oLink.firstChild.src.replace('.jpg', '_ovr.jpg');
	hideDivs();
	show('bnr_' + oLink.id);
}
function btnOver(oLink){
	oLink.firstChild.src = oLink.firstChild.src.replace('-init.jpg', '-over.jpg');
}
function btnOut(oLink){
	oLink.firstChild.src = oLink.firstChild.src.replace('-over.jpg', '-init.jpg');
}
function hideDivs(){
	hide('bnr_promo');
	hide('bnr_home');
	hide('bnr_tam');
	hide('bnr_tamonline');
	hide('bnr_vision');
	hide('bnr_doris');
}
function hide(sDiv){
	if (document.getElementById(sDiv)) document.getElementById(sDiv).style.display = 'none';
}
function show(sDiv){
	if (document.getElementById(sDiv)) document.getElementById(sDiv).style.display = 'inline';
}
function clearLinkHovers(){
	if ( document.getElementById('home') ) document.getElementById('home').firstChild.src = document.getElementById('home').firstChild.src.replace('_ovr.jpg', '.jpg');
	if ( document.getElementById('tam') ) document.getElementById('tam').firstChild.src = document.getElementById('tam').firstChild.src.replace('_ovr.jpg', '.jpg');
	if ( document.getElementById('tamonline') ) document.getElementById('tamonline').firstChild.src = document.getElementById('tamonline').firstChild.src.replace('_ovr.jpg', '.jpg');
	if ( document.getElementById('vision') ) document.getElementById('vision').firstChild.src = document.getElementById('vision').firstChild.src.replace('_ovr.jpg', '.jpg');
	if ( document.getElementById('doris') ) document.getElementById('doris').firstChild.src = document.getElementById('doris').firstChild.src.replace('_ovr.jpg', '.jpg');
}
function clearHovers(){
	clearLinkHovers();
	document.getElementById('desc').firstChild.src = '/images/products_home.jpg';
}
window.onload=function(){
// assignEvents();
 P7_ExpMenu();
}
