function openWindow(url, label, width, height) {
	ow = window.open(url,label,'toolbar=no,status=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes,height='+height+',width='+width+',left=40,top=20');
	ow.focus();
	return ow;
}

function openPreviewFlatWindow(url) {
	return openWindow(url,'flat_window',900,700);
	//window.open(url,'','toolbar=no,status=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes,height=700,width=900,left=40,top=20');
}

function sectionSelectionWindow(url) {
	return openWindow(url,'section_selection',718,538);
	//window.open(url, 'section_selection', 'toolbar=no,status=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=yes,height=538,width=718,left=40,top=20');
}

function sizeImage(divname, imgname)
{
	var intWidth;
	var intHeight;
	var objDiv;
	var deltaX;
	var deltaY;

	objDiv = document.getElementById(divname);
	intWidth = document.getElementById(imgname).width;
	intHeight = document.getElementById(imgname).height;
		
	if (parseInt(navigator.appVersion.charAt(0))>=4){
		var isNN=(navigator.appName=="Netscape")?1:0;
		var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;
	}
	
	//deltaX = (isNN)?window.innerWidth:document.body.clientWidth;
    //deltaY = (isNN)?window.innerHeight:document.body.clientHeight; 	
	
	if(intWidth > 800 && intHeight > 600)
	{
		var factor = 800.01/intWidth;
		intWidth = 800;
		intHeight = Math.round(factor * intHeight);
	
		document.getElementById(imgname).width = intWidth;
		document.getElementById(imgname).height = intHeight;				
		
	}	
	
	intWidth += 16;
	intHeight += 100; // 25 je na div
	
	window.resizeTo(intWidth, intHeight);
}