function refreshDIV(link, id)
{ 	
	var req = null; 	

	/*alert(id);
	var div = null;
	div = document.getElementById(id);	
	*/
	
	if(window.XMLHttpRequest)
		req = new XMLHttpRequest(); 
	else if (window.ActiveXObject)
		req  = new ActiveXObject("Microsoft.XMLHTTP"); 
		        
	req.onreadystatechange = function()
	{ 
		
		if(req.readyState == 4)
		{
			if(req.status == 200)
			{
			    if (req.responseText != ''){
			    	document.getElementById(id).innerHTML = req.responseText;
			    	//div.innerHTML = req.responseText;					
			    }
			}	
			else	
			{
				div.innerHTML="Error: returned status code " + req.status + " " + req.statusText;
			}	
		} 
	}; 
	req.open("GET", link, true); 
	req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
	req.send(null); 	
} 

function openIndexSelector(gID, fn){	
    indexSelectorWindow = window.open('gallery.popup.php?gID='+gID+'&fn='+fn+'&indexSelector','openIndexSelector','width=800,height=670,top=50,left=300,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=0');    
}



function displayPictureIndexSelector(gID, fn, ID){
	refreshDIV('gallery.displayPictureAJAX.inc.php?gID='+gID+'&fn='+fn+'&indexSelector', ID);	
}

function setIndexPicture(fn, gID){		
	setTimeout('indexSelectorWindow.close();', 100);	
	refreshDIV('gallery/indexSelector.inc.php?update&gID='+gID+'&fn='+fn, 'indexPicture');
}
function openGalleryPopup(gID, fn){	
    win = window.open('gallery.popup.php?gID='+gID+'&fn='+fn,'openGalleryPopup','width=800,height=670,top=50,left=300,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=0');    
}
function openGalleryPopup2010(gID, pID){	
    win = window.open('gallery.popup2010.php?gID='+gID+'&pID='+pID,'openGalleryPopup','width=800,height=670,top=50,left=300,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=0');    
}
function displayPicture(gID, fn, ID){
	refreshDIV('gallery.displayPictureAJAX.inc.php?gID='+gID+'&fn='+fn, ID);	
}
function displayPicture2010(gID, pID, ID){
	refreshDIV('gallery.displayPictureAJAX2010.inc.php?gID='+gID+'&pID='+pID, ID);	
}

