var image;
var promo;
var glass;
var touch;

var images = new Object();
images.promo = new Image();
images.promo.src = '/bs-graphics/commercial/portfolio/miracle_promo/pic1.jpg';
images.glass = new Image();
images.glass.src = '/bs-graphics/commercial/portfolio/miracle_glass/pic1.jpg';
images.touch = new Image();
images.touch.src = '/bs-graphics/commercial/portfolio/miracle_touch/pic1.jpg';

function setPage(){
	image = document.getElementById('image');
	promo = document.getElementById('folder_promo');
	glass = document.getElementById('folder_glass');
	touch = document.getElementById('folder_touch');

//	image.style.visibility = 'hidden';
	
	if(my_isIE){
//		promo.firstChild.style.visibility = 'hidden';
//		glass.firstChild.style.visibility = 'hidden';
//		touch.firstChild.style.visibility = 'hidden';

		promo.attachEvent('onmouseover', handleLogo);
		glass.attachEvent('onmouseover', handleLogo);
		touch.attachEvent('onmouseover', handleLogo);
		promo.attachEvent('onmouseout', handleLogo);
		glass.attachEvent('onmouseout', handleLogo);
		touch.attachEvent('onmouseout', handleLogo);

		
		promo.firstChild.attachEvent('onmouseover', handleLogo);
		glass.firstChild.attachEvent('onmouseover', handleLogo);
		touch.firstChild.attachEvent('onmouseover', handleLogo);
		promo.firstChild.attachEvent('onmouseout', handleLogo);
		glass.firstChild.attachEvent('onmouseout', handleLogo);
		touch.firstChild.attachEvent('onmouseout', handleLogo);
		
	}else{
//		promo.firstChild.nextSibling.style.visibility = 'hidden';
//		glass.firstChild.nextSibling.style.visibility = 'hidden';
//		touch.firstChild.nextSibling.style.visibility = 'hidden';
		
		promo.addEventListener('mouseover', handleLogo, false);
		glass.addEventListener('mouseover', handleLogo, false);
		touch.addEventListener('mouseover', handleLogo, false);
		promo.addEventListener('mouseout', handleLogo, false);
		glass.addEventListener('mouseout', handleLogo, false);
		touch.addEventListener('mouseout', handleLogo, false);
		
		
		promo.firstChild.nextSibling.addEventListener('mouseover', handleLogo, false);
		glass.firstChild.nextSibling.addEventListener('mouseover', handleLogo, false);
		touch.firstChild.nextSibling.addEventListener('mouseover', handleLogo, false);
		promo.firstChild.nextSibling.addEventListener('mouseout', handleLogo, false);
		glass.firstChild.nextSibling.addEventListener('mouseout', handleLogo, false);
		touch.firstChild.nextSibling.addEventListener('mouseout', handleLogo, false);	
	}

	promo.style.cursor = 'pointer';
	glass.style.cursor = 'pointer';
	touch.style.cursor = 'pointer';
}

function handleLogo(_event){
	var element = window.event ? window.event.srcElement : _event.target;
	var event = window.event ? window.event : _event;
	if(element.tagName == 'DIV'){
		if(my_isIE){
			var logo = element.firstChild;
		}else{
			var logo = element.firstChild.nextSibling;
		}
	}else{
		var logo = element;
	}
	if(logo.style.visibility == 'visible'){
		//logo.style.visibility = 'hidden';
	}else{
		logo.style.visibility = 'visible';
	}
	if(event.type == 'mouseover' || event.type == 'onmouseover'){
		//image.style.visibility = 'visible';
		switch(element.id){
			case 'folder_promo':
				image.src = images.promo.src;
				break;
			case 'folder_glass':
				image.src = images.glass.src;
				break;
			case 'folder_touch':
				image.src = images.touch.src;
				break;
		}
	}else{
	}

}

document.observe('dom:loaded', setPage);
