var xmlhttp_contenuto;

function inc_contenuto(target, tipologia, tema, id)
	{
	xmlhttp_contenuto=GetXmlHttpObject();
	if (xmlhttp_contenuto==null)
		{
		alert ("Browser does not support HTTP Request");
		return;
		}

	//$("#content-bottom").hide("slow");
	
	var url="/ajax/inc_contenuto.asp";
	url=url+"?target="+target;
	url=url+"&tipologia="+tipologia;
	url=url+"&tema="+tema;
	url=url+"&id="+id;
	xmlhttp_contenuto.onreadystatechange=function(){stateChanged_contenuto(target, tipologia, tema, id)}
	xmlhttp_contenuto.open("GET",url,true);
	xmlhttp_contenuto.send(null);
	}

function stateChanged_contenuto(target, tipologia, tema, id)
	{
	if (xmlhttp_contenuto.readyState==4 || xmlhttp_contenuto.readyState=="complete")
		{
		$('#box_top_sx').corner('1px tl').corner('40px tr').corner('1px br').corner('40px bl');	
		
		if (document.getElementById(target))
			{
			$("#"+target).hide("slow");
			document.getElementById(target).innerHTML=xmlhttp_contenuto.responseText;
			$("#"+target).show("slow");
			}
		if (target == 'box_top_sx')
			{
			inc_contenuto('box_top_dx', tipologia, tema, id);
			}
		if ((target == 'box_top_dx') && (id != 0)){inc_contenuto('content_bottom', tipologia, tema, id);}

		if (target != 'content_bottom')
			{
			$("#content_bottom").hide("slow");
			document.getElementById("content_bottom").innerHTML='';
			}
				
		if (tipologia == 5){$('#test4').show('slow');}
		if (tipologia != 5){$('#test4').hide('slow');}

		if (target == 'content_bottom'){$.scrollTo({ top: '=0px', left: '=0px' }, 800);}
		

		var option = {x: 3, y: 2, radius: 3, color: "#012"}
		
		setTimeout(function()
			{
			$(".shadowed").textShadow(option);
			},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;
}
