

function openWin (theURL, w, h, winName) {

    if (navigator.appName == 'Netscape' && parseInt(navigator.appVersion) < 4){
        w = parseInt(w) + 20;
        h = parseInt(h) + 20;
    }

    str = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width="+w+",height="+h;
    nWin = window.open(theURL,winName,str);
    if ( navigator.appName == 'Netscape' ) {
	 nWin.focus();
    }
}

function externalURL(theUrl) {
    openWin("/popup.php?"+escape(theUrl),300,225,"bumper");
}

 function checkNum(num){
  	//num.value = num.value.replace(/[\D\.-]+/g,'')-0;
	num.value=stripNonNumeric(num.value);
  }
  
 function stripNonNumeric(str) {
   str += '';
   var rgx = /^\d|\.|-$/;
   var out = '';
   for(var i=0;i<str.length;i++) {
     if( rgx.test( str.charAt(i) ) ){
       if( !( ( str.charAt(i) == '.' && out.indexOf( '.' ) != -1 ) ||
              ( str.charAt(i) == '-' && out.length != 0 ) ) ){
         out += str.charAt(i);
       }
     }
   }
   return out;
 }
 
 function checkOther(dropDown){
 	if(dropDown.value == "other") {
	document.getElementById(dropDown.name + "_other").value = prompt("Please Specify");
	} else {
	document.getElementById(dropDown.name + "_other").value = "";	
	}
 }
 
function checkDetails(elem){
	if (elem.name == "collateral_type") {
		
		if (elem.value == "Unentitled" || elem.value == "Entitled" || elem.value == "Residential subdivision") {
			$("#collateral_property_acreage").show();
			$(".noi_details").hide();
		} else {
			$("#collateral_property_acreage").hide();
		}
		
		if (elem.value != "Unentitled" && elem.value != "Entitled") {
			$("#collateral_property_units").show();
			$("#collateral_property_occupied").show();
			$("#collateral_property_producing").show();
			//$(".noi_details").show();
		}
		else {
			$("#collateral_property_units").hide();
			$("#collateral_property_occupied").hide();
			$("#collateral_property_producing").hide();
			$(".noi_details").hide();
		}
		
		if (elem.value != "Unentitled" && elem.value != "Entitled" && elem.value != "Residential subdivision") {
			$("#collateral_property_sqft").show();
			
		}
		else {
			$("#collateral_property_sqft").hide();
			
		}
	}
	
	if (elem.name == "collateral_producing") {
		if (elem.value == "y") {
			$(".noi_details").show();
		} else {
			$(".noi_details").hide();
		}
	}
	
}
 