	
	var xmlhttp = false;
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttp = false;
		}
	}
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		xmlhttp = new XMLHttpRequest();
	}

function ottieniRichiesta(serverPage,objID){
	var obj = document.getElementById(objID);
	xmlhttp.open("GET", serverPage);
	xmlhttp.onreadystatechange = function(){
		if(xmlhttp.readyState == 4 && xmlhttp.status == 200){
			obj.innerHTML = xmlhttp.responseText;
		}
	}
	xmlhttp.send(null);
}

function pippa(obj){

}



function changeActiveTab(obj){
 	 var tuttiTab = document.getElementsByTagName('li');
	 for (var i = 0; i < tuttiTab.length; i++){
		if (tuttiTab[i].getAttribute('class') == "active"){
			tuttiTab[i].className = "none";
		}
	 }
	obj.className = "active";
}



function nextPageThumb(obj){
 	 var imgThum = document.getElementsByTagName('img');
 	 var counter = 15;
	 for (var i = 0; i < imgThum.length; i++){
		if (imgThum[i].getAttribute('id') == "piatti"){
			counter++;
			if(counter<22){
						var refimage="images/piatti/"+counter+".jpg";						
						var newImg = new Image();
						newImg.src = refimage;
						var height = newImg.height;
						var width = newImg.width;
						if(height>width){
							imgThum[i].className = "por";								
							imgThum[i].parentNode.className = "por";							
							imgThum[i].parentNode.parentNode.className = "por";
						}else{
							imgThum[i].parentNode.parentNode.className = "";
							imgThum[i].parentNode.className = "";
							imgThum[i].className = "";
						}						
			}else{
					refimage="images/piatti/null.jpg";
			}
			imgThum[i].setAttribute('src',refimage);
		}
	 }
 	 var imgHref = document.getElementsByTagName('a');
 	 var counterBis = 15;
	 for (var i = 0; i < imgHref.length; i++){
		if (imgHref[i].getAttribute('id') == "piatti"){
			counterBis++;
			if(counterBis<22){
						var refhref="images/piatti/"+counterBis+".jpg";
			}else{
					refhref="#";
			}
			imgHref[i].setAttribute('href',refhref);
		}
	 }
	 var imgNext = document.getElementsByTagName('img');
	 for (var i = 0; i < imgNext.length; i++){
		if (imgNext[i].getAttribute('id') == "next"){
			var refhref="images/piatti/indietro.jpg";
			imgNext[i].setAttribute('src',refhref);
			imgNext[i].className = "prev"
			imgNext[i].setAttribute('id',"prev");
		}
	 }
	 obj.setAttribute('id',"prev");
	 obj.setAttribute('onclick',"prevPageThumb(this);");
	
}

function prevPageThumb(obj){
	 var imgThum = document.getElementsByTagName('img');
 	 var counter = 0;
	 for (var i = 0; i < imgThum.length; i++){
		if (imgThum[i].getAttribute('id') == "piatti"){
			counter++;
			if(counter<16){
						var refimage="images/piatti/"+counter+".jpg";						
						var newImg = new Image();
						newImg.src = refimage;
						var height = newImg.height;
						var width = newImg.width;
						if(height>width){
							imgThum[i].parentNode.parentNode.className = "por";
							imgThum[i].parentNode.className = "por";
							imgThum[i].className = "por";
						}else{
							imgThum[i].parentNode.parentNode.className = "";
							imgThum[i].parentNode.className = "";
							imgThum[i].className = "";
						}
			}else{
					refimage="images/piatti/null.jpg";
			}
			imgThum[i].setAttribute('src',refimage);
		}
	 }
 	 var imgHref = document.getElementsByTagName('a');
 	 var counterBis = 0;
	 for (var i = 0; i < imgHref.length; i++){
		if (imgHref[i].getAttribute('id') == "piatti"){
			counterBis++;
			if(counterBis<16){
						var refhref="images/piatti/"+counterBis+".jpg";
			}else{
					refhref="#";
			}
			imgHref[i].setAttribute('href',refhref);
		}
	 }
	 var imgNext = document.getElementsByTagName('img');
	 for (var i = 0; i < imgNext.length; i++){
		if (imgNext[i].getAttribute('id') == "prev"){
			var refhref="images/piatti/avanti.jpg";
			imgNext[i].setAttribute('src',refhref);
			imgNext[i].setAttribute('id',"next");
		}
	 }
 	 obj.setAttribute('id',"next");
	 obj.setAttribute('onclick',"nextPageThumb(this);");
	
}
