/*********************************************/
//VISUALIZZA UNA FOTO CERCANDO L'ID PLACEHOLDER E INSERENDO NEL TAG "SRC" DELL'ELEMENTO LA FOTO (HREF) RELATIVA AL CLICK
//AD ESEMPIO LA SEGUENTE RIGA
//<a onclick="return showPic(this)" href="images/img001.jpg" title="Foto 001 TITLE">First Image</a>
//PERMETTE LA VISUALIZZAZIONE DELLA FOTO IMG001.JPG PERCHE' PRENDE L'ATTRIBUTO HREF DEL TAG <a> CHE VIENE PASSATO COME 
//PARAMETRO (THIS) A showPic(...)
//SUCCESSIVAMENTE IL CODICE CERCA CHE SIA PRESENTE L'ATTRIBUTO TITLE E, SE E' PRESENTE, LO MEMORIZZA NEL VALORE DEL NODO CHE
//HA COME ID LA STRINGA "DESC". SE INVECE NON C'E' L'ATTRIBUTO TITLE, IL NODO HA COME VALORE IL VALORE DEL NODO DEL TAG <A>
//IN QUESTO CASO DIVENTEREBBE "FIRST IMAGE" 
/*********************************************/
function showPic(whichpic) { 
	if (document.getElementById) { 
		document.getElementById('placeholder').src = whichpic.href; 
//		document.getElementById('imgth').src = whichpic.href.substr(0, whichpic.href.length - 4) + "_th.jpg"; 
		if (whichpic.title) { 
			document.getElementById('desc').childNodes[0].nodeValue = whichpic.title; 
		} else { 
			document.getElementById('desc').childNodes[0].nodeValue = whichpic.childNodes[0].nodeValue; 
		} 
		
		if (whichpic.alt) { 
			document.getElementById('placeholder').title = whichpic.alt; 
		} else { 
			document.getElementById('placeholder').title = whichpic.childNodes[0].nodeValue; 
		} 
/*
		if (whichpic.shortd) { 
			document.getElementById('shortdesc').childNodes[0].nodeValue = whichpic.shortd; 
		} else { 
			document.getElementById('shortdesc').childNodes[0].nodeValue = whichpic.childNodes[0].nodeValue; 
		} 
	*/	
		return false; 
	} else { 
		return true; 
	} 
}
/*********************************************/


/*********************************************/
function collapser(item){
	// Make sure the tags are setup correctly, if not just return 
	if (!item.parentNode.getElementsByTagName("ul")[0]) return; 
	var x = item.parentNode.getElementsByTagName("ul")[0]; 
	// if already visible, make disappear, otherwise reappear 
	if (x.style.display == ''){
		x.style.display = 'block';
	} else {
		x.style.display = '';
	}
}
/*********************************************/


/*********************************************/
function str_replace(oldS,newS,fullS) 
  {
     for (var i=0; i<fullS.length; i++) 
	 {      
		if (fullS.substring(i,i+oldS.length) == oldS) 
		{         
			fullS = fullS.substring(0,i)+newS+fullS.substring(i+oldS.length,fullS.length)      
		}   
	  }   
	  return fullS
  }
/*********************************************/


/*********************************************/
function delay(gap){ /* gap is in millisecs */
	var then, now; 
	then = new Date().getTime();
	now = then;

	while((now-then) < gap) {
			now=new Date().getTime();
	}
}
/*********************************************/
