var headline = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-,. ";
var money = "$,0123456789.";
function res(t,v){
var w = "";
for (i=0; i < t.value.length; i++) {
x = t.value.charAt(i);
if (v.indexOf(x,0) != -1)
w += x;
}
t.value = w;
}


function SHOWPER() {

 if (document.getElementById("PERSONAL").style.display == "block") {
 document.getElementById("ES").innerHTML = "Edit";
 document.getElementById("PERSONAL").style.display = "none";
 } else {
 document.getElementById("ES").innerHTML = "Close";
 document.getElementById("PERSONAL").style.display = "block";
 }
}


function currency(num) {
num = num.toString().replace(/\$|\,/g,'');
if(isNaN(num))
num = "0";
sign = (num == (num = Math.abs(num)));
num = Math.floor(num*100+0.50000000001);
num = Math.floor(num/100).toString();
for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
num = num.substring(0,num.length-(4*i+3))+','+
num.substring(num.length-(4*i+3));
return (((sign)?'':'-') + '$' + num);
}


function imposeMaxLength(Object, MaxLen) {
  return (Object.value.length <= MaxLen);
}

function dispECSECTIONS(WHICH) {

 if (document.getElementById("HAVES")) {document.getElementById("HAVES").style.display = "none"; document.getElementById("HAVESa").style.backgroundColor = "white";  document.getElementById("HAVESa").style.color = "black";}
 if (document.getElementById("WANTS")) {document.getElementById("WANTS").style.display = "none"; document.getElementById("WANTSa").style.backgroundColor = "white";  document.getElementById("WANTSa").style.color = "black";}

 document.getElementById(WHICH).style.display = "block";
 document.getElementById(WHICH+"a").style.backgroundColor = "black";
 document.getElementById(WHICH+"a").style.color = "white";
}

// CB_ID_ANUM_SEC
function CONTACT(ele) {

 var ON = "block";
 var OFF = "none";

 ele.value = "close contact";

 var lname = ele.id;
 var vals = lname.split("_");
 var COBJ = document.getElementById("CONTACT_"+vals[1]);
 var IOBJ = document.getElementById("INFO_"+vals[1]);
 
 SWITCH = 1; cdisplay = ON; idisplay = OFF
 if (COBJ.style.display == "block") {SWITCH = 0;}
 
 if (SWITCH == 0) {
  ele.value = "contact me";
  cdisplay = OFF;
  idisplay = ON;
 }
 
 COBJ.style.display = cdisplay;
 IOBJ.style.display = idisplay;
 COBJ.src = "/ECCONTACT.php?ID="+vals[1]+"&"+vals[2]+"="+vals[3];

}



