function selectall(object,form){
        var counter=form.elements.length;
        for (var i=0; i<counter; i++){
                var e=form.elements[i];
                if (object.checked && e.type == "checkbox"){
                        e.checked=true;
                }
                if (!object.checked && e.type == "checkbox"){
                        e.checked=false;
                }
        }
}

function calculNetAmount(form){
	var result=0;
	//PP:Purchase Price
	//CC:Closing Costs
	//BC: Broker Commision
	//NP: Net Price
	result=(document.getElementById("PP")).value-(document.getElementById("CC")).value-(document.getElementById("BC")).value;
	(document.getElementById("NP")).value=result;
}

function showHideBuyer2Section(nbBuyers)
{
	if(nbBuyers>1){
		document.getElementById("buyer2").className = "visible"; 
	}
	else{
	   document.getElementById("buyer2").className = "hidden";
	}
}
function showHideEmplSection(pCatCode)
{
   var bfound=0;//if this code matches with a code in the string values, bfound=true
   var listCodes=document.getElementById("LCC").value;
   var tabcodes=new Array();
   var counter=0;
   
   if(listCodes.length>0){
   	tabcodes=listCodes.split(";")
   	counter=tabcodes.length;
   	for (var i=0; i<counter; i++){
			if(tabcodes[i]==pCatCode)
			{
				bfound=1;
				break;
			}     
        }
   }
	if(bfound==1){
		document.getElementById("emplSection").className = "visible"; 
	}
	else{
		document.getElementById("emplSection").className = "hidden";
	}
	//dispaly a message if the category is non profit organization
	if(pCatCode==6){
	   alert("If the nonprofit organization  is not registered with HUD, you can not use this designation when placing your bid");
	  }
}
function showMessage(varmsg)
{
   if (typeof varmsg != 'undefined') 
   {
   		alert(varmsg);
   }
}
function wopen(url, name, w, h)
{
  // Fudge factors for window decoration space.
  // In my tests these work well on all platforms & browsers.
  w += 32;
  h += 96;
  wleft = (screen.width - w) / 2;
  wtop = (screen.height - h) / 2;
  var win = window.open(url,
    name,
    'width=' + w + ', height=' + h + ', ' +
    'left=' + wleft + ', top=' + wtop + ', ' +
    'location=no, menubar=no, ' +
    'status=no, toolbar=no, scrollbars=no, resizable=yes');
  // Just in case width and height are ignored
  win.resizeTo(w, h);
  // Just in case left and top are ignored
  win.moveTo(wleft, wtop);
  win.focus();
}

function wopen2(url, name, w, h)
{
  // Fudge factors for window decoration space.
  // In my tests these work well on all platforms & browsers.
  w += 32;
  h += 96;
  wleft = (screen.width - w) / 2;
  wtop =10; //(screen.height - h) / 2;
  var win = window.open(url,
    name,
    'width=' + w + ', height=' + h + ', ' +
    'left=' + wleft + ', top=' + wtop + ', ' +
    'location=no, menubar=yes, ' +
    'status=no, toolbar=no, scrollbars=yes, resizable=no');
  // Just in case width and height are ignored
  win.resizeTo(w, h);
  // Just in case left and top are ignored
  win.moveTo(wleft, wtop);
  win.focus();
}