

function ajaxSwap(param,url,path) { 
// var url = "images/index/big/index-"+url;
   // You can even pass the action mode = post/get  and act is the parameter u wanted to pass with the url. 
   
   var pli = 'pic.php?im='+url+'&path='+path;
   ajax.open('get', pli); 
   ajax.onreadystatechange = responseHandler; 
   ajax.send(null); 
   
//      document.getElementById('swap').innerHTML = "url= <a href='"+pli+"'>"+pli+"</a>";

} 

var ajax = createXMLHttpRequest(); 

function createXMLHttpRequest(){
   try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}
   try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {}
   try { return new XMLHttpRequest(); } catch(e) {}
   alert("XMLHttpRequest not supported");
   return null;
   
}

function responseHandler() { 
	if(ajax.readyState == 0) {
 	
	}
	
	if(ajax.readyState >0<2) { 
// 		document.getElementById('swap').innerHTML = "<img src='ajax-loader.gif' style='margin-top:120px;'>Loading ..."; 
	}
	if(ajax.readyState == 3) { 
 		new Effect.Opacity('swap', {duration:1.0, from:1.0, to:0.0});
	}
// 		setOpacity(0, 'contentBox');
// 		setOpacity(0, 'contentBox');
	

	if(ajax.readyState == 4)
	{
		if(ajax.status == 200)
		{
// 			var bigimage = document.getElementById('contentBox');
 			
// 			document.getElementById('contentBox').innerHTML = "";
			
			var updateContent = ajax.responseText; 
		    if(updateContent) { 
// 			    setTimeout("fadeIn('ContentBox', 0, '99.99')", 5000); 
			    function upcont() {
			    	
			    	document.getElementById('swap').innerHTML = updateContent; 
// 			    	setTimeout("document.getElementById('contentBox').innerHTML = updateContent", 5000); // Got rid of the function.
			    }
// 			    fadeIn('ContentBox', 10), 5000);
 			    
//  			    Effect.Fade('swap', {duration:2});
 			    
    			    setTimeout(upcont, 1000);
//  				upcont();
    			    setTimeout("new Effect.Opacity('swap', {duration:1.5, from:0.0, to:1.0});", 2100);
// 				new Effect.Opacity('swap', {duration:1.0, from:0.0, to:1.0});
//   			    setTimeout("new Effect.SlideDown('swap', {duration: 2.0});", 1000);
			} 
		}
		else if(ajax.status == 404)
		{
			// Retrive error message or redirect to error page 
			document.getElementById('swap').innerHTML = "File not found";
		}
		else
		{
			document.getElementById('swap').innerHTML = "There was a problem with server connection.";
		}
	} 

} 
