/*
Generic style elements
Hadrian Forum

Version 1.1  10/14/2004 23:46
	* changed resize behaviour, for better script-execution and make it compatible with mozilla
	* make fullscreen url load always

Version 1.2  04/03/2007 22:59
	* changed resize behaviour again, now resizes within the document
*/

var resized_images_width = new Array();
var resized_images_height = new Array();

function fullSize(){
	scrollbars = 0;
	var oSource = this.src;
	width = resized_images_width[oSource];
	height = resized_images_height[oSource];

	url = forumRoot + "/image.php?src="+oSource+"&width="+width+"&height="+height;

	if(width > screen.availWidth){
		width = screen.availWidth;
		scrollbars = 1;
	}

	if(height > screen.availHeight){
		height = screen.availHeight;
		scrollbars = 1;
	}

	//fullscr = window.open(url, "_blank","toolbar=no,location=no,menubar=no,fullscreen="+scrollbars+",channelmode="+scrollbars+",scrollbars="+scrollbars+",status=no,left=0,top=0,width="+width+",height="+height);
	//alert(this.src);
	
	if ((sky = document.getElementById('skyscraper'))){
		sky.style.display = 'none';
		}
	
	this.width = width;
	this.height = height;
	this.onclick = oldsize;
	this.style.border = "solid 0px rgb(0,0,0)";
	this.title = this.src;
	this.style.position = 'relative';
	this.style.zIndex = 100;
}

threshold = 580;

function oldsize(){
	resize(this);
}

function resize(img){
	width = img.width;
	if(img.style.width > 0 && img.style.width < img.width){
		width = img.style.width;
		}
	height = img.height;
	if(img.style.height > 0 && img.style.height < img.height){
		height = img.style.height;
		}

	var url = img.src;

	if(width>threshold){
		resized_images_width[url] = width;
		resized_images_height[url] = height;
		img.width = threshold;
		img.alt = 'Afbeelding';
		img.title = 'Klik voor originele grootte ('+width+'x'+height+')';
		img.style.border = "dashed 2px rgb(192,0,0)";
		img.style.cursor = "pointer";
		img.onclick = fullSize;
		img.height = Math.floor(height/(width/threshold));
		img.style.position = 'relative';
		img.style.zIndex = 100;
		img.style.clear = 'both';
		img.style.float = 'left';
		
	}
}

function toolbox(imgID, onoff){
	theImg = document.getElementById('usrImg_'+imgID);
	thePanel = document.getElementById('panel_'+imgID);
	theBox = document.getElementById('toolbox_'+imgID);
	if(onoff==1){
		thePanel.style.bottom = theImg.height;
		theBox.style.overflow = 'visible';
		thePanel.style.visibility = 'visible';
	}else{
		thePanel.style.bottom = theImg.height;
    theBox.style.overflow = 'hidden';	
		//theBox.style.display = 'none';
	}
}

function check_images(hostName){

	if (typeof(SymWinOpen)=='function'){
		//alert("Je hebt Norton Firewall of Virus Scan geïnstalleerd.\nZet het vinkje 'Reclame onderdrukken' uit!");
		}


	count = document.images.length;
	i = 0;
	while(count>i){
		url = document.images[i].src;
		if(!url.match(hostName)){
			if(document.images[i].className != 'userImage' && document.images[i].width>threshold){
				resize(document.images[i]);
				document.images[i].onload = resize;
				document.images[i].className = 'userImage';
			}
		}
		i++;
	}
}