function valt(max,obj) {
	var id=obj.id.replace('label_', '');
	for (var i=1; i<=max; i++)
	{
        if(document.getElementById('box_'+i) != null)
        {
         document.getElementById('box_'+i).style.display="none";
         document.getElementById('label_'+i).className="";
        }

	}
	document.getElementById('box_'+id).style.display="block";
    document.getElementById('label_'+id).className = "selected";

}
function initResizeImage(image,width,height) {
	var img = new Image();
	img.src = image;
	if(img.complete==1 && img.height > 0 && img.width > 0) {
		resizeImage(img,width,height);
		return;
	}
	img.onload = function(){ resizeImage(img,width,height); }
	
}
function resizeImage(image,intWidth,intHeight) {
	
	intOriginalWidth = image.width;
	intOriginalHeight = image.height;
	if(intWidth!==false && intHeight === false) {
		intHeight = ( intOriginalHeight * intWidth ) / intOriginalWidth;
	}
	else if(intWidth==false && intHeight !== false) {
	    intWidth = ( intOriginalWidth * intHeight ) / intOriginalHeight;
	}
	else if(intWidth !== false && intHeight !== false ) { 
		intWidth2 = intWidth; intHeight2 = intHeight;
		intAranyKep = intOriginalWidth / intOriginalHeight;
		intAranyBox = intWidth2 / intHeight2;		
		if(intAranyBox < intAranyKep) { // Belefér a boxba / függőleges állítás
			intHeight = ( intOriginalHeight * intWidth ) / intOriginalWidth;
			intPadding = (intHeight2-intHeight)/2;
			return new Array(intWidth,intHeight,intWidth2,intHeight2,intPadding);
		}
		else { // nem fér bele / vízszintes igazítás
			intWidth = ( intOriginalWidth * intHeight ) / intOriginalHeight;
			return new Array(intWidth,intHeight,intWidth2,intHeight2,true);
		}
	}
	else { // if(intWidth !== false && intHeight !== false ) {
		intHeight = intOriginalHeight;
		intWidth  = intOriginalWidth;		
	}
	return new Array(intWidth,intHeight,false,false,false);
}