// JavaScript Document
var index=1;
var div=true;
var numpictures=3;
var started=false;
function openwindow (foto){		
		var pic = new Image();
		pic.src = "images/products/"+foto+".png"
		window.open('image.php?p='+foto, 'dEcoPackaging', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width='+pic.width+',height='+pic.height+'');
	}

function headshow (){
	var transparency = 0
	if(!started){
		started=true;
		down = document.getElementById("headdiv1");
		down.src = "images/head2.png";
		down.style.opacity = transparency/100;
		down.style.filter = "alpha(opacity=" + transparency +")";
		return setTimeout("headshow()",7500);
	}
	index = index + 1;
	if (index > numpictures){
		index = 1;
	}
	if (div){
		var top = document.getElementById("headdiv0");
		var down = document.getElementById("headdiv1");
		div = false;
	}
	else {
		var down = document.getElementById("headdiv0");
		var top = document.getElementById("headdiv1");
		div = true;
	}
	down.src = "images/head" + index + ".png";
	interval = setInterval("adjust()",50);
	this.adjust = function (){
		transparency = transparency + 5;
		topacity = (100 - transparency)/100;
		opacityAsInt = 100 - transparency;
		top.style.opacity = topacity;
		down.style.opacity = transparency;
		top.style.opacity = (topacity);
		top.style.filter  = "alpha(opacity=" + opacityAsInt + ")";
		down.style.opacity = transparency/100;
		down.style.filter = "alpha(opacity=" + transparency +")";
		if (transparency == 100){
			clearInterval(interval);
		}
	}
	return setTimeout("headshow()",7500);
}
function showpic(id) {
	document.getElementById('picfront').src = "/";
	document.getElementById('picfront').src = id;
	document.getElementById('picbg').style.display = 'block';
}
			
