var email=new RegExp("^[a-zA-Z0-9\.\_]{1,20}[\@]{1}[a-zA-Z0-9\-\]{2,15}[\.]{1}[a-zA-Z]{2,4}$"); var alpha=new RegExp("^[a-zA-Z]{2,30}$"); var alphax=new RegExp("^[a-zA-Z0-9\_]{2,40}$"); var user = new RegExp ("^[a-zA-Z]{6,30}$"); var num=new RegExp("^[0-9]{7,15}$"); var ajax = new sack(); function notic(str){ return ''+str+''; } function get(element){ return window.document.getElementById(element); } function seekfor(ccid,val){ if (val=='') return false; window.document.getElementById('seekresult').innerHTML=''; ajax.reset(); ajax.setVar("ref",ccid); ajax.setVar("val",val); ajax.setVar("layer",'seekfor'); ajax.requestFile="includes/process.php"; ajax.method = 'POST'; ajax.element = 'seekresult'; ajax.onLoading = loading('seekresult'); ajax.runAJAX(); } function seekvakils(mode,val){ if (val=='') return false; window.document.getElementById('vakilresult').innerHTML=''; ajax.reset(); ajax.setVar("mode",mode); ajax.setVar("val",val); ajax.setVar("layer",'seekvakil'); ajax.requestFile="includes/process.php"; ajax.method = 'POST'; ajax.element = 'vakilresult'; ajax.onLoading = loading('vakilresult'); ajax.runAJAX(); } function seekkars(ref,f,val){ if (val=='') return false; window.document.getElementById('karresult').innerHTML=''; ajax.reset(); ajax.setVar("ref",ref); ajax.setVar("f",f); ajax.setVar("val",val); ajax.setVar("layer",'seekkars'); ajax.requestFile="includes/process.php"; ajax.method = 'POST'; ajax.element = 'karresult'; ajax.onLoading = loading('karresult'); ajax.runAJAX(); } function query(res,url){ window.document.getElementById(res).innerHTML=''; /* ajax.reset(); ajax.requestFile=url; ajax.method = 'GET'; ajax.element = res; ajax.onLoading = loading(res); ajax.runAJAX();*/ $ajaxreplace(res,url); } function loading(res){ window.document.getElementById(res).innerHTML=''; } function check_loginform(mode,element,layer){ ajax.reset(); var form=window.document.getElementById('loginform'); if (mode=='username' || mode=='both') if(form.username.value==''){alert('شناسه كاربري را وارد نماييد');form.username.focus();return false;}else{ajax.setVar("username",form.username.value);ajax.setVar("uf",form.param1.value);} if (mode=='password' || mode=='both') if(form.password.value==''){alert('كلمه رمز را وارد نماييد');form.password.focus();return false;}else{ajax.setVar("password",form.password.value);ajax.setVar("pf",form.param2.value);} if (mode=='tableaccess'){ if(form.username.value==''){alert('شناسه كاربري را وارد نماييد');form.username.focus();return false;}else{ajax.setVar("username",form.username.value);} if(form.password.value==''){alert('كلمه رمز را وارد نماييد');form.password.focus();return false;}else{ajax.setVar("password",form.password.value);} } ajax.setVar("mode",mode); ajax.setVar("table",form.table.value); ajax.setVar("layer",layer); ajax.requestFile="includes/process.php"; ajax.method = 'POST'; ajax.element = element; ajax.onLoading = loading(element); ajax.runAJAX(); } function reguser(){ ajax.reset(); var form=window.document.getElementById('reg_form'); if (form.name.value==''){alert('نام خود را وارد نماييد');form.name.focus();return false;} if (!num.test(form.phone.value)){alert('');form.phone.focus();return false;} if (!email.test(form.email.value)){alert('');form.email.focus();return false;} if (form.semat.value==''){alert('');form.semat.focus();return false;} if (!user.test(form.username.value)){alert('');form.username.focus();} if (form.password.value==''){alert('');form.password.focus();return false;} if (form.password.value!=form.repassword.value){alert('');form.repassword.focus();return false;} ajax.setVar("name",form.name.value); ajax.setVar("phone",form.phone.value); ajax.setVar("email",form.email.value); ajax.setVar("semat",form.semat.value); ajax.setVar("user",form.username.value); ajax.setVar("pass",form.password.value); ajax.setVar("layer","reguser"); ajax.requestFile="includes/process.php"; ajax.method = 'POST'; ajax.element = 'portalcontent'; ajax.onLoading = loading('portalcontent'); ajax.runAJAX(); } function login(){ var form = window.document.getElementById('userblock'); if (form.username.value==''){ get('logon_notic').innerHTML = notic('نام كاربري خود را وارد نماييد.'); form.username.focus();return false; } if (form.password.value==''){ get('logon_notic').innerHTML = notic('كلمه عبور خود را وارد نماييد.'); form.password.focus();return false; } ajax.reset(); ajax.setVar("username",form.username.value); ajax.setVar("password",form.password.value); ajax.setVar("portal",form.portal.value); ajax.setVar("layer","login"); ajax.requestFile = "includes/process.php"; ajax.method = 'POST'; // ajax.element = 'logon_notic'; ajax.onLoading = loading('logon_notic'); ajax.onCompletion = function(){ if (ajax.response=='false') get('logon_notic').innerHTML = notic('اطلاعات كاربري شما صحيح نمي باشد!'); else{ get('userpanel').innerHTML = ajax.response; } } ajax.runAJAX(); } function epanel_pwd(username,password){ var form=document.getElementById('pwd_form'); if (form.old_pwd.value==''){get('pwd_status').innerHTML='كلمه عبورفعلي خود را وارد نماييد.';form.old_pwd.focus();return false;} if (form.pwd1.value==''){get('pwd1').innerHTML='كلمه عبور جديد خود را وارد نماييد.';form.pwd1.focus();return false;} if (form.pwd2.value==''){get('pwd2').innerHTML='تكرار كلمه عبور خود را وارد نماييد.';form.pwd2.focus();return false;} if (form.pwd1.value!=form.pwd2.value){get('pwd_status').innerHTML='كلمه عبور جديد و تكرار آن يكسان نيستند.';return false;} if (form.old_pwd.value!=password){get('pwd_status').innerHTML='كلمه عبور فعلي خود را اشتباه وارد نموده ايد.';form.old_pwd.focus();return false;} ajax.reset(); ajax.setVar("username",username); ajax.setVar("password",password); ajax.setVar("old_pwd",form.old_pwd.value); ajax.setVar("new_pwd",form.pwd2.value); ajax.setVar("layer",'pwd'); ajax.requestFile = "includes/process.php"; ajax.method = 'POST'; ajax.element = 'pwd_status'; ajax.onLoading = loading('pwd_status'); ajax.onCompletion = function(){ form.old_pwd.value=''; form.pwd1.value=''; form.pwd2.value=''; } ajax.runAJAX(); } function epanel_get(table,username,password){ ajax.reset(); ajax.setVar("username",username); ajax.setVar("password",password); ajax.setVar("table_name",table); ajax.setVar("layer",'eservice'); ajax.requestFile = "includes/process.php"; ajax.method = 'POST'; ajax.element = 'epanel_views'; ajax.onLoading = loading('epanel_views'); ajax.runAJAX(); } function epanel_getfilter(table,username,password){ var form = document.getElementById('filter_form'); var i; ajax.reset(); ajax.setVar("username",username); ajax.setVar("password",password); ajax.setVar("table_name",table); for(i=0; iپرسش خود را وارد نماييد.'; form.faq_question.focus(); return false; } ajax.reset(); ajax.setVar("portalid","0"); ajax.setVar("question",form.faq_question.value); ajax.setVar("layer","send_faq"); ajax.requestFile = "includes/process.php"; ajax.method='POST'; ajax.element = 'faq_code_note'; ajax.onLoading = loading('faq_code_note'); ajax.onCompletion = function(){form.faq_question.value='';} ajax.runAJAX(); } function get_faq(){ var form = window.document.getElementById('answer_form'); if (form.code.value==''){get('faq_result_note').innerHTML = 'كد پرسش خود را وارد نماييد.'; form.code.focus(); return false; } ajax.reset(); ajax.setVar("portalid",'0'); ajax.setVar("qid",form.code.value); ajax.setVar("layer","get_faq"); ajax.requestFile = "includes/process.php"; ajax.method='POST'; ajax.element = 'faq_result_note'; ajax.onLoading = loading('faq_result_note'); ajax.onCompletion = function(){form.code.value='';} ajax.runAJAX(); } function dosearch(mode,element,portalid,portal){ if (mode=='simple'){ var key=document.getElementById(element).value; if (key=='' || key=='متن جستجو...'){ document.getElementById(element).value='متن جستجو؟'; return false; } ajax.reset(); ajax.setVar("layer","search"); ajax.setVar("mode",mode); ajax.setVar("key",key); ajax.setVar("portal",portal); ajax.setVar("portalid",portalid); ajax.requestFile = "includes/process.php"; ajax.method = 'POST'; ajax.element = 'portalcontent'; ajax.onLoading = loading('portalcontent'); ajax.onCompletion = function(){document.getElementById(element).value='متن جستجو...';} ajax.runAJAX(); } if (mode=='tag'){ ajax.reset(); ajax.setVar("layer","search"); ajax.setVar("mode",mode); ajax.setVar("key",element); ajax.setVar("portal",portal); ajax.setVar("portalid",portalid); ajax.requestFile = "includes/process.php"; ajax.method = 'POST'; ajax.element = 'portalcontent'; ajax.onLoading = loading('portalcontent'); ajax.onCompletion = function(){} ajax.runAJAX(); } } function savecontacts(){ var form = window.document.getElementById('contact_form'); if (form.subject.value==''){get('contact_notic').innerHTML = 'موضوع تماس را وارد نماييد.'; form.subject.focus(); return false; } if (form.message.value==''){get('contact_notic').innerHTML = 'متن پيام را وارد نماييد.'; form.message.focus(); return false; } ajax.reset(); ajax.setVar("postid",form.post.value); ajax.setVar("name",form.name.value); ajax.setVar("phone",form.phone.value); ajax.setVar("email",form.email.value); ajax.setVar("subject",form.subject.value); ajax.setVar("message",form.message.value); ajax.setVar("date",form.date.value); ajax.setVar("layer","contact"); ajax.requestFile = "includes/process.php"; ajax.method='POST'; ajax.element = 'contact_notic'; ajax.onLoading = loading('contact_notic'); ajax.onCompletion = function(){form.name.value='';form.phone.value='';form.email.value='';form.subject.value='';form.message.value='';} ajax.runAJAX(); } function sendmail(){ var form = window.document.getElementById('email_form'); if (form.subject.value==''){get('mail_notic').innerHTML = 'موضوع ایمیل را وارد نماييد.'; form.subject.focus(); return false; } if (form.message.value==''){get('mail_notic').innerHTML = 'متن ایمیل را وارد نماييد.'; form.message.focus(); return false; } ajax.reset(); ajax.setVar("mailid",form.mailid.value); ajax.setVar("subject",form.subject.value); ajax.setVar("message",form.message.value); ajax.setVar("date",form.date.value); ajax.setVar("layer","sendmail"); ajax.requestFile = "includes/process.php"; ajax.method='POST'; ajax.element = 'mail_notic'; ajax.onLoading = loading('mail_notic'); ajax.onCompletion = function(){form.subject.value='';form.message.value='';} ajax.runAJAX(); } function savecomment(){ var form = window.document.getElementById('commentform'); if (form.comment.value==''){get('comment_notic').innerHTML = 'متن پيام را وارد نماييد.'; form.comment.focus(); return false; } ajax.reset(); ajax.setVar("cid",form.cid.value); ajax.setVar("ip",form.ip.value); ajax.setVar("date",form.date.value); ajax.setVar("email",form.email.value); ajax.setVar("name",form.name.value); ajax.setVar("comment",form.comment.value); ajax.setVar("layer","comment"); ajax.requestFile = "includes/process.php"; ajax.method='POST'; ajax.element = 'comment_notic'; ajax.onLoading = loading('comment_notic'); ajax.onCompletion = function(){form.name.value='';form.email.value='';form.comment.value='';} ajax.runAJAX(); } function do_filter(){ var form = window.document.getElementById('filter_form'); var fieldlist=form.field_list.value; var fields; var i,count; fields=fieldlist.split(','); count=fields.length; for (i=0;i