function createXHR() 
{
    var request = false;
        try {
            request = new ActiveXObject('Msxml2.XMLHTTP');
        }
        catch (err2) {
            try {
                request = new ActiveXObject('Microsoft.XMLHTTP');
            }
            catch (err3) {
		try {
			request = new XMLHttpRequest();
		}
		catch (err1) 
		{
			request = false;
		}
            }
        }
    return request;
}


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(url)
{
	var xhr=createXHR();   
	xhr.onreadystatechange=function()
	{ 
		if(xhr.readyState == 4)
		{
			var content = xhr.responseText;
			var i = new Image();
			i.src = content;
		} 
	}; 

	xhr.open("GET", url , true);
	xhr.send(null); 
} 


function enlarge(element)
{
	var name = element.src;
	
	name = localFilename(name);   // remove the "thumb-" part
	name = "photos/" + name;  // restore path and add the new "big-" prefix
		
	// building a string to display the image
	
	var str = "<img src='" + name + "' >";
	document.getElementById("bigview").innerHTML = "<table height=100%><tr><td align=center>"+str+"</td></tr></table>";

}
