//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; 
		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').alt = whichpic.alt; 
		} else { 
			document.getElementById('placeholder').alt = whichpic.childNodes[0].nodeValue; 
		} 
		
		return false; 
	} else { 
		return true; 
	} 
}

function showPic1() { 
	cPict = getParameter("id");
	cPath = getParameter("p");
	if (cPath == "") {
		cPath = "../img";
	}
	cPath += "/";
	
	if (document.getElementById) { 
		document.getElementById("placeholder").src = cPath + cPict; 
		return true; 
	} 
}

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
  }
  
//From dreamweaver  
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

/**
 * Pesca un parametro dalla query string dell'URL
 * @param whichOne il parametro
 * @return il valore associato al parametro
 * @author Nosferatu, 1998
// semplice saluto
alert("Ciao, " + getParameter("username"));

// porto in seconda pagina di un catalogo tutte le variabili
location = "index.html?" + setParameter("page", 2);
 */
function getParameter(whichOne) {
  var pairs = location.search.substring(1).split('&');
  var r = "";
  var tp = new Array();
  for (var i = 0; i < pairs.length; i ++) {
    tp = pairs[i].split('=');
    if (whichOne == tp[0])
      r = unescape(tp[1].replace(/\+/g, " "));
  }
  return r;
}

/**
 * Ritorna i nomi di tutti parametri della query string
 * @return l'array contenente i nomi dei parametri
 * @author Nosferatu, 1998
 */
function getParameterNames() {
  var ar = location.search.substring(1).split('&');
  for (var i = 0; i < ar.length; i++) {
    ar[i] = ar[i].substring(0, ar[i].indexOf('='));
  }
  return ar;
}

/**
 * Genera una nuova query string updatando il parametro passato
 * @param thePar il parametro
 * @param theValue il valore da assegnare
 * @return la stringa contenente la query string completa
 * @author Nosferatu, 1998
 */
function setParameter(thePar, theValue) {
  var pc = "";
  var pa = getParameterNames();
  for (var i = 0; i < pa.length; i++) {
    if (pa[i] != thePar) {
      pc += "&" + pa[i] + "=" + getParameter(pa[i]);
    }
  }
  pc += "&" + thePar + "=" + escape(theValue);
  return pc.substring(1);
}

/**

<script language="javascript">
// Set the horizontal and vertical position for the popup

PositionX = 100;
PositionY = 100;

// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)

defaultWidth  = 500;
defaultHeight = 500;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows

var AutoClose = true;

// Do not edit below this line...
// ================================
if(parseInt(navigator.appVersion.charAt(0))>=4)
{
	var isNN=(navigator.appName=="Netscape")?1:0;
	var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
	var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
	var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
	function popImage(imageURL,imageTitle)
	{
		if (isNN)
		{
			imgWin=window.open('about:blank','',optNN);
		}
		if (isIE)
		{
			imgWin=window.open('about:blank','',optIE);
		}
		with (imgWin.document)
		{
			writeln('<html><head><title>Loading...</title><style>body{margin:5px;}</style></head>');
			writeln('<sc'+'ript>');
			writeln('var isNN,isIE;');
			writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
			writeln('isNN=(navigator.appName=="Netscape")?1:0;');
			writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
			writeln('function reSizeToImage(){');
			writeln('if (isIE){');
			writeln('window.resizeTo(100,100);');
			writeln('width=100-(document.body.clientWidth-(document.images[0].width + 15));');
			writeln('height=100-(document.body.clientHeight-(document.images[0].height + 20));');
			writeln('window.resizeTo(width,height);}');
			writeln('if (isNN){');
			writeln('window.innerWidth=document.images["George"].width;');
			writeln('window.innerHeight=document.images["George"].height;}}');
			writeln('function doTitle(){document.title="'+imageTitle+'";}');
			writeln('</sc'+'ript>');
			if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
			else writeln('</head><body bgcolor=FFFFFF scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
			writeln('<div align="center"><img name="George" src='+imageURL+' border=0></div><div align="right"><a href="javascript: window.close(); style="STYLE="font-size:10; color:#575757; font-family: Verdana; text-decoration: underline;">close window</a></div></body></html>');
		close();
	}
}
</script>



<a href="javascript:popImage('FullPathToImage', 'Image Preview');">Preview</a>


**/

