//==============================valid form============================= function isblank(fe){ // check that the value is not empty if (fe.value == "") { // its blank return true; } else { // it has data return false; } } function ischecked(fe){ // check that the value is not empty if (fe.checked) { // its blank return false; } else { // it has data return true; } } //==================set field class ========================== function setclass(wf,a) { if (a==1){ //wf.setAttribute("class", "field_blank"); wf.style.borderColor="#FF0000"; wf.style.backgroundColor="#FFEEEE"; location.href="#error"; wf.focus(); } else if (a==0) { //wf.setAttribute("class", "field"); wf.style.borderColor="#777777"; wf.style.backgroundColor="#FFFFCC"; } } function cvalue(tv,tn) { if (tv != "") { setclass(document.getElementById(tn),'0'); derror('hide'); } } function checkfield(v) { if (isblank(v)){ setclass(v,'1'); return true; } else { setclass(v,'0'); return false; } } function checkbox(v) { if (ischecked(v)){ setclass(v,'1'); return false; } else { setclass(v,'0'); return true; } } //==========================CHECK FIELDS=========================== //================================================================= function checkvalue2(wpage) { if (wpage == "page1") { if ((checkfield(document.getElementById('first_name'))) || (checkfield(document.getElementById('last_name'))) || (checkfield(document.getElementById('home_phone'))) || (checkfield(document.getElementById('email'))) || (checkfield(document.getElementById('laptop_model'))) || (checkfield(document.getElementById('description')))) { var noblank = "no"; derror('show'); } else { var noblank = "yes"; if ((checkbox(document.getElementById('tobe1'))) || (checkbox(document.getElementById('tobe2'))) || (checkbox(document.getElementById('tobe3'))) || (checkbox(document.getElementById('tobe4'))) || (checkbox(document.getElementById('tobe5')))) { } else { var noblank = "no"; document.getElementById('_rtt').style.borderColor="#F00"; document.getElementById('_rtt').style.backgroundColor="#FFEEEE"; derror('show'); } } } else if (wpage == "page2") { if ((checkfield(document.getElementById('street'))) || (checkfield(document.getElementById('city'))) || (checkfield(document.getElementById('zip_code')))) { var noblank = "no"; derror('show'); } else { var noblank = "yes"; if (document.getElementById('state').selectedIndex=="0") { var noblank = "no"; derror('show'); document.getElementById('state').style.borderColor="#F00"; document.getElementById('state').style.backgroundColor="#FFEEEE"; } } } else { var noblank = "no"; } if (noblank == "yes") { document.page1form.submit(); } } //==========================CHECK FIELDS=========================== //================================================================= function derror(hd){ var row = document.getElementById("showerror"); if (hd=='show') { row.style.display = ''; } else { row.style.display = 'none'; } } function checkradio(r,td) { document.getElementById('tdground').style.background='#FCFCFC'; document.getElementById('td3day').style.background='#FCFCFC'; document.getElementById('tdnext').style.background='#FCFCFC'; document.getElementById('tdnone').style.background='#FCFCFC'; document.getElementById(td).style.background='#f6fdba'; }