//random backgroung on page refresh
function randomBkg(bkg) {
	obj = document.getElementById("dynamicBody");
	
	img = new  Array();
	randomImg = Math.floor(7 * Math.random());
	
	img[1] = "background_1.jpg";
	img[2] = "background_2.jpg";
	img[3] = "background_3.jpg";
	img[4] = "background_4.jpg";
	img[5] = "background_5.jpg";
	img[6] = "background_6.jpg";
	img[7] = "background_7.jpg";
	
	if(bkg) {
		obj.style.background = "url('../img/texture/" + img[bkg] + "') #FFFFFF repeat top left";
	} else {
		obj.style.background = "url('../img/texture/" + img[randomImg] + "') #FFFFFF repeat top left";
	}
	
}

//dynamic positioning of the footer
function footerPositioning() {
	footerH = document.getElementById("footer").clientHeight;							//altezza footer
	contH = document.getElementById("container").clientHeight + footerH;			//altezza container+footer
	winH = window.innerHeight;																		//altezza finestra per tutti i browser
	if(!winH) {																									//...fix per IE...
		winH = document.documentElement.clientHeight;
	}
	
	if(winH > (contH + 100)) {																			//il contenuto e' piu piccolo della finestra => riposiziono il footer
		footerMargin = winH - contH - footerH + 20;
		document.getElementById("footer").style.marginTop = footerMargin + "px";
	}
}

//rollover menu effect
function menuEffect(obj, imgName, currentImg) {
	if(currentImg != (imgName + "_b")) {
		currentImg = imgName + "_b" + ".jpg";
		obj.src = "../img/" + currentImg;
		//alert("./img/" + img + ".jpg");
	}
}

//clear rollover menu effect on mouse out
function clearMenuEffect(obj, imgName) {
	//alert(img);
	obj.src = "../img/" + imgName + ".jpg";
}

//project icon rollover
function plusIcon_over(identificatore, imgName) {
	id = "icon_" + identificatore;
	obj = document.getElementById(id);
	
	obj.src = "../img/" + imgName + "_b.gif";
}

//project icon clear rollover
function plusIcon_out(identificatore, imgName) {
	id = "icon_" + identificatore;
	obj = document.getElementById(id);
	
	obj.src = "../img/" + imgName + ".gif";
}
