function showDialog(url, width, height, scroll) { if (scroll == null) scroll = 1 var x = (screen.width - width) / 2, y = (screen.height - height) / 2; if( x < 0 ) x = 0 if( y < 0 ) y = 0 window.open(url, '_blank', 'xposition=' + x + ', left=' + x +', yposition=' + y + ', top=' + y + ', width=' + width + ', height=' + height + ', location=0, menubar=0, resizable=0, scrollbars=' + scroll + ', status=0, titlebar=0, toolbar=0, hotkeys=0') return false } function showDialogEx(url, width, height, scroll, name) { if (scroll == null) scroll = 1 var x = (screen.width - width) / 2, y = (screen.height - height) / 2; if( x < 0 ) x = 0 if( y < 0 ) y = 0 var w = window.open(url, name, 'xposition=' + x + ', left=' + x +', yposition=' + y + ', top=' + y + ', width=' + width + ', height=' + height + ', location=0, menubar=0, resizable=0, scrollbars=' + scroll + ', status=0, titlebar=0, toolbar=0, hotkeys=0') return w } function addBanners(url) { var x = (screen.width - 670) / 2, y = (screen.height - 600) / 2; if( x < 0 ) x = 0 if( y < 0 ) y = 0 var win = window.open(url, 'popularaddbanners', 'xposition=' + x + ', left=' + x +', yposition=' + y + ', top=' + y + ', width=670, height=600, location=0, menubar=0, resizable=0, scrollbars=1, status=0, titlebar=0, toolbar=0, hotkeys=0') win.focus() } function bnPreviw(width, height) { var x = (screen.width - width) / 2, y = (screen.height - height) / 2; if( x < 0 ) x = 0 if( y < 0 ) y = 0 return window.open('', '_blank', 'xposition=' + x + ', left=' + x +', yposition=' + y + ', top=' + y + ', width=' + width + ', height=' + height + ', location=0, menubar=0, resizable=0, scrollbars=0, status=0, titlebar=0, toolbar=0, hotkeys=0') } function checkMultisubmit(form) { if (form.inprogress) return false; else { form.inprogress = true; return true; } } function accountDialog(id) { showDialog('/admin/accountdialog/' + id + '/account/change_state', 460, 400) } function actionDialog() { width = 460 height = 400 var x = (screen.width - width) / 2, y = (screen.height - height) / 2; if( x < 0 ) x = 0 if( y < 0 ) y = 0 return window.open('', 'popular_action', 'xposition=' + x + ', left=' + x +', yposition=' + y + ', top=' + y + ', width=' + width + ', height=' + height + ', location=0, menubar=0, resizable=0, scrollbars=0, status=0, titlebar=0, toolbar=0, hotkeys=0') } function checkSet(el, middle) { // 0 - uncheck // -1 - middle // 1 - check // alert(el.value); if (middle) { el.checked = true el.setAttribute('indeterminate', true) el.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=50)" el.style.MozOpacity = 0.5 el.value = -1 } else { el.value = (el.value == -1) ? 1 : (el.value == 1) ? 0 : -1 el.checked = (el.value == 0) ? false : true el.setAttribute('indeterminate', (el.value == -1) ? true : false) el.style.filter = (el.value == -1) ? "progid:DXImageTransform.Microsoft.Alpha(opacity=50)" : '' el.style.MozOpacity = (el.value == -1) ? 0.5 : 1 } } function checkABtn(pref) { n = document.getElementById(pref + '_sites'); if (n) { if (n.value != -1) { document.curform.submitbtn.disabled = false; return } } n = document.getElementById(pref + '_profiles'); if (n) { if (n.value != -1) { document.curform.submitbtn.disabled = false; return } } n = document.getElementById(pref + '_banners'); if (n) { if (n.value != -1) { document.curform.submitbtn.disabled = false; return } } document.curform.submitbtn.disabled = true; } /* validate form */ function checkMax(el,maxval) { if (maxval == 0) return var form = el.form, t = false for (var i=0, k = 0; i < form.elements.length; i++) { if (form.elements[i].type == 'checkbox' && form.elements[i].name && form.elements[i].name == el.name && form.elements[i].checked) if (++k > maxval) t = true } if (t) el.checked = false } function checkMin(form,name) { var group = form[name] if (!group.length) return group.checked else for (var i=0; i < group.length; i++) if (group[i].checked) return true return false } function isEmail(str) { var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)") var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,5}|[0-9]{1,5})(\\]?)$") return (!r1.test(str) && r2.test(str)) } var charCodes = new Array(' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','!','"','#','$','%','&',"'",'(',')','*','+',',','-','.','/','0','1','2','3','4','5','6','7','8','9',':',';','<','=','>','?','@','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','[','\\',']','^','_','`','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','{','|','}','~','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','',''); function decodeBase64(string) { string = string.split('+').join(' '); var comps = string.split('%'); var out_str = '' for (var i=0;i