//if the browser is IE4+ /* document.onselectstart=new Function ("return false") */ var selId = ''; var selId2 = ''; var selName = ''; var selName2 = ''; var selExtra = ''; var selExtra2 = ''; var curRow = ''; var curRow2 = ''; var curClassName = ''; var curClassName2 = ''; var checkvalue = false; // ============================================================ // various // ============================================================ function checkLength(elName, maxlength, elLeft) { el = document.getElementById(elName); if (el) { if (el.value.length > maxlength) { el.value = el.value.substring(0, maxlength); } else { le = document.getElementById(elLeft); if (le) { le.value = maxlength - el.value.length; } } } }; function enableControl(elementName, enabled) { el = document.getElementById(elementName); if (el) { el.disabled = !enabled; }; }; function openDialog(url, name, width, height) { x = (screen.width - width) / 2; y = (screen.height - height) / 2; window.open(url, name, 'scrollbars=0,toolbar=0,titlebar=0,status=0,resizable=0,menubar=0,location=0,fullscreen=0,directories=0,channelmode=0, width=' + width + ', height=' + height + ', screenX=' + x + ', left=' + x + 'screenY=' + y + ', top=' + y); }; function openWindow(url, name, width, height) { x = (screen.width - width) / 2; y = (screen.height - height) / 2; window.open(url, name, 'scrollbars=0,toolbar=0,titlebar=0,status=0,resizable=1,menubar=0,location=0,fullscreen=0,directories=0,channelmode=0, width=' + width + ', height=' + height + ', screenX=' + x + ', left=' + x + 'screenY=' + y + ', top=' + y); }; function selectRow(row, selectedId, selectedName, item) { if (curRow != '') { curRow.className = curClassName; }; if (item != '') { if (item == 'dow') enableDow() else if (item == 'plusMin') enablePlusMinus() else if ((item == 'group') || (item == 'account')) { enableStd(); enablePlus(); } else enableStd(); enableBtn('details', true); }; selId = selectedId; selName = selectedName; curRow = row; curClassName = row.className; row.className = 'gridrowselected'; }; function selectRow2(row, selectedId, selectedName, item, extra) { if (curRow2 != '') { curRow2.className = curClassName2; }; selId2 = selectedId; selName2 = selectedName; selExtra2 = extra; curRow2 = row; curClassName2 = row.className; row.className = 'gridrowselected'; if (item != '') { enableStd(); }; if (item == 'plusMin') { enableBtn('minus', true); }; }; function enableStd() { enableBtn('new', true); enableBtn('edit', true); enableBtn('delete', true); enableBtn('plus', true); } function enableBtn(id, enable) { if (document.getElementById) { el = document.getElementById(id); if (enable) { if (el) el.src = '/img/' + id + '.gif'; } else { if (el) el.src = '/img/' + id + '_disabled.gif'; }; }; } function enableBtnTop(id, enable) { if (top.document.getElementById) { el = top.document.getElementById(id); if (enable) { if (el) el.src = '/img/' + id + '.gif'; } else { if (el) el.src = '/img/' + id + '_disabled.gif'; }; }; } function setIFrameDiv() { parent.document.getElementById('placeholder').innerHTML = document.body.innerHTML; }; function focusForm() { supName = document.getElementById('supName'); if (supName) { supName.focus(); } } function check_email(e) { ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM"; for(i=0; i < e.length ;i++){ if(ok.indexOf(e.charAt(i))<0){ return (false); } } if (document.images) { re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/; re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/; if (!e.match(re) && e.match(re_two)) { return (-1); }; }; }; function getConfirmDelete(item) { return 'Are you sure you want to delete this ' + item + '?'; } function getConfirmRemove(item) { return 'Are you sure you want to remove this ' + item + '?'; } function isNumeric(val, allowEmpty) { nums = '1234567890'; if ((!allowEmpty) && (val.length == 0)) { return false; } for(i=0; i < val.length ;i++){ if(nums.indexOf(val.charAt(i))<0){ return false; } }; return true; } function checkRow(id) { el = document.getElementById('chb' + id); if (el) { if (el.checked) { el.checked = false; } else { el.checked = true; }; }; }; function checkAllRows(formname, fieldname) { checkvalue = !checkvalue; el = document.getElementById(formname); if (el) { var objCheckBoxes = el.elements[fieldname]; if(!objCheckBoxes) return; var countCheckBoxes = objCheckBoxes.length; if(!countCheckBoxes) objCheckBoxes.checked = checkvalue; else for(var i = 0; i < countCheckBoxes; i++) objCheckBoxes[i].checked = checkvalue; }; }; function doFocus(elementName, selectAll) { el = document.getElementById(elementName); if (el) { el.focus(); if (selectAll) { el.select(); }; } } function copyTextFromSelect(elFrom, nameTo) { elTo = document.getElementById(nameTo); if (elFrom && elTo) { if (elTo.value == '') { elTo.value = elFrom.options[elFrom.selectedIndex].text; }; } }; function checkCookies() { if (!document.cookie) { document.write(''); document.write('Error!

