
if ((navigator.appName == "Netscape" && parseInt(navigator.appVersion) < 3) 
    ||  (navigator.appName=="Microsoft Internet Explorer" && parseInt(navigator.appVersion) < 4)) 
    {
    alert("This page is optimized for Netscape Navigator 3.0 or later and for Internet Explorer 4.0");
    }

var secondWindow;

// if second window is open, then close it
function closeSecondWindow() 
    {
    if (secondWindow && !secondWindow.closed) 
        {
        secondWindow.close();
        secondWindow = false;
        return(secondWindow);
        }
    }

// This function opens a small window that contains the definition.
function popUpWindow(title, definition) 
    {
    var body = "<html><head><title>Olive Systems Limited : Enjudica demonstration site - Glossary</title>";
    body += "<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>";
    body += "<link rel='stylesheet' href='styles.css'></head>";
    body += "<body leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>";
    body += "<table class='casepopup' width='100%' border='0' cellspacing='0' cellpadding='5' vspace='0' hspace='0'>";
    body += "<tr><td class='casepopupheading' height='30'>";
    body += title;
    body += "</td></tr>";
    body += "<tr valign='top'><td class='casepopup' height='180'>";
    body += definition;
    body += "</td></tr>";
    body += "<tr><td height='30' class='casepopupheading' align='right'>";
    body += "<a class='footer' href='javascript:opener.closeSecondWindow()'>Close window</a></td></tr>";
    body += "</table></body></html>";

    if (!secondWindow || secondWindow.closed) 
        {
        secondWindow = window.open("","", "toolbar=no,width=340,height=240,directories=no,status=no,scrollbars=auto,resize=yes,menubar=no");
        if (!secondWindow.opener)
            {
            secondWindow.opener = window;
            }
        // write HTML to second window
        secondWindow.document.write(body);
        secondWindow.document.close();  // end of writing to second window
        } 
    else 
        {
        // window is already open; rewrite this window
        secondWindow.document.write(body);
        secondWindow.document.close();  // end of writing to second window
        secondWindow.focus();
        }
    }

function checkQuoteForm()
    {
    var error_message;
    document.quoteform.saleprice.value = trim(document.quoteform.saleprice.value);
    document.quoteform.purchaseprice.value = trim(document.quoteform.purchaseprice.value);

    var saleprice = document.quoteform.saleprice.value;
    var purchaseprice = document.quoteform.purchaseprice.value;

    if (saleprice.length > 0 && validprice(saleprice) == false)
        {
        error_message='Invalid sale price\nThe sale price must have one of\nthe following formats\n' 
          + "9999... or 999,999,999...";
        document.quoteform.saleprice.focus();
        document.quoteform.saleprice.select();
        }
    else if (purchaseprice.length > 0 && validprice(purchaseprice) == false)
        {
        error_message='Invalid purchase price\nThe purchase price must have one of\nthe following formats\n' 
          + "9999... or 999,999,999...";
        document.quoteform.purchaseprice.focus();
        document.quoteform.purchaseprice.select();
        }
    else if (saleprice.length == 0 && purchaseprice.length == 0)
        {
        error_message='Please enter a value into either the sale or\npurchase price fields, or into both fields';
        document.quoteform.saleprice.focus();
        }

    if (error_message)
        {
        var msg;
        
        msg ="----------------------------------------------------------\n";
        msg+="                  QUOTE REQUEST ERROR\n";
        msg+="----------------------------------------------------------\n";
        msg+="\n" + error_message + "\n\n";
        alert(msg);
        return false;
        }
 
    return true;
    }

function trim(item)
    {
    var start = 0;
    var end = 0;

    for (; start<item.length; start++)
        {
        if (item.charAt(start) != ' ')
            break;
        }

    for (end=item.length-1; end>0; end--)
        {
        if (item.charAt(end) != ' ')
            break;
        }

    end++;
    if (end <= start)
        return("");

    return item.substring(start, end);
    }

function valid(item, valid_chars)
    {
    for (var i=0; i<item.length; i++)
        {
        if (valid_chars.indexOf(item.charAt(i)) == -1)
            return false;
        }

    return true;
    }

function validprice(price)
    {
    if (/^(\d+)$/.test(price))
        return(true);
        
    return (/^(\d{1,3})(,\d{3})+$/.test(price));
    }
    
function validemail(email)
    {
    return (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email));
    }

// Seller Property Information Form related stuff

var spifHelpWin;

function sellerjumpform(id, site_id)
  {
  var url = "sellerinfoform_page" + document.sellerinfoform.jump.value + ".jsp?sellerinfoid=" + id;
  if (site_id)
    url += "&site=" + site_id;
  document.location.href = url;
  }

function spifHelpWindow()
  {
  if (!spifHelpWin || spifHelpWin.closed)
    {
    spifHelpWin  = window.open("spifhelp.htm","", 
      "toolbar=no,width=350,height=350,directories=no,status=no,scrollbars=auto,resize=yes,menubar=no");
    }
    
  spifHelpWin.focus();
  }

var printHelpWin;

function printHelpWindow()
  {
  if (!printHelpWin || printHelpWin.closed)
    {
    printHelpWin  = window.open("printhelp.htm","", 
      "toolbar=no,width=350,height=210,directories=no,status=no,scrollbars=auto,resize=yes,menubar=no");
    }
    
  printHelpWin.focus();
  }

var ffacHelpWin;

function ffacjumpform(id, site_id)
  {
  var url = "page" + document.ffacform.jump.value + ".jsp?caseid=" + id;
  if (site_id)
    url += "&site=" + site_id;
  document.location.href = url;
  }

function ffacHelpWindow()
  {
  if (!ffacHelpWin || ffacHelpWin.closed)
    {
    ffacHelpWin  = window.open("ffachelp.htm","", 
      "toolbar=no,width=350,height=350,directories=no,status=no,scrollbars=auto,resize=yes,menubar=no");
    }
    
  ffacHelpWin.focus();
  }
  
function FFACCheckRadio(ob,id)
  {
	var groupName = ob.name;
	
	if(ob.checked == true)
	  {
		if(id == 'b')
		  {
			ob.nextSibling.style.display = "inline-block";
      }
		else
		  {
			document.ffacform.item(groupName + "b").nextSibling.style.display = "none";
      }
    }
  }

function setFFACRadioitem(groupName, setting, price)
  {
  if (setting == "Included")
    {
    document.ffacform.item(groupName + "a").checked = true;
    }
  else if (setting == "Excluded")
    {
    document.ffacform.item(groupName + "b").checked = true;
    if (price != "")
      {
      document.ffacform.item(groupName + "_price").value = price;
			document.ffacform.item(groupName + "b").nextSibling.style.display = "inline-block";
      }
    }
  else
    {
    document.ffacform.item(groupName + "c").checked = true;
    }
  }

function setFFACRadioName(groupName, val)
  {
  document.ffacform.item(groupName + "_name").value = val;
  }



