// JavaScript Document
var ourModulo = '';
var ourImm = '';

function makeVisible(modulo,imm) {
	document.getElementById('view_img').src = "img/img_"+modulo+"/"+imm;
	ourModulo = modulo;	ourImm = imm;
	document.getElementById('showImg').onclick = myClick;
	return;
}


function myClick () {
	pop_up('dettaglio.php?id_img='+ourImm+'&modulo='+ourModulo,'nuovaFinestra','width=400px');
	//alert('dettaglio.php?id_img='+ourImm+'&modulo='+ourModulo);
	return false;
}

//POP UP ACCESSIBILE
function pop_up(URL,nome) { 
	window.open(URL,nome,'toolbar=no, location=no,status=no,menubar=no,scrollbars=no,resizable=no');

}

/* set a tabbed menu active/inactive (must be UL/LI structure, all with id defined!)
rFld : tab sheet id to set active (div - all sheets must be wrapped by a global div)
rClassA : set this as active class
rClassI : set this as inactive class */
function setTabActive (rFld, rClassA, rClassI) {
	// set sheet to visible (rFld)
	if (document.getElementById(rFld)) {
		var sheet = document.getElementById(rFld);
		if (sheet.parentNode) {
			var sheets = sheet.parentNode.childNodes;
			var sheetsNum = sheets.length;
			var i; for (i=0; i<sheetsNum; i++) {
				// consider only div with defined id
				if (sheets[i].id && sheets[i].tagName == 'DIV') {
					if (sheets[i].id == rFld) { setVisible(sheets[i].id, 1, 0, 0); }
					else { setVisible(sheets[i].id, 0); }
				}
			}
		}
	}
	return;
}

/* set visible/invisible function
rSet: 0=invisible, 1=visible, 2=swap
rWidth, rHeight: 0=auto, else pixel width */
function setVisible (rFld, rSet, rWidth, rHeight) {
	if (document.getElementById(rFld)) {
		var doFld = document.getElementById(rFld);
		if (rSet==1 || (rSet==2 && doFld.style.visibility=="hidden")) {
			rSet = "visible";
			rWidth = (rWidth > 0) ? rWidth : "auto";
			rHeight = (rHeight > 0) ? rHeight : "auto";
		}
		else {
			rSet = "hidden"; rWidth = "0"; rHeight = "0";
		}
		if (rWidth != "auto") { rWidth += "px"; }
		if (rHeight != "auto") { rHeight += "px"; }
		doFld.style.width = rWidth;
		doFld.style.height = rHeight;
		doFld.style.overflow = "hidden";
		doFld.style.visibility = rSet;
	}
	return;
}


