// hide flash applet when opening an editFrame 
function hideFlash() {
	if (document.getElementById('blockDock')) {
		document.getElementById('blockDock').style.left = "-950px";
		document.getElementById('blockDock').style.visibility = "hidden";
	}
}

// Hide the editFrame ///////////////////////////////////////////
// Call this as parent.hideEditFrame() from the edit module.
function hideEditFrame() {
	var eF = document.getElementById('editFrame');
	eF.style.left = "-1000px";
	document.getElementById('blockDock').style.left = "10px";
	document.getElementById('blockDock').style.visibility = "visible";
}

// icon list roll in
function rI (o) {
	eA = document.getElementById('gLst');
	eB = document.getElementById(o);
	// get yPos //
	yPos = eA.offsetHeight;
	
	// position div ifo* and make it visible //
	eB.style.top = yPos +"px";
	eB.style.visibility = "visible";
}

// icon list roll out
function rO (o) {
	// 	eA = document.getElementById(ifo);
	eB.style.visibility = "hidden";
}

function editFrSearch(aForm) {
	var seaWord = aForm.seaWord.value;
	if (seaWord.length == 0) {}
	else {
		hideFlash(); 
		/* initEditFrame('arEditFrame.php?nodeId=422&aspect=editFrUCSeaRes&seaRes='+encodeURIComponent(seaWord));
		 * this version got disregarded because the 
		 * UTF-8-capable browsers ignore it anyway
		 * and although IE Mac 5.* encodes properly the symbols
		 * he seems somehow not to be able to decode them.
		 */
		if(!(MAC && IE)) {
				seaWord = encodeURIComponent(seaWord);
		}
		initEditFrame('arEditFrame.php?nodeId=422&aspect=editFrUCSeaRes&seaRes='+seaWord);
		return false;
	}
}

function popup(url,winName,wW,wH,opts) {

	if(!opts) opts = "toolbar=0,location=0,directories=0,status=1,menuBar=0,resizable=1,scrollBars=1";
			
	if (wW && wH) {
		sW = screen.availWidth;
		sH = screen.availHeight;
		wW = parseInt(wW) + 40; // add marginright
		wH = parseInt(wH) + 30; // add marginbottom
		
		// compare the req. window size with screen size (minus margin of 20 px).
		sbW=0;
		sbH=0;
	
		if (sW < wW-60) { // screen-width is smaller than requested window-width
			wW = sW - 60; // set window-width to screen-width minus a small tolerance-margin
			sbH = 40; // window is smaller than requested, so most likely a  vertical scrollbar will appear, add space for it to height
		}
	
		if (sH < wH-60) { // screen-height is smaller than requested window-height
			wH = sH - 60; // set window-height to screen-height minus a small tolerance-margin
			sbW = 40; // window is smaller than requested, so most likely a  vertical scrollbar will appear, add space for it to width;
		}
	
		// add scrollbars to width and height if they appear
		wW = wW+sbW;
		wH = wH+sbH;
		wleft = ((screen.width-wW)/2)-15;
		wtop = ((screen.height-wH)/2)-15;
		opts = "width="+wW+",height="+wH+",left="+wleft+",top="+wtop+opts;
	}

	var win = window.open(url,"_blank",opts); // use this if you want a special window look
	if (parseInt(navigator.appVersion) >= 4) win.window.focus();
}	
