function rollOver(imageObj, newSrc) {
	imageObj.src = newSrc
}

function openModalDialog(url,width,height,target) {
	if (height==null) height = 350
	var modalNew = window.open(url,target,"scrollbars=yes,height="+height+",width="+width+",resizable=yes,status=yes,toolbar=no,menubar=no,location=no")
	modalNew.focus();
}

function alphaBlending(foreground,background,alpha) {
	//algoritmo: a(r1,g1,b1) + (1 - a) * (r2,g2,b2)
	alpha = alpha.toFixed(2)
	alpha_1 = 1 - alpha
	alpha_1 = alpha_1.toFixed(2)
	if (foreground.indexOf("#")>-1) {
		foreground = foreground.substr(1);
	}
	if (background.indexOf("#")>-1) {
		background = background.substr(1);
	}
	var subFcolor = "", subBcolor="", subAcolor = ""
	if ((alpha<1)) {
		R = Math.round(alpha * parseInt(foreground.substr(0,2),16))
		G = Math.round(alpha * parseInt(foreground.substr(2,2),16))
		B = Math.round(alpha * parseInt(foreground.substr(4,2),16))
		if (R < 16) subFcolor += "0" + R.toString(16); else subFcolor += R.toString(16);
		if (G < 16) subFcolor += "0" + G.toString(16); else subFcolor += G.toString(16);
		if (B < 16) subFcolor += "0" + B.toString(16); else subFcolor += B.toString(16);
		R = Math.round(alpha_1 * parseInt(background.substr(0,2),16))
		G = Math.round(alpha_1 * parseInt(background.substr(2,2),16))
		B = Math.round(alpha_1 * parseInt(background.substr(4,2),16))
		if (R < 16) subBcolor += "0" + R.toString(16); else subBcolor += R.toString(16);
		if (G < 16) subBcolor += "0" + G.toString(16); else subBcolor += G.toString(16);
		if (B < 16) subBcolor += "0" + B.toString(16); else subBcolor += B.toString(16);
		R = Math.round(parseInt(subFcolor.substr(0,2),16)+parseInt(subBcolor.substr(0,2),16))
		G = Math.round(parseInt(subFcolor.substr(2,2),16)+parseInt(subBcolor.substr(2,2),16))
		B = Math.round(parseInt(subFcolor.substr(4,2),16)+parseInt(subBcolor.substr(4,2),16))
		if (R < 16) subAcolor += "0" + R.toString(16); else subAcolor += R.toString(16);
		if (G < 16) subAcolor += "0" + G.toString(16); else subAcolor += G.toString(16);
		if (B < 16) subAcolor += "0" + B.toString(16); else subAcolor += B.toString(16);
		return "#" + subAcolor
	}
	else
		return foreground
}

function Trim(stringa){
	reTrim=/\s+$|^\s+/g;
	return stringa.replace(reTrim,"");
}

function altreFoto(dir) {
	openModalDialog("/altrefoto.asp?id=" + dir,300,300,"newFoto")
}
function altreFoto1(dir) {
	openModalDialog("/altrefoto1.asp?id=" + dir,300,300,"newFoto")
}

function schedeTecniche(id) {
	openModalDialog("/schedaTecnica.asp?ID=" + id,830,420,"newSheet")
}
function schedeTecniche1(id) {
	openModalDialog("/schedaTecnica1.asp?ID=" + id,830,420,"newSheet")
}

function video(id) {
	var modalNew = window.open("/video.asp?ID=" + id,"newVideo","scrollbars=no,height="+310+",width="+320+",resizable=no,status=no,toolbar=no,menubar=no,location=no")
	modalNew.focus();
}
