  function PopUp(url,wsize,hsize,resize)
  {
    window.open(url, 'childwin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,width='+wsize+',height='+hsize+',resizable='+resize);
  }

  function WinOpen(url,wsize,hsize,resize)
  {
     window.open(url, 'childwin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,width='+wsize+',height='+hsize+',resizable='+resize)
  }

  function openWinView(url)
  {
    winview=window.open(url, 'winview', 'toolbar=yes,location=yes,directories=no,status=yes,menubar=yes,resizable=yes,width=600,height=500,scrollbars=yes');
    winview.focus();
  }

  function changeButton(myImage)
  {

    re=/On\.gif/;

    found=re.exec(myImage.src);

    if  (found == 'On.gif')
    {
      re = /On\.gif/;
      newSrc=myImage.src.replace(re,'Off.gif');
      myImage.src=newSrc;
    }else{
      re = /Off\.gif/;
      newSrc=myImage.src.replace(re,'On.gif');
      myImage.src=newSrc;
    }

  }
  function RUSure()
  {
    if(confirm("Are you sure you want to\nclear the entire form?"))
    {
      document.registration.reset();
    }
    else
    {
      return;
    }
  }



	function getCookieVal (offset)
	{
    var endstr = document.cookie.indexOf (";", offset);
    if (endstr == -1)
    endstr = document.cookie.length;
    return unescape(document.cookie.substring(offset,   endstr));
	}


	function getCookieSurvey (name)
	{
    var arg = name + "=";
    var alen = arg.length;
    var clen = document.cookie.length;
    var i = 0;
    while (i < clen)
    {
        var j = i + alen;
        if (document.cookie.substring(i, j) == arg)
          return getCookieVal (j);
        i = document.cookie.indexOf(" ", i) + 1;
        if (i == 0) break;
    }
    return null;
	}

function SetCookie (name, value) {
	var expdate = new Date()
	var argv = SetCookie.arguments; 
	var argc = SetCookie.arguments.length; 
	var expires = (argc > 2) ? argv[2] : null; 
	expdate.setDate(expdate.getDate() + expires);
	var path = (argc > 3) ? argv[3] : null; 
	var domain = '.manta.com'; 
	var secure = (argc > 5) ? argv[5] : false; 
	var cookieVal = name + "=" + escape (value) + 
		((path == null) ? "" : ("; path=" + path)) + 
		((expires == null) ? "" : ("; expires=" + expdate)) + 
		((domain == null) ? "" : ("; domain=" + domain)) + 
		((secure == true) ? "; secure" : "");
	document.cookie = cookieVal;
}

function clearDefault(textfield) { if (textfield.defaultValue==textfield.value) textfield.value = "" }

function unclearDefault(textfield) { if (textfield.value=='') textfield.value = textfield.defaultValue }

function positionBottomRight(target, eventCoords) {
	target.style.left = (eventCoords[0] + 10) + 'px';
	target.style.top = eventCoords[1] + 'px';
}

function showTooltip(e, name, kwArgs)
{
	kwArgs = kwArgs || {
		positionCallback: positionBottomRight
	};

	var c = findCoords(e);
	if (!e) var e = window.event;
	var target = document.getElementById(name);
	kwArgs.positionCallback(target, c);
	target.style.display="";
}

function hideTooltip(e, name)
{
	if (!e) var e = window.event;
	var target = document.getElementById(name);
	target.style.display="none";
}

// http://www.quirksmode.org/js/events_properties.html#position
// Tested in IE 6/7 and Firefox --stsmith
function findCoords(e) {
	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY) 	{
		posx = e.clientX + document.body.scrollLeft
			+ document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
	}
	// posx and posy contain the mouse position relative to the document
	// Do something with this information

	return [posx, posy];
}

function SubmitCompanySearch(search_form, interstitial_form)
{
	if(search_form.search.value != '' && search_form.search.value != search_form.search.defaultValue)
	{
		search_form.submit();
	}
	else
	{
		alert('Please enter a company name, category or location.');
	}
	return false;
}
