function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}

function activateAdvanced()
{
	advancedObj = findObj("advancedSearchForm");
	advancedObj.style.display = "block";
	advancedTabObj = findObj("advancedSearch");
	advancedTabObj.className = "active";
	advancedHrefObj = findObj("advancedSearchLink");
	advancedHrefObj.innerHTML = "Advanced Search";
	quickObj = findObj("basicSearchForm");
	quickObj.style.display = "none";
	quickTabObj = findObj("quickSearch");
	quickTabObj.className = "";
	quickHrefObj = findObj("quickSearchLink");
	quickHrefObj.innerHTML = "Quick";
}

function activateQuick()
{
	advancedObj = findObj("advancedSearchForm");
	advancedObj.style.display = "none";
	advancedTabObj = findObj("advancedSearch");
	advancedTabObj.className = "";
	advancedHrefObj = findObj("advancedSearchLink");
	advancedHrefObj.innerHTML = "Advanced";
	quickObj = findObj("basicSearchForm");
	quickObj.style.display = "block";
	quickTabObj = findObj("quickSearch");
	quickTabObj.className = "active";
	quickHrefObj = findObj("quickSearchLink");
	quickHrefObj.innerHTML = "Quick Search";
}

/*  popup windows	*/

function newWindow(mypage,myname,w,h,scroll,pos)
{
	if (pos == "random")
	{
		LeftPosition = (screen.width)?Math.floor(Math.random()*(screen.width-w)) :100;
		TopPosition = (screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
	}
	
	if (pos == "center")
	{
		LeftPosition = (screen.width)?(screen.width-w)/2:100;
		TopPosition=(screen.height)?(screen.height-h)/2:100;
	}
	
	else if ((pos != "center" && pos != "random") || pos == null)
	{
		LeftPosition = 25; TopPosition = 25;
	}

	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=yes,menubar=no,toolbar=no,resizable=yes';

	win = window.open(mypage,myname,settings);
	if (win.focus)
	{
		win.focus();
	}
}