function setScrollPosition(xResize, yResize, unit, param) {
  var windowWidth;
  var windowHeight;
  var newScrollX;
  var newScrollY;
  
  windowWidth = getClientWidth();
  windowHeight = getClientHeight();
  
  //xxx = getScrollTop();
  //alert(xxx);
  
  if (xResize >= 0 && yResize >= 0){
      if (unit == '%'){
          if (param == '+'){
            newScrollX = getScrollLeft() * (1 + xResize / 100);
            newScrollY = getScrollTop() * (1 + yResize / 100); 
          }else if (param == '-'){
            newScrollX = getScrollLeft() * (1 - xResize / 100);
            newScrollY = getScrollTop() * (1 - yResize / 100);
          }
      }else if(unit == 'px'){
          if (param == '+'){
            newScrollX = getScrollLeft() - xResize;
            newScrollY = getScrollTop() - yResize; 
          }else if (param == '-'){
            newScrollX = getScrollLeft() - xResize;
            newScrollY = getScrollTop() - yResize;
          }
      }
  }
  
  //alert("currentScrollY: " + getScrollTop());
  //alert("newScrollY: " + newScrollY);
  
  window.scrollTo(newScrollX, newScrollY);
}

function getClientWidth() {
	return getFilterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}

function getClientHeight() {
	return getFilterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}

function getScrollLeft() {
	return getFilterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}

function getScrollTop() {
	return getFilterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}

function getFilterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}
