self.name = "searchWindow";
browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);

function countElements(fieldName)
{
	if (parseInt(navigator.appVersion) >= 4)
		var formLength = document.searchForm.length;
	else
		var formLength = 50;
	
	for (var i=0; i< formLength; i++)
	{
		if(document.searchForm.elements[i].name == fieldName)
		{
			var elem = i;
			break;
		}
	}
	return i;
}

function browseWindow(field, elem)
{
	var elemNo  = countElements(elem);
	var width   = 450;
	var height  = 535;
	if (parseInt(navigator.appVersion) >= 4)
	{
		var top     = (screen.availHeight - height) / 2;
		var screenY = top;
		var left    = (screen.availWidth - width) / 2;
		var screenX = left;
		var BrowseWindow = window.open("","BrowseWindow", "width="+width+",height="+height+",screenX="+screenX+",screenY="+screenY+",top="+top+",left="+left+",resizable,scrollbars");
	}
	else
	{
		var BrowseWindow = window.open("","BrowseWindow", "width="+width+",height="+height+",resizable,scrollbars");
	}
	
	if(BrowseWindow.opener == null)
	{
		BrowseWindow.opener = searchWindow;
	}
	
	BrowseWindow.location = "http://"+this.location.host+this.location.pathname+"?p_action=startbrowse&s_elem="+elemNo+"&s_field="+field;
	//BrowseWindow.location = "http://"+this.location.host+"/iw-search/we/Test?p_action=startbrowse&s_elem="+elemNo+"&s_field="+field;
	// 10.20.98 JWF Only focus if the browser is NOT MSIE 3 or older
	if (browserName != "Microsoft Internet Explorer" || browserVer >= 4)
		BrowseWindow.focus();
}
