function adjustIFrameSize (iframeWindow) {
	if (iframeWindow.document.height) {
		var iframeElement = document.getElementById ('webshop');
		iframeElement.style.height = iframeWindow.document.height+'px';
		//iframeElement.style.width = (Math.max(iframeWindow.document.width, 820)) + 'px';
	}
	else if (document.all) {
		var iframeElement = document.all['webshop'];
		if (iframeWindow.document.compatMode &&	iframeWindow.document.compatMode != 'BackCompat')	{
			//iframeElement.style.height = Math.max(iframeWindow.document.documentElement.scrollHeight, iframeWindow.parentElement.scrollHeight - 20) +'px';
			iframeElement.style.height = iframeWindow.document.documentElement.scrollHeight +'px';
//			iframeElement.style.width =	(Math.max(iframeWindow.document.documentElement.scrollWidth, 990)) + 'px';
		}
		else {
			iframeElement.style.height = iframeWindow.document.body.scrollHeight +'px';
//			iframeElement.style.width =	(Math.max(iframeWindow.document.body.scrollWidth, 990)) + 'px';
		}
	}


	var menu = document.getElementById('cat_menu');
	var menu_items = menu.getElementsByTagName('LI');
	for(i=0; i < menu_items.length; i++){
		menu_items[i].className = "";
	}
	//alert(menu_items);
	if(iframeWindow.location.search){
		//alert(iframeWindow.location.search);
		var els = iframeWindow.location.search.split("&");
		var cpath = 0;
		for(i=0; i < els.length; i++){
			var par = els[i].split("=");
			if(par[0] == 'cPath' || par[0] == '?cPath') {
				var cp = par[1].split('_');
				cpath = cp[0];
				break;
			}
		}
		if(cpath) document.getElementById('cat_'+cpath).className= 'selected';
		//alert(cpath);
	}
}

function shrinkImages(area, max_w) {
	var elm = document.getElementById(area);
	if(! elm) return;
	var imgs = elm.getElementsByTagName('IMG');
	for(i = 0; i < imgs.length; i++){
		var w = max_w;
		//alert('width: '+imgs[i].width+"\n height: " +imgs[i].height+"\nhspace: "+imgs[i].hspace+"\nvspace: "+imgs[i].vspace);

		if ((imgs[i].width + 2* imgs[i].hspace) > w){
			imgs[i].align='';
			imgs[i].hspace='1';
		}
		else if(imgs[i].getAttribute('align')){
			if((imgs[i].width + 2* imgs[i].hspace) > w*2/3) w = Math.round(w*2/3) - 10;
			imgs[i].hspace='5';
		}

		if(imgs[i].width > w) {
			imgs[i].setAttribute('height', Math.round(imgs[i].height * w / imgs[i].width));
			imgs[i].setAttribute('width', w);
		}
		//alert('width: ' + imgs[i].width+"\n height: " +imgs[i].height+"\nhspace: "+imgs[i].hspace+"\nvspace: "+imgs[i].vspace);
	}
}