/* Pongi's own function */
function vai(dove) {
    window.location.replace(dove);
}
function mostra(cosa) {
	if (document.getElementById(cosa).style.display == "none") {
	        document.getElementById(cosa).style.display = "block";
	} else {
	        document.getElementById(cosa).style.display = "none";
	}
	return true;
}
// Opens a popup
function popup(cosa) {
	window.open(cosa, "PopUpWindow", "width:50%;height:60%;");
}
// Adjust popup size
function popupsize() {

}

// Display a visual warning
function woops(newcolor) {
     var oldcolor = document.body.style.backgroundColor;
	document.body.style.backgroundColor = newcolor;
	setTimeout("document.body.style.backgroundColor = '"+oldcolor+"'", 500);
}

/* AJAX mother function */
function getHTTPObject() {
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/

  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}


/* 
//*******************
Javascript animation, many thanks to Hesido.com
//*******************
*/

function doWidthChangeMem(elem,dime,val,startWidth,endWidth,steps,intervals,powr) {
//Width changer with Memory by www.hesido.com
//<everything> changer with Memory by pongi (based upon hesido's one!)
	if (elem.widthChangeMemInt) window.clearInterval(elem.widthChangeMemInt);
	var actStep = 0;
	elem.widthChangeMemInt = window.setInterval(
		function() {
			elem.currentWidth = easeInOut(startWidth,endWidth,steps,actStep,powr);
			eval("elem.style."+dime+" = elem.currentWidth+'"+val+"'");
			actStep++;
			if (actStep > steps) window.clearInterval(elem.widthChangeMemInt);
		}
		,intervals)

}

function easeInOut(minValue,maxValue,totalSteps,actualStep,powr) {
//Generic Animation Step Value Generator By www.hesido.com
	var delta = maxValue - minValue;
	var stepp = minValue+(Math.pow(((1 / totalSteps)*actualStep),powr)*delta);
	return Math.ceil(stepp)
}
//*******************




