// Scorrimento automatico in alto
function getScrollXY(win) {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( win.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = win.pageYOffset;
    scrOfX = win.pageXOffset;
  } else if( win.document.body && ( win.document.body.scrollLeft || win.document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = win.document.body.scrollTop;
    scrOfX = win.document.body.scrollLeft;
  } else if( win.document.documentElement && ( win.document.documentElement.scrollLeft || win.document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = win.document.documentElement.scrollTop;
    scrOfX = win.document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}

function scrollerAnchor() {
	if (window.location.hash != "" && window.location.hash != undefined) {
		//window.location.href = "#" + window.location.hash;
		window.location.replace("#" + window.location.hash);
		//window.location.reload();
		//$.scrollTo($("#" + window.location.hash), 0);
	}
}

function scrollerTop() {
	scroll_pos_top = getScrollXY(top);
	if (scroll_pos_top[1] > 250 && (window.location.hash == "" || window.location.hash == undefined)) {
		top.scroll(0, 250);
	}
}

function scrollerCaller() {
	setTimeout(scrollerAnchor, 2000);
}
/*
if (window.addEventListener)
window.addEventListener("load", scrollerCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", scrollerCaller)
else
window.onload=scrollerCaller
*/
$(function() {
	scrollerTop();
	}
);
$(window).load(function() {
	scrollerCaller();
	}
);