// JavaScript Document

function localFilename(url)	// removing path
{
	var x = url.lastIndexOf("/");
	url = url.slice(x + 1);
	return url;		
}


// images are loaded asynchronously with no delay

function preloading(name)
{
	var xhr=createXHR();   // new instance of object
	xhr.open("GET", name, true); 
	xhr.send(null);  // we don't need for the result, just loading it in memory
} 

function enlarge(element)
{
	var name = element.src;
	
	name = localFilename(name);
//	name = realizzazioni-02-S.jpg
	prefix = name.slice(0,16);   // estraggo "realizzazioni-0x" #el(thumb)=16
	name = "images/" + prefix + ".jpg";  
		
	// building a string to display the image
	var str = "<img src='" + name + "' width=\"265\" height=\"365\">";
	document.getElementById("big_img").innerHTML = str;
//	topo = 1;
}

function restrict(element) {
	var str="\
		<h3>Realizzazioni</h3>\
		<p>Ecco alcuni esempi di nostre realizzazioni.</p>";
	document.getElementById("big_img").innerHTML = str;
}


