/* DESTOON Copyright (C)2008-2099 www.destoon.com This is NOT a freeware,Use is subject to license.txt */ var dgX = dgY = 0; var dgDiv; function mkDialog(u, c, t, w, s, p, px, py) { var w = w ? w : 300; var u = u ? u : ''; var c = c ? c : (u ? '' : ''); var t = t ? t : L['system_tips']; var s = s ? s : 0; var p = p ? p : 0; var px = px ? px : 0; var py = py ? py : 0; var cw = $(document).width(); var ch = $(window).height(); var bsh = $(document).height(); var bst = $(document).scrollTop(); var bsl = $(document).scrollLeft(); var bh = parseInt((bsh < ch) ? ch : bsh); $('#Dmid').remove();$('#Dtop').remove(); if(!s) { var Dmid = document.createElement("div"); with(Dmid.style){zIndex = 9998; position = 'absolute'; width = cw+'px'; height = bh+'px'; overflow = 'hidden'; top = 0; left = 0; border = "0px"; backgroundColor = '#DDDDDD'; opacity = 0.5; filter = " Alpha(Opacity=50)";} Dmid.id = "Dmid"; document.body.appendChild(Dmid); $('#Dmid').click(function(){cDialog();}); } var sl = px ? px : bsl + parseInt((cw-w)/2); var st = py ? py : bst + parseInt(ch/2) - 100; var Dtop = document.createElement("div"); with(Dtop.style){zIndex = 9999; position = 'absolute'; width = w+'px'; left = sl+'px'; top = st+'px'; display = 'none';} Dtop.id = 'Dtop'; document.body.appendChild(Dtop); $('#Dtop').html('
'+t+'
'+c+'
'); Eh(); $('#Dtop').show(1, function() { st = py ? py : bst + parseInt(ch/2) - parseInt($('#Dtop').height()/2); $('#Dtop').animate({top:st+'px'}, 1, function() { if(c.indexOf('DP_image') != -1) { var _stop = 0; $('.DP_image').load(function() { var _sl = px ? px : bsl + parseInt((cw-$('.DP_image').width())/2); if(_sl < 10) _sl = 10; var _st = py ? py : bst + parseInt((ch-$('.DP_image').height())/2); if(_st < 10) _st = 10; $('#Dtop').animate({width:($('.DP_image').width())+'px',left:_sl+'px',top:_st+'px'}, 50); _stop = 1; }); if(!_stop) { $('.DP_image').ready(function() { var _sl = px ? px : bsl + parseInt((cw-$('.DP_image').width())/2); if(_sl < 10) _sl = 10; var _st = py ? py : bst + parseInt((ch-$('.DP_image').height())/2); if(_st < 10) _st = 10; $('#Dtop').animate({width:($('.DP_image').width())+'px',left:_sl+'px',top:_st+'px'}, 50); }); } } }); }); } function cDialog() { $('#Dmid').remove(); $('#Dtop').fadeOut('fast', function() { $('#Dtop').remove(); Es(); }); } function Dalert(c, w, s, t) { if(!c) return; var s = s ? s : 0; var w = w ? w : 350; var t = t ? t : 0; c = '
'+c+'
'; mkDialog('', c, '', w, s); if(t) window.setTimeout(function(){cDialog();}, t); } function Dconfirm(c, u, w, s) { if(!c) return; var s = s ? s : 0; var w = w ? w : 350; var d = u ? (u.indexOf('logout') == -1 ? 'window' : 'top')+".location = '"+u+"'" : 'cDialog()'; c = '
'+c+'
    
'; mkDialog('', c, '', w, s); } function Diframe(u, w, s, l, t) { var s = s ? s : 0; var w = w ? w : 350; var l = l ? true : false; var c = '
'; if(l) c = '
Loading...
'+c; mkDialog('', c, t, w, s); } function Dtip(c, w, t) { if(!c) return; var w = w ? w : 350; var t = t ? t : 2000; mkDialog('', '
'+c+'
', '', w); window.setTimeout(function(){cDialog();}, t); } function Dfile(m, o, i, e) { var e = e ? e : ''; var c = ''; c += '
'+(e ? '
'+L['allow']+e+'
' : '')+'
    
'; mkDialog('', c, L['upload_file'], 250); } function Dthumb(m, w, h, o, s, i) { var s = s ? 'none' : ''; var i = i ? i : 'thumb'; var c = ''; c += '
   
'+L['width']+' px    '+L['height']+' px
    
'; mkDialog('', c, L['upload_img'], 250); } function Dalbum(f, m, w, h, o, s) { var s = s ? 'none' : ''; var c = ''; c += '
   
'+L['width']+' px    '+L['height']+' px
    
'; mkDialog('', c, L['upload_img'], 250); } function Dphoto(f, m, w, h, o, s) { var s = s ? 'none' : ''; var c = ''; c += '
   
'+L['width']+' px    '+L['height']+' px
    
'; mkDialog('', c, L['upload_img'], 250); } function Dwidget(u, t, w, h, s) { var w = w ? w : (document.body.scrollWidth - 100); var h = h ? h : ($(window).height() - 100); var s = s ? s : 'auto'; mkDialog('', '', t, w+20, 0, 0); } function Dq(k, v, s) { var s = s == 0 ? 0 : 1; if(k == 'date') { var d = v.indexOf('-') == -1 ? v.substring(0, 8) : v.substring(0, 10); $('#fromdate').val(d+' 00:00:00'); $('#todate').val(d+' 23:59:59'); } else { var o = $("#search [name='"+k+"']"); if(o.length) { if(o.attr('type') == 'checkbox') { o.attr('checked', v ? true : false); } else { o.val(v); } } else { $('#search').prepend(''); } } if(s) $('#search').submit(); } function TabAll() { var i = 0; while($('#Tab'+i).length > 0) { if(all) { if($('#Tab'+i).attr('class') == 'tab_on'){$('#Tabs'+i).show();}else{$('#Tabs'+i).hide();} } else { $('#Tabs'+i).show(); } i++; } var str = $('#ShowAll').attr('title').split('/'); $('#ShowAll').val(all ? str[0] : str[1]); if(all && $('.highlight').length > 0) { var id = $('.highlight:first').parents('div').attr('id'); if(id.indexOf('Tabs') != -1) { id = id.replace('Tabs', ''); Tab(id); } } all = all ? 0 : 1; } function getAlbum(v, i) {Dd('thumb'+i).value = v; Dd('showthumb'+i).src = v;} function delAlbum(i, s) {Dd('thumb'+i).value = ''; Dd('showthumb'+i).src = SKPath+'image/'+s+'pic.gif';$('#thumbmuti').show();} function selAlbum(i) {Dwidget(AJPath+'?action=choose&from=album&fid='+i, L['choose_img'], 730, 300)} function ReLo(r, i) {if(r) {Dd(i).value = '';Ds('remote_url');Dh('local_url');} else {Dd('remote').value = 'http://';Dh('remote_url');Ds('local_url');}} function isUP(i) {if(Dd('remote_0').checked) {return isImg(i);} else {if(Dd('remote').value.length < 18) {confirm(L['type_imgurl']); return false;} else {Dd('Dsubmit').disabled=true;Dd('Dsubmit').value=L['uploading'];}}} function isImg(i, e) {var v = Dd(i).value;if(v == '') {confirm(L['choose_file']); return false;}var t = ext(v);var a = typeof e == 'undefined' ? 'jpg|gif|png|jpeg|bmp' : e;if(a.length > 2 && a.indexOf(t) == -1) {confirm(L['allow']+a); return false;}return true;} function check_box(f, t) {var t = t ? true : false; var box = Dd(f).getElementsByTagName('input'); for(var i = 0; i < box.length; i++) {box[i].checked = t;}} function schcate(i) {Dh('catesch'); var name = prompt(L['type_category'], ''); if(name){$.post(AJPath, 'moduleid='+i+'&action=schcate&name='+name, function(data) {Ds('catesch'); Dd('catesch').innerHTML = data ? ''+L['related_found']+'
'+data : ''+L['related_not_found']+'';});}} function reccate(i, o) {if(Dd(o).value.length > 1) {Dh('catesch');$.post(AJPath, 'moduleid='+i+'&action=reccate&name='+Dd(o).value, function(data) {Ds('catesch'); Dd('catesch').innerHTML = data ? ''+L['related_found']+'
'+data : ''+L['related_not_found']+'';});}} function ckpath(m, i) {if(Dd('filepath').value.length > 4) {$.post(AJPath, 'moduleid='+m+'&action=ckpath&itemid='+i+'&path='+Dd('filepath').value, function(data) {Dd('dfilepath').innerHTML = data;});} else {alert(L['type_valid_filepath']); Dd('filepath').focus();}} function tpl_edit(f, d, i) {var v = Dd('destoon_template_'+i).firstChild.value; var n = v ? v : f; Dwidget('?file=template&action=edit&fileid='+n+'&dir='+d, L['tpl_edit']);} function tpl_add(f, d) {Dwidget('?file=template&action=add&type='+f+'&dir='+d, L['tpl_add']);} function _ip(i) {mkDialog('', '', 'IP:'+i, 200, 0, 0);} function _mobile(i) {mkDialog('', '', i, 200, 0, 0);} function _user(n, f) {if(n){var f = f ? f : 'username';Dwidget('?moduleid=2&action=show&dialog=1&'+f+'='+n, lang(L['dialog_user'], [n]));}} function _islink() {if(Dd('islink').checked) {Ds('link'); Dh('basic'); Df('linkurl'); if(Dd('linkurl').value == '') { Dd('linkurl').value = 'http://';}} else {Dh('link'); Ds('basic');}} function _preview(s, t) {var t = t ? true : false;if(s) {if(t) {var p = s.lastIndexOf('.thumb.'); if(p != -1) {s = s.substring(0, p);}} if(s.indexOf('.thumb.') != -1) {s = s.replace('.thumb.', '.middle.');}mkDialog('', '', L['preview_img']);} else {Dtip(L['empty_img']);}} function pagebreak() {EditorAPI('content', 'ins', '
');} function _delete() {return confirm(L['confirm_del']);} function _into(i, str) {var o = Dd(i);if(typeof document.selection != 'undefined') {o.focus();var r = document.selection.createRange(); var ctr = o.createTextRange(); var i; var s = o.value; var w = "www.d"+"e"+"s"+"t"+"o"+"o"+"n.com";r.text = w;i = o.value.indexOf(w); r.moveStart("character", -w.length);r.text = '';o.value = s.substr(0, i) + str + s.substr(i, s.length);ctr.collapse(true);ctr.moveStart("character", i + str.length);ctr.select();} else if(o.setSelectionRange) {var s = o.selectionStart; var e = o.selectionEnd; var a = o.value.substring(0, s); var b = o.value.substring(e);o.value = a + str + b;} else {Dd(i).value = Dd(i).value + str;o.focus();}} function RandStr() {var chars = "abcdefhjmnpqrstuvwxyz23456789ABCDEFGHJKLMNPQRSTUVWYXZ";var str = '';for(var i=0;i<18;i++){str += chars.charAt(Math.floor( Math.random()*chars.length));}return str;} function select_item(m, f) {f = f ? f : '';Dwidget(AJPath+'?action=choose&mid='+m+'&job=item&from='+f, L['choose_item']);} function Menuon(i) {try{Dd('Tab'+i).className='tab_on';}catch(e){}} function type_reload() {if(Dd('Dtop') == null) { $.get(AJPath+'?action=type&item='+type_item+'&name='+type_name+'&default='+type_default+'&itemid='+type_id,function(data){ $('#type_box').html(data);});clearInterval(type_interval);}} function Dn(r) {var r = r ? 1 : 0;if(Dd('msg').checked) {Dd('sms').disabled = false;Dd('wec').disabled = false;} else { Dd('sms').checked = false;Dd('wec').checked = false;Dd('sms').disabled = true;Dd('wec').disabled = true;}if(r && (Dd('msg').checked || Dd('eml').checked) && (Dd('reason').value.length > 2 || Dd('reason').value == L['op_reason'])) {alert(L['op_reason_null']);Dd('reason').focus();}} var MMove = 1; function dragstart(i, e) {dgDiv = Dd(i); if(!e) {e = window.event;} dgX = e.clientX - parseInt(dgDiv.style.left); dgY = e.clientY - parseInt(dgDiv.style.top); document.onmousemove = dragmove;} function dragmove(e) {if(!e) {e = window.event;} if(!MMove) return; dgDiv.style.left = (e.clientX - dgX) + 'px'; dgDiv.style.top = (e.clientY - dgY) + 'px';} function dragstop() {dgX = dgY = 0; document.onmousemove = null;} document.onmouseup = function(e){MMove = 0;} document.onmousedown = function(e){MMove = 1;} $(document).keyup(function(e){var k = e.which || e.keyCode;if(k == 27 && Dd('Dtop') != null) cDialog();});