function openPopup(url,w,h)
{
  if (!w)
    w = 550;
  if (!h)
    h = 400;

  var def = "width=" + w + ",height=" + h +
      ",resizable,scrollbars=yes,status=no,menubar=no,location=no,toolbar=no";
  window.open(url, "_blank", def);
  return false;
}

function lookupPostalCode(f1,f2)
  {
	asyncRpcCall("maps.lookupPostalCode", $F(f1), function (s) { $(f2).value = s; if (s.length>0) $(f2).readOnly=true; else $(f2).readOnly=false; });
  }

function submitAndReload(anchor, clickfield)
  {
	var form = "aoform";
	var field = "_reload";

	var f1 = "price_" + anchor;
	var f2 = "price_" + anchor + "_e1";

	var f = $(form);
    if (f)
	  {
		var value = (anchor && typeof anchor == "string") ? anchor : 1;

		if ($(f2) && (f1))
		  {
			if (f1.value == "")
			  f1.value = f2.value;
			else
			  f1.value = "";
		  }

		f[field].value = value ;
		f.submit();
	  }
  }


function initValidation(form, extra)
  {
  }
  
function showTooltip(event,text, elid)
{
  if (elid)
    var el = document.getElementById(elid);
  else
    var el = document.getElementById('infotooltip');
    
  if (el)
  {
    var scrOfX = 0, scrOfY = 0;

    if( typeof( window.pageYOffset ) == 'number' ) {
      //Netscape compliant
      scrOfY = window.pageYOffset;
      scrOfX = window.pageXOffset;
    } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
      //DOM compliant
      scrOfY = document.body.scrollTop;
      scrOfX = document.body.scrollLeft;
    } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
      //IE6 standards compliant mode
      scrOfY = document.documentElement.scrollTop;
      scrOfX = document.documentElement.scrollLeft;
    }
    
    var height = parseInt(event.clientY) + scrOfY;
    var width = parseInt(event.clientX) + scrOfX;
    
    el.style.position = 'absolute';
    el.innerHTML = text;
    el.style.top = height + 10 + "px";
    el.style.left = width + 20 + "px";
    el.style.display = 'block';
  }
}
function hideTooltip(elid)
{
   if (elid)
     var el = document.getElementById(elid);
   else
     var el = document.getElementById('infotooltip');
   if (el)
     el.style.display = "none";
}

function indicateRpcSave()
{
  var indicator = document.createElement('div');
  indicator.style.position = 'absolute';
  indicator.style.top = '50%';
  indicator.style.left = '50%';
  indicator.style.backgroundColor = "white";
  indicator.style.padding = '15px';
  indicator.style.border = '1px solid black';
  indicator.setAttribute('id', 'rpcindicator');
  indicator.innerHTML = '<center>Sparar...</center><br><img src="/climages/ajaxprogress.gif" />';
  document.body.appendChild(indicator);
}
function deindicateRpcSave(doit)
{
  if (!doit)
    setTimeout('deindicateRpcSave(1)', 400);
  else
  {
    var indicator = getElementById('rpcindicator');
    document.body.removeChild(indicator);
  }
}

  
