function showcompany(url) { window.open(url,"","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=692,height=350"); } function send_add_company(newcompany) { var errors='',sendform=true,i,j,jj; if (newcompany) { formname="add_company"; } else { formname="modify_data"; } for (i=0;i<=document.forms.length-1;i++) { if (document.forms[i].name==formname) { jj=i; } } // check teh fields completition if ((document.forms[jj].coName.value=="")||(document.forms[jj].coActivityCode.value=="")||(document.forms[jj].coLocality.value=="")||(document.forms[jj].coAddress.value=="") ||(document.forms[jj].coContactPerson.value=="")||(document.forms[jj].coTelefon.value=="")||(document.forms[jj].coFax.value=="") ||(document.forms[jj].coEMail.value=="")||(document.forms[jj].coUserName.value=="")||((document.forms[jj].coPassword.value=="")&&(newcompany))||((document.forms[jj].coPasswordRe.value=="")&&(newcompany))) { errors+='- Va rugam sa completati campurile marcate cu * !\n'; sendform=false; } // check the password length if (document.forms[jj].coPassword.value!="") { erteke=document.forms[jj].coPassword.value; if (erteke.length<6) { errors+='- Parola prea scurta!\n'; sendform=false; } } // check the password confirmation if ((newcompany)||(document.forms[jj].coPassword.value!="")) { pw=document.forms[jj].coPassword.value; pwre=document.forms[jj].coPasswordRe.value; pnc=false; if (pw.length==pwre.length) { h1=pw.length; h2=pwre.length; for (j=0;j<=(h1-1);j++) { if (pw.charAt(j)!=pwre.charAt(j)) { pnc=true; } } } else { pnc=true; } if (pnc==true) { errors+='- Va rugam sa reintroduceti parola!\n'; sendform=false; } } // check the e-mail if (document.forms[jj].coEMail.value!="") { emailvalue=document.forms[jj].coEMail.value; searched1=emailvalue.indexOf("@");searched2=emailvalue.indexOf("."); if ((searched1==-1)||(searched2==-1)) { az=1; errors+='- Va rugam sa introduceti adresa de e-mail corect!\n'; searched1=0;searched2=0; sendform=false; } } if (sendform==false) { window.alert(errors); } return sendform; } function send_add_workpoint(newworkpoint) { var errors='',sendform=true,i,j,jj; if (newworkpoint) { formname="add_workpoint"; } else { formname="modify_data"; } for (i=0;i<=document.forms.length-1;i++) { if (document.forms[i].name==formname) { jj=i; } } // check teh fields completition if ((document.forms[jj].wpName.value=="")||(document.forms[jj].wpLocality.value=="")||(document.forms[jj].wpAddress.value=="")||(document.forms[jj].wpTelefon.value=="") ||(document.forms[jj].wpSMM.value=="")||((document.forms[jj].wpSMMTypeSelect.value=="0")&&(document.forms[jj].wpSMMTypeText.value==""))||(document.forms[jj].wpFCStartDateDay.value=="") ||(document.forms[jj].wpFCStartDateMonth.value=="")||(document.forms[jj].wpFCStartDateYear.value=="")||(document.forms[jj].wpACStartDateDay.value=="")||(document.forms[jj].wpACStartDateMonth.value=="") ||(document.forms[jj].wpACStartDateYear.value=="")||(document.forms[jj].wpACEndDateDay.value=="")||(document.forms[jj].wpACEndDateMonth.value=="")||(document.forms[jj].wpACEndDateYear.value=="") ||((document.forms[jj].wpOrganismSelect.value=="0")&&(document.forms[jj].wpOrganismText.value==""))||(document.forms[jj].wpCActivityNr.value=="")) { errors+='- Va rugam sa completati campurile marcate cu * !\n'; sendform=false; } // check the e-mail if (document.forms[jj].wpEMail.value!="") { emailvalue=document.forms[jj].wpEMail.value; searched1=emailvalue.indexOf("@");searched2=emailvalue.indexOf("."); if ((searched1==-1)||(searched2==-1)) { az=1; errors+='- Va rugam sa introduceti adresa de e-mail corect!\n'; searched1=0;searched2=0; sendform=false; } } if (sendform==false) { window.alert(errors); } return sendform; } function send_add_partner() { return true; } function send_modify_data() { var sendforma=true,sendformb=true; sendforma=send_add_company(false); sendformb=send_add_workpoint(false); if (sendforma && sendformb) { document.forms[0].wpLocality.disabled=false; document.forms[0].wpAddress.disabled=false; document.forms[0].wpTelefon.disabled=false; document.forms[0].wpFax.disabled=false; document.forms[0].wpEMail.disabled=false; return true; } else { return false; } }