p=0;

function obj(x) {
 return (document.getElementById(x));
}

function pick(x) {
 p=1;
 abc=window.open('felicitari_colors.php?e='+x,'ColorPicker','top=10,left=10,width=189,height=191,scrollbars=no');
}

function update() {
 obj('e_title').innerHTML=document.forms['e_editor'].e_title.value;
 obj('e_msg').innerHTML=document.forms['e_editor'].e_msg.value;
}

function updatecols() {
 obj('e_title').style.color='#'+document.forms['e_editor'].c1.value;
 obj('e_msg').style.color='#'+document.forms['e_editor'].c1.value;
 obj('e_bk').style.background='#'+document.forms['e_editor'].c2.value;
 obj('e_preview').style.border='3px solid #'+document.forms['e_editor'].c3.value;
 for (i=1; i<=3; i++)
  obj('e'+i).style.background='#'+document.forms['e_editor'].elements['c'+i].value;
}

function checkemail(x) {
var filter=/^.+@.+\..{2,3}$/
if (filter.test(x)) return(true);
 else return(false);
}

function checkecard(l0,l1,l2,l3,l4,l5,l6) {
 ob=document.forms['e_editor'];
 tmp='';
 if (!ob.e_title.value) tmp+='- '+l1+'\n';
 if (!ob.e_msg.value) tmp+='- '+l2+'\n';
 if (!ob.e_sname.value) tmp+='- '+l3+'\n';
 if (!checkemail(ob.e_semail.value)) tmp+='- '+l4+'\n';
 if (!ob.e_rname.value) tmp+='- '+l5+'\n';
 if (!checkemail(ob.e_remail.value)) tmp+='- '+l6+'\n';
 if (tmp) {
  alert(l0+'\n\n'+tmp);
  return (false);
 } else return (true);
}

window.onunload=function () {
 if (p) abc.close();
}
