// JavaScript Document
function fetchNext(divId, set)
	{	
		fetch("./autogal/fetch.php?set="+set,divId,"GET");
		
	}
function LilBox(Pic){
	$('#LilBox').fadeIn('slow');
	$('#closeIt').fadeIn('slow');
	var i = '<img src="'+Pic+'" width="600"/>';
	document.getElementById('LilContent').innerHTML = i;
	
}
function closeIt(){
	$('#LilBox').fadeOut('fast');
	$('#closeIt').fadeOut('fast');
	var i = '';
	document.getElementById('LilContent').innerHTML = i;
	
}

//this is a generic ajax function i found online. I provided comments and  moddified the script to write content into a div layer chosen by its id.
function fetch(Url,divId,Method)
{
	//create our requst object. We have to try 3 objects, for the different browsers.
 var AJAX;
 try
 {  
  AJAX = new XMLHttpRequest(); 
 }
 catch(e)
 {  
  try
  {    
   AJAX = new ActiveXObject("Msxml2.XMLHTTP");    
  }
  catch(e)
  {    
   try
   {
    AJAX = new ActiveXObject("Microsoft.XMLHTTP");      
   }
   catch(e)
   {      
    alert("Your browser does not support AJAX.");      
    return false;      
   }    
  }  
 }//once the request is sent, check with the server on the requests status. 
 AJAX.onreadystatechange = function()
 {//4 == complete
  if(AJAX.readyState == 4)
  {
   //200 = complete and ready!
   if(AJAX.status == 200)
   {//print the resulting data into the div layer
  //	document.getElementById(DivId).innerHTML = AJAX.responseText;
	var wow = AJAX.responseText;	
	document.getElementById('gallery-wrap').innerHTML = wow;
   }
   else
   {//shit the bed
    alert("Error: "+ AJAX.statusText +" "+ AJAX.status);
   }
  }  
 };
 //send the request object
 AJAX.open(Method, Url, true);
 AJAX.send(null);
}

