var resized_images_width = new Array();
var resized_images_height = new Array();

function fullscreen(){
	scrollbars = 0;

	url = this.src;

	width = resized_images_width[url];
	height = resized_images_height[url];

	//url = window.event.srcElement.src;

	if(width > screen.availWidth){
		width = screen.availWidth;
		scrollbars = 1;
	}

	if(height > screen.availHeight){
		height = screen.availHeight;
		scrollbars = 1;
	}
	height = height + 24;
	width = width + 24;

	window.open(url, "userimg","status=no,resizable,scrollbars="+scrollbars+",width="+width+",height="+height);
  return true;
}

function resize(image,wijdte){
  max_width = wijdte;

  width = image.width;
  height = image.height;
  var url = image.src;

  if(width > max_width){
    resized_images_width[url] = width;
    resized_images_height[url] = height;
    image.width = max_width;
    image.style.border = "dashed 1px black";
    image.style.cursor = "hand";
    image.onclick = fullscreen; 
    image.height = Math.floor(height/(width/max_width));
  }
}

function check_images(){
  var i =0;
  while(i<document.images.length){
    if(document.images[i].className == 'userimg') {
      resize(document.images[i],610);
    }
    i++;
  } 
}	
