var isIE, isMozilla = false;

detectBrowser();

function detectBrowser(){
	var browserName = navigator.appName;
	isIE = (browserName=="Microsoft Internet Explorer");
	isMozilla = (browserName=="Netscape");
}

function toggleEditLinks( divName ) {

	/*
	var divArray = document.getElementsByTagName(divName);

	for( i=0; divArray[i] ; i++ ){
		divArray[i].style.display=='none' ? divArray[i].style.display='' : divArray[i].style.display='none';
	}
	*/
	
	for( i=1; document.getElementById(divName+i) ; i++ ){
		var currentDiv = document.getElementById(divName+i);
		currentDiv.style.display=='none' ? currentDiv.style.display='' : currentDiv.style.display='none';
	}

	return true // if you return false, then the form is not submitted.
}

function ProcessSearchSubmit() {
	linkToRedirect="/search.dlg?results=allResults&searchInput=";
	if ( document.getElementById('searchInputId') ) {
		linkToRedirect += document.getElementById('searchInputId').value;
	}

	setTimeout( "window.location.href = linkToRedirect", 0 );
	//window.location.href = linkToRedirect;
	
	//return false;
}

function ProcessPersonSearchSubmit() {
	linkToRedirect="/search.dlg?results=personResults&searchInput=";
	if ( document.getElementById('personSearchInputId') ) {
		linkToRedirect += document.getElementById('personSearchInputId').value;
	}

	setTimeout( "window.location.href = linkToRedirect", 0 );
}

function ProcessCompanySearchSubmit() {
	linkToRedirect="/search.dlg?results=companyResults&searchInput=";
	if ( document.getElementById('companySearchInputId') ) {
		linkToRedirect += document.getElementById('companySearchInputId').value;
	}

	setTimeout( "window.location.href = linkToRedirect", 0 );
}
function toggleDisplay( whichDiv )
{
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichDiv );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichDiv];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichDiv];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}