'); document.write('(Session) cookies are disabled. This site requires (Session) cookies in order to function properly!'); document.write('
'); document.write('


'); }; } // ============================================================ // logon/logoff // ============================================================ function logon() { if (!(document.cookie == "")) { openDialog("/dialogs/logon.asp","sms_Logon",335,180); } else { openDialog("/dialogs/error.asp?error=(Session)%20%cookies%20%are%20%disabled!","sms_Error",360,160); }; } function logoff() { if (confirm('Are you sure you want to log off?')) { top.document.location.href = "/dialogs/logoff.asp"; }; } function change_pw() { openDialog("/dialogs/change_pw.asp","sms_Password",335,200); } // ============================================================ // messages // ============================================================ function message_new() { openDialog("dialogs/message_edit.asp","sms_Dialog",480,330); }; function message_edit() { if (selId != '') { openDialog("dialogs/message_edit.asp?messageId=" + selId,"sms_Dialog",480,330); } }; function message_delete() { if ((selId != '') && (confirm(getConfirmDelete('message')))) { openDialog("dialogs/message_delete.asp?messageId=" + selId,"sms_Dialog",480,150); }; }; function message_check() { el = document.getElementById('message'); if ((el) && (el.value.length == 0)) { alert('Please enter "Message" text'); el.focus(); return false; }; el = document.getElementById('type'); if ((el) && (el.checked)) { el = document.getElementById('url'); if ((el) && (el.value.length == 0)) { alert('Please enter a valid "URL"'); el.focus(); return false; }; }; return true; }; // ============================================================ // subscriptions // ============================================================ function openGroupRecip(groupId) { if (groupId != selId) { document.getElementById('iframe').src = '/groupRecip.asp?groupId=' + groupId; } }; function subscription_new() { openDialog("dialogs/subscription_edit.asp","sms_Dialog",480,290); }; function subscription_edit() { if (selId != '') { openDialog("dialogs/subscription_edit.asp?groupId=" + selId,"sms_Dialog",480,290); } }; function subscription_delete() { if ((selId != '') && (confirm(getConfirmDelete('subscription')))) { openDialog("dialogs/subscription_delete.asp?groupId=" + selId,"sms_Dialog",480,150); }; }; function subscription_check() { el = document.getElementById('name'); if ((el)&&(el.value.length == 0)) { alert('Please enter a "Name"'); el.focus(); return false; }; return true; }; // ============================================================ // subscribers // ============================================================ function subscriber_new() { openDialog("dialogs/subscriber_edit.asp","sms_Dialog",480,290); }; function subscriber_edit() { if (selId != '') { openDialog("dialogs/subscriber_edit.asp?recipientId=" + selId,"sms_Dialog",480,290); } }; function subscriber_delete() { if ((selId != '') && (confirm(getConfirmDelete('subscriber')))) { openDialog("dialogs/subscriber_delete.asp?recipientId=" + selId,"sms_Dialog",480,150); }; }; function subscriber_add() { if (selId != '') { openDialog("dialogs/subscriber_add.asp?groupId=" + selId,"sms_Dialog",480,480); }; }; function subscriber_addnew() { if (selId != '') { openDialog("dialogs/subscriber_edit.asp?groupId=" + selId,"sms_Dialog",480,290); }; }; function subscriber_remove() { if ((selId != '') && (selId2 != '') && (confirm(getConfirmRemove('subscriber')))) { openDialog("dialogs/subscriber_remove.asp?groupId=" + selId + "&recipientId=" + selId2,"sms_Dialog",480,150); }; }; function subscriber_check() { res = true; el = document.getElementById('msisdn'); if (el) res = subscriber_check_msisdn(el); if (res) { el = document.getElementById('descript'); if((el) && (el.value.length == 0)) { alert('Please enter a "Description"...'); el.focus(); return false; } }; return res; }; function subscriber_check_msisdn(el) { res = true; if (el.value.substring(0, 2) != '00') { alert('Please enter a valid "Number"... [e.g. 0031612345678]'); el.focus(); el.select(); return false; }; return res; }; // ============================================================ // planner // ============================================================ function planner_new() { openDialog("dialogs/planner_edit.asp","sms_Dialog",480,330); }; function planner_delete() { if ((selId != '') && (confirm(getConfirmDelete('this item')))) { openDialog("dialogs/planner_delete.asp?scheduleId=" + selId,"sms_Dialog",480,150); }; }; function setShortcodeKeywordTariff(el, nameShortcode, nameKeyword, nameTariff) { elAS = document.getElementById('autoSubscription'); if(elAS) elAS.style.color = 'ButtonFace'; if (el) { elShortcode = document.getElementById(nameShortcode); elKeyword = document.getElementById(nameKeyword); elTariff = document.getElementById(nameTariff); if (elShortcode && elKeyword && elTariff) { if (el.selectedIndex == 0) { checkTariff(1); } else { val = el.options[el.selectedIndex].text; shortcode = val.substring(1, val.indexOf(']')); keyword = val.substring(val.indexOf(']') + 2); keyword = keyword.substring(0, keyword.indexOf('[')-1); tariff = val.substring(val.indexOf(']') + 2); tariff = tariff.substring(tariff.indexOf('[')); tariff = tariff.substring(1, tariff.indexOf(']')); elShortcode.value = shortcode; elKeyword.value = keyword; elTariff.value = tariff; checkTariff(tariff); if((elAS) && (tariff != '0.00')) { elAS.style.color = '#ff0000'; elASA = document.getElementById('autoSubscriptionAnchor'); if(elASA) elASA.style.color = '#ff0000'; }; }; }; }; }; function checkTariff(tariff) { el = document.getElementById('groupId'); if (el) { el.disabled = (tariff > 0); }; }; function planner_check() { res = true; el = document.getElementById('senddatum'); if((el) && (el.value.length != 10)) { alert('Please enter a valid "Date"... [dd/mm/yyyy]'); el.focus(); el.select(); return false; } el = document.getElementById('sendtijd'); if((el) && (el.value.length != 5)) { alert('Please enter a valid "Time"...[hh:nn]'); el.focus(); el.select(); return false; } el = document.getElementById('keyId'); if((el) && !(el.value > 0)) { alert('Please select a "Shortcode/keyword"...'); el.focus(); return false; } elT = document.getElementById('tariff'); if((elT) && (elT.value == '0.00')) { el = document.getElementById('groupId'); if((el) && !(el.value > 0)) { alert('Please select a "Subscription"...'); el.focus(); return false; } }; el = document.getElementById('messageId'); if((el) && !(el.value > 0)) { alert('Please select a "Message"...'); el.focus(); return false; } el = document.getElementById('descript'); if((el) && (el.value.length == 0)) { alert('Please enter a "Description"...'); el.focus(); return false; } return res; }; // ============================================================ // shortcodes // ============================================================ function openShortcodeKeywords(shortcodeId) { if (shortcodeId != selId) { document.getElementById('iframe').src = 'shortcodeKeywords.asp?shortcodeId=' + shortcodeId; selId2 = ''; }; }; // ============================================================ // keywords // ============================================================ function keyword_edit() { if (selId2 != '') { openDialog("dialogs/keyword_edit.asp?keyId=" + selId2,"sms_Dialog",480,465); }; }; function keyword_check() { el = document.getElementById('autoSubscription'); if ((el) && (el.checked)) { el = document.getElementById('replyOn'); if ((el) && (el.value.length == 0)) { alert('Please enter "Text ON" text!'); el.focus(); return false; }; el = document.getElementById('replyOff'); if ((el) && (el.value.length == 0)) { alert('Please enter "Text OFF" text!'); el.focus(); return false; }; }; return true; }; // ============================================================ // reports // ============================================================ function report_detail() { if (selId != '') { document.location.href = 'reports_detail.asp?scheduleId=' + selId; }; };