var xmlhttp_gallery;

function inc_gallery(tipologia)
	{
	xmlhttp_gallery=GetXmlHttpObject();
	if (xmlhttp_gallery==null)
		{
		alert ("Browser does not support HTTP Request");
		return;
		}
	
	$('.contentopaque').fadeOut(800);
	$('.opaque').fadeOut(800);
	$('#up').fadeOut(800);
	$('#down').fadeOut(800);

	var url="/ajax/inc_gallery.asp?tipologia="+tipologia;
	xmlhttp_gallery.onreadystatechange=function(){stateChanged_gallery(tipologia)}
	xmlhttp_gallery.open("GET",url,true);
	xmlhttp_gallery.send(null);
	}

function stateChanged_gallery(tipologia)
	{
	if (xmlhttp_gallery.readyState==4 || xmlhttp_gallery.readyState=="complete")
		{
		$(document).ready(function(){
			if (xmlhttp_gallery.responseText != '')
				{
				setTimeout(function(){  
					$("#gallery").html(xmlhttp_gallery.responseText);	
					$('#gallery').css('margin', '-4pt auto 4pt auto');					
					$('#gallery').fadeIn(800);
					}, 800);
					
				}
			});
		}		
	}

function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
{
// code for IE7+, Firefox, Chrome, Opera, Safari
return new XMLHttpRequest();
}
if (window.ActiveXObject)
{
// code for IE6, IE5
return new ActiveXObject("Microsoft.XMLHTTP");
}
return null;
}
