// This function is used to check if a certain text is numeric or not function IsNumeric(sText) { var ValidChars = "0123456789."; var IsNumber=true; var Char; for (i = 0; i127) { alert("Your email address contains invalid characters."); return false; } } for (i=0; i127) { alert("Your email domain name contains invalid characters."); return false; } } if (user.match(userPat)==null) { alert("الرجاء التأكد من صحة البريد الألكتروني!!"); return false; } var IPArray=domain.match(ipDomainPat); if (IPArray!=null) { for (var i=1;i<=4;i++) { if (IPArray[i]>255) { alert("Destination IP address is invalid!"); return false; } } return true; } var atomPat=new RegExp("^" + atom + "$"); var domArr=domain.split("."); var len=domArr.length; for (i=0;i=0 && List1.options[0].value != "-1") { // Add the selected item of List1 in List2 Element = new Option(List1.options[List1.options.selectedIndex].text,List1.options[List1.options.selectedIndex].value, false, true); if (List2.options[0].value != "-1") { List2.add(Element,List1.options[List1.options.selectedIndex].value); //List2.add(Element,List1.length); } else { List2.remove(0); List2.add(Element,0); } // Remove the selected item of List1 List1.remove(List1.options.selectedIndex); Element = new Option("----------------------------------------------","-1"); if (List1.options.length == 0) { List1.add(Element,0); } } } function SwapLists(List1,List2) { if (List1.options.length>0 && List1.options[0].value != "-1") { // Add items of List1 in List2 List2.remove(0); for(i=0;i -1) { parts[d++] = whole.substring(p, q); parts.length = d; p = q + 1; q = whole.indexOf(link, p); } parts[d++] = whole.substring(p); parts.length = d; return(parts); } //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-* function myJoin(parts, link) { if (parts.join) { return(parts.join(link)); } var whole = ""; var thisLink = ""; for(var d = 0; d < parts.length;d++) { if (parts[d] != "") { whole = whole + thisLink + parts[d]; thisLink = link; } } return(whole); } /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* * Newsletter Control *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ // This function is used to subscribe (1) or unsubscribe (0) a certain email address function SubscribeMe() { var frm = document.forms[0]; var email = frm.txtSubscriberEmail.value; if (email != "") { if (!isValidMail(email)) { frm.txtSubscriberEmail.focus(); }else{ if (frm.rdNewsletter[0].checked) frm.useraction.value = "subscribe"; else frm.useraction.value = "unsubscribe"; frm.action = "../Newsletter/subscribtion.php"; frm.submit(); } }else{ return false; } } /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* * Comment Article & Email Article *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ //checks News Comments submitting function CheckNewsComment() { with (document.form) { if (Trim(txtName.value) == "") { alert("الرجاء تزويد الإسم"); txtName.focus(); return false; } if(Trim(txtEmail.value) == "") { alert("الرجاء تزويد العنوان الإلكتروني"); txtEmail.focus(); return false; } if (!isValidMail(txtEmail.value)) { txtEmail.focus(); return false; } if(txtCommentTitle.value == "") { alert("الرحاء تزويد عنوان التعليق"); txtCommentTitle.focus(); return false; } if(txtComment.value == "") { alert("الرحاء تزويد تفاصيل التعليق"); txtComment.focus(); return false; } useraction.value = "PostComment"; submit(); } } //checks Email Article popup before submitting function CheckEmailContent() { with (document.form) { if (Trim(txtVisitorName.value) == "") { alert("الرجاء تزويد الإسم"); txtVisitorName.focus(); return false; } if(Trim(txtVisitorEmail.value) == "") { alert("الرجاء تزويد العنوان الإلكتروني"); txtVisitorEmail.focus(); return false; } if (!isValidMail(txtVisitorEmail.value)) { txtVisitorEmail.focus(); return false; } if (Trim(txtFriendName.value) == "") { alert("!الرجاء تزويد اسم صديقك"); txtFriendName.focus(); return false; } if(Trim(txtFriendEmail.value) == "") { alert("الرجاء تزويد بريد صديقك!"); txtFriendEmail.focus(); return false; } if (!isValidMail(txtFriendEmail.value)) { txtFriendEmail.focus(); return false; } if(txtComment.value == "") { alert("الرجاء تزويد مضمون ملاحطتك."); txtComment.focus(); return false; } useraction.value = "SendEmail"; submit(); } } //check GuestBook Registration before submitting function GuestBookRegisterCheck() { with (document.form) { if (Trim(txtName.value) == "") { alert("الرجاء تزويد الإسم!"); txtName.focus(); return false; } if(Trim(txtEmail.value) == "") { alert("الرجاء تزويد البريد الإلكتروني"); txtEmail.focus(); return false; } if (!isValidMail(txtEmail.value)) { txtEmail.focus(); return false; } if(Trim(txtTitle.value) == "") { alert("الرجاء تزويد عنوان!"); txtTitle.focus(); return false; } if(Trim(txtNotes.value) == "") { alert("الرجاء ادخال التعليق!"); txtTitle.focus(); return false; } useraction.value = "RegisterGuestBook"; action = "../GuestBook/manage_guestbook.php" submit(); } } //checks "Notify a Friend" popup before submitting function CheckTellFriendContent() { with (document.form) { if (Trim(txtVisitorName.value) == "") { alert("الرجاء تزويد الإسم"); txtVisitorName.focus(); return false; } if(Trim(txtVisitorEmail.value) == "") { alert("الرجاء تزويد العنوان الإلكتروني"); txtVisitorEmail.focus(); return false; } if (!isValidMail(txtVisitorEmail.value)) { txtVisitorEmail.focus(); return false; } if (Trim(txtFriendName.value) == "") { alert("!الرجاء تزويد اسم صديقك"); txtFriendEmail.focus(); return false; } if(Trim(txtFriendEmail.value) == "") { alert("الرجاء تزويد بريد صديقك!"); txtFriendEmail.focus(); return false; } if (!isValidMail(txtFriendEmail.value)) { txtFriendEmail.focus(); return false; } if(txtComment.value == "") { alert("الرجاء تزويد مضمون ملاحطتك."); txtComment.focus(); return false; } useraction.value = "SendEmail"; submit(); } } /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* * News Search Control *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ function SearchForNews() { with (document.form) { if (Trim(txtNewsSearch.value)=="") { return false; } action = "../News/search_results.php?mode=simple"; submit(); } } function SearchForNewsAdv() { with (document.form) { if (Trim(txtNewsSearch.value)=="") { return false; } action = "../News/search_results.php?mode=simple"; submit(); } } /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* * News Search Control *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ function SearchForNews() { with (document.form) { if (Trim(txtNewsSearch.value)=="") { return false; } else { if(rdSearch[0].checked) { action = "../News/search_results.php?mode=simple"; } else { action = "../News/search_results.php?mode=simple"; } submit(); } } } /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* * Materials Search Control *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ function SearchForMaterials() { with (document.form) { if (Trim(txtSearch.value)=="") { return false; } action = "../Home/search_results.php"; submit(); } } /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* * Calendar *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ function DisplayHijriDate(year, month, mday) { arrDate = ConvertToHijri(year, month, mday); var lbl = document.getElementById('lblHijriDate'); lbl.innerHTML = arrDate[2] + " " + arrDate[4] +", " + arrDate[0]; } function ConvertToHijri(year, month, mday) { //returns the Persian date in an array of the form (year, month, mday, wday, ymonth) var j; var weekday; var HIJRI_WEEKDAYS = new Array("الأحد", "الإثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة", "السبت"); var HIJRI_MONTHS = new Array("محرم", "صفر", "ربيع الأول", "ربيع الثاني", "جمادى الأولى", "جمادى الثانية", "رجب", "شعبان", "رمضان", "شوال", "ذو القعدى", "ذو الحجة", ""); hour = min = sec = 0; //alert('month: ' + eval(month)); j = gregorian_to_jd(year, eval(month), mday) + (Math.floor(sec + 60 * (min + 60 * hour) + 0.5) / 86400.0); weekday = jwday(j); islcal = jd_to_islamic(j); //return new Array(islcal[0], islcal[1], islcal[2], HIJRI_WEEKDAYS[weekday], HIJRI_MONTHS[month-2]); return new Array(islcal[0], islcal[1], islcal[2], HIJRI_WEEKDAYS[weekday], HIJRI_MONTHS[islcal[1]-1]); } function jd_to_islamic(jd) { var ISLAMIC_EPOCH = 1948439.5; var year, month, day; jd = Math.floor(jd) + 0.5; year = Math.floor(((30 * (jd - ISLAMIC_EPOCH)) + 10646) / 10631); month = Math.min(12, Math.ceil((jd - (29 + islamic_to_jd(year, 1, 1))) / 29.5) + 1); day = (jd - islamic_to_jd(year, month, 1)) + 1; return new Array(year, month, day); } function islamic_to_jd(year, month, day) { var ISLAMIC_EPOCH = 1948439.5; return (day + Math.ceil(29.5 * (month - 1)) + (year - 1) * 354 + Math.floor((3 + (11 * year)) / 30) + ISLAMIC_EPOCH) - 1; } function leap_islamic(year) { return (((year * 11) + 14) % 30) < 11; } function DisplayPersianDate(year, month, mday) { arrDate = ConvertToPersian(year, month, mday); var lbl = document.getElementById('lblPersianDate'); //lbl.innerHTML = arrDate[3] + ", " + arrDate[2] + " " + arrDate[4] +", " + arrDate[0]; lbl.innerHTML = "/ " + arrDate[2] + " " + arrDate[4] +", " + arrDate[0]; } function ConvertToPersian(year, month, mday) { //returns the Persian date in an array of the form (year, month, mday, wday, ymonth) var j; var weekday; var PERSIAN_WEEKDAYS = new Array("?کشنبه", "دوشنبه", "سه شنبه", "چهارشنبه", "پنجشنبه", "جمعه", "شنبه"); var PERSIAN_MONTHS = new Array("فروردين", "ارديبهشت", "خرداد", "تير", "مرداد", "شهربور", "مهر", "آبان", "آذر", "دي", "بهمن", "اسفند", ""); hour = min = sec = 0; j = gregorian_to_jd(year, eval(month), mday) + (Math.floor(sec + 60 * (min + 60 * hour) + 0.5) / 86400.0); weekday = jwday(j); perscal = jd_to_persian(j); // return new Array(perscal[0], perscal[1], perscal[2], PERSIAN_WEEKDAYS[weekday], PERSIAN_MONTHS[month-3]); return new Array(perscal[0], perscal[1], perscal[2], PERSIAN_WEEKDAYS[weekday], PERSIAN_MONTHS[perscal[1]-1]); } // GREGORIAN_TO_JD -- Determine Julian day number from Gregorian calendar date var GREGORIAN_EPOCH = 1721425.5; function gregorian_to_jd(year, month, day) { year = eval(year); month = eval(month); day = eval(day); return (GREGORIAN_EPOCH - 1) + (365 * (year - 1)) + Math.floor((year - 1) / 4) + (-Math.floor((year - 1) / 100)) + Math.floor((year - 1) / 400) + Math.floor((((367 * month) - 362) / 12) + ((month <= 2) ? 0 : (leap_gregorian(year) ? -1 : -2) ) + day); } // JD_TO_PERSIAN -- Calculate Persian date from Julian day function jd_to_persian(jd) { var year, month, day, depoch, cycle, cyear, ycycle, aux1, aux2, yday; jd = Math.floor(jd) + 0.5; depoch = jd - persian_to_jd(475, 1, 1); cycle = Math.floor(depoch / 1029983); cyear = mod(depoch, 1029983); if (cyear == 1029982) { ycycle = 2820; } else { aux1 = Math.floor(cyear / 366); aux2 = mod(cyear, 366); ycycle = Math.floor(((2134 * aux1) + (2816 * aux2) + 2815) / 1028522) + aux1 + 1; } year = ycycle + (2820 * cycle) + 474; if (year <= 0) { year--; } yday = (jd - persian_to_jd(year, 1, 1)) + 1; month = (yday <= 186) ? Math.ceil(yday / 31) : Math.ceil((yday - 6) / 30); day = (jd - persian_to_jd(year, month, 1)) + 1; return new Array(year, month, day); } function leap_gregorian(year) { return ((year % 4) == 0) && (!(((year % 100) == 0) && ((year % 400) != 0))); } function persian_to_jd(year, month, day) { var PERSIAN_EPOCH = 1948320.5; var epbase, epyear; epbase = year - ((year >= 0) ? 474 : 473); epyear = 474 + mod(epbase, 2820); return day + ((month <= 7) ? ((month - 1) * 31) : (((month - 1) * 30) + 6) ) + Math.floor(((epyear * 682) - 110) / 2816) + (epyear - 1) * 365 + Math.floor(epbase / 2820) * 1029983 + (PERSIAN_EPOCH - 1); } function mod(a, b) { return a - (b * Math.floor(a / b)); } function jwday(j) { return mod(Math.floor((j + 1.5)), 7); } function ShowObject(Obj) { Obj.style.display = ''; } function HideObject(Obj) { Obj.style.display = 'none'; } function showHideSearch() { var advanced = document.getElementById("advancedSearch"); var alternative = document.getElementById("alternativeSearch"); if(advanced.style.display=='') { advanced.style.display="none"; } else { advanced.style.display=""; } if(alternative.style.display=='') { alternative.style.display="none"; } else { alternative.style.display=""; } } function SearchForNewsisdarat() { with (document.form) { action = "../News/advanced_search_isdarat.php"; submit(); } } function SearchForNewscontent() { with (document.form) { action = "../News/advanced_search.php"; submit(); } }