function scaleIt(ratio, originalWidth, originalHeight, filesize) {
  var scalePhoto = $('cropImage');
  var scalediv = $('cropWrap');
  v = originalWidth * (ratio/100);
  h = originalHeight * (ratio/100);
  scalePhoto.style.width = Math.floor(v) + 'px';
  scalePhoto.style.height = Math.floor(h) + 'px';
  
  if(Math.floor(v)>800)
  {
  $('main_ban_hid').style.display ="none";
  }
  else
  {
	$('main_ban_hid').style.display ="inline";
  }
  
  document.getElementById('IM_Width').value=document.getElementById('cropImage').width;
  document.getElementById('IM_Height').value=document.getElementById('cropImage').height;
  verhouding1=originalHeight/parseInt(document.getElementById('IM_Height').value);
  verhouding2=originalWidth/parseInt(document.getElementById('IM_Width').value)
  document.getElementById('IM_Size').value=KB(filesize/verhouding1/verhouding2);
 
}

function saveChange() {
  var theWidth = $('cropImage').style.width;
  theWidth = theWidth.substring(0,(theWidth.length-2));
  $('resizeWidth').value = theWidth;
 }

function initSlider() {
    slider=new Control.Slider('resizeHandle','resizeTrack', { 
    axis:'horizontal', 
    range:$R(20,200), 
    sliderValue:100,
    onSlide: function(v) { scaleIt(v, $('cropWidth').value, $('cropHeight').value, gup('s',document.getElementById('cropImage').src)); },
    onChange: function(v) { saveChange(); }      
  });
}

//Event.observe(window, 'load', function() { initSlider() });
