// JavaScript Document



function bg_imgRand(){
	image = [];
	number = 0;
	// imageArray
	image[number++] = "/_img/back/01.jpg"
        image[number++] = "/_img/back/02.jpg"
        image[number++] = "/_img/back/03.jpg"
        image[number++] = "/_img/back/04.jpg"
        image[number++] = "/_img/back/05.jpg"
        image[number++] = "/_img/back/06.jpg"
        image[number++] = "/_img/back/07.jpg"
        image[number++] = "/_img/back/08.jpg"
	increment = Math.floor(Math.random() * number);
	
	document.body.style.backgroundImage  = "url("+image[increment]+")";
}
	


var didaTxt = new Array();
var divArr = [];
var cntH = 250;
function mostra_img_gall(path,img_id,id_array, id_par){
	var imgElem = document.getElementById(''+img_id+'');
	imgElem.src=path;
	var didaElem = document.getElementById(''+id_par+'');
	didaElem.innerHTML=""+didaTxt[id_array];
}

function mostra_img(path,img_id){
	var imgElem = document.getElementById(''+img_id+'');
	imgElem.src=path;
	
}


window.onresize = function(){
	centraCntHTML();
}

window.onload = function() {
	bg_imgRand()
	centraCntHTML();
}

function centraCntHTML(){
	
	var myHeight, myWidth
	if( typeof( window.innerHeight ) == 'number' ) {
		myHeight = window.innerHeight;
		myWidth = window.innerWidth;
	} else if( document.documentElement && (document.documentElement.clientHeight ) ) {
		myHeight = document.documentElement.clientHeight;
		myWidth = document.documentElement.clientWidth;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		myHeight = document.body.clientHeight;
		myWidth = document.body.clientWidth;
	}
	
	if(myHeight<=cntH){myHeight=cntH}
	var bgx=((myWidth - 800)/2)
	var bgy=((myHeight - 500)/2)
	document.body.style.backgroundPosition= bgx+"px "+bgy+"px" ;
	
	var htmlCNT = document.getElementById('tassello');
	var cntTop = (myHeight - cntH)/2
	htmlCNT.style.marginTop = cntTop+"px";
	//flashDiv.style.height = myHeight+"px";
}



function chidiTutti(){
	for(var a = 0; a < divArr.length; a++){
		divArr[a].slideup()
	}
}
