/*
DESTOON Copyright (C)2008-2099 www.destoon.com
This is NOT a freeware,Use is subject to license.txt
*/
var UA = navigator.userAgent.toLowerCase();
var isIE = (document.all && window.ActiveXObject && !window.opera) ? true : false;
var isGecko = UA.indexOf('webkit') != -1;
var DMURL = document.location.protocol+'//'+location.hostname+(location.port ? ':'+location.port : '')+'/';
if(DTPath.indexOf(DMURL) != -1) DMURL = DTPath;
var AJPath = DMURL+'ajax'+DTExt;
var UPPath = DMURL+'upload'+DTExt;
if(isIE) try {document.execCommand("BackgroundImageCache", false, true);} catch(e) {}
function Dd(i) {return document.getElementById(i);}
function Ds(i) {$('#'+i).show();}
function Dh(i) {$('#'+i).hide();}
function Dsh(i) {$('#'+i).toggle();}
function Df(i) {Dd(i).focus();}
function Dq(k, v, s) {
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 [name='search']").val(1);
$('#search').submit();
}
}
function Tab(ID) {
var i = 0;
while($('#Tab'+i).length > 0) {
if(ID == i) {$('#Tab'+i).attr('class', 'tab_on');$('#Tabs'+i).show();} else {$('#Tab'+i).attr('class', 'tab');$('#Tabs'+i).hide();}
i++;
}
if($('#tab').length > 0) $('#tab').val(ID);
}
function checkall(f, t) {
var t = t ? t : 1;
$(f).find(':checkbox').each(function() {
var e = $(this);
if(!e.attr('name') || e.attr('id') || e.prop('disabled')) return true;
if(t == 1) { e.prop('checked', e.prop('checked') ? false : true); } else if(t == 2) { e.prop('checked', true); } else if(t == 3) { e.prop('checked', false); }
});
}
function Dmsg(str, i, s, t) {
var t = t ? t : 5; var s = s ? 1 : 0; var h = i == 'content' ? 420 : 180;
Dtoast(str, '', t);
try{
$('html,body').animate({scrollTop:$('#d'+i).offset().top-h}, 100);
Dd('d'+i).innerHTML = '
'+str;
Dd(i).focus();
}catch(e){}
window.setTimeout(function(){Dd('d'+i).innerHTML = '';}, t*1000);
}
function RandStr(l) {l=l?l:18;var chars = "abcdefhjmnpqrstuvwxyz23456789ABCDEFGHJKLMNPQRSTUVWYXZ";var str = '';for(var i=0;i';}
function Eh(t) {
var t = t ? t : 'select';
if(isIE) {
var arVersion = navigator.appVersion.split("MSIE"); var IEversion = parseFloat(arVersion[1]);
if(IEversion >= 7 || IEversion < 5) return;
$(t).css('visibility', 'hidden');
}
}
function Es(t) {
var t = t ? t : 'select';
if(isIE) {
var arVersion = navigator.appVersion.split("MSIE"); var IEversion = parseFloat(arVersion[1]);
if(IEversion >= 7 || IEversion < 5) return;
$(t).css('visibility', 'visible');
}
}
function EditorLen(i) {return EditorAPI(i, 'len');}
function Tb(o) {
if(o.className == 'on') return;
var t = o.id.split('-h-'); var p = t[0]; var k = t[1];
$('#'+p+'-h').children().each(function() {
var i = $(this).attr('id').replace(p+'-h-', '');
if(i == k) {
$('#'+p+'-h-'+i).attr('class', 'on');
$('#'+p+'-b-'+i).fadeIn(100);
} else {
$('#'+p+'-h-'+i).attr('class', '');
$('#'+p+'-b-'+i).hide();
}
});
}
function ext(v) {return v.substring(v.lastIndexOf('.')+1, v.length).toLowerCase();}
function Dstats() {$.post(AJPath, 'action=stats&screenw='+window.screen.width+'&screenh='+window.screen.height+'&screenl='+navigator.language+'&uri='+encodeURIComponent(window.location.href)+'&refer='+encodeURIComponent(document.referrer), function(data) {});}
function Dviewer(src, obj) {
if($('#viewer').length == 0) $('body').append('');
var _this = this;
this.w = $(document).width();
this.h = $(window).height();
this.c = 0;
this.d = 0;
this.src = [];
this.alt = [];
this.imgsrc = function(s) {
if(s.indexOf('.middle.') != -1) {
s = cutstr(s, '', '.middle.');
} else if(s.indexOf('.thumb.') != -1) {
s = cutstr(s, '', '.thumb.');
}
return s;
}
var j = 0;
src = this.imgsrc(src);
obj.find('img').each(function(i) {
var s = $(this).attr('src');
if(s.indexOf('nopic') == -1 && s.indexOf('play.gif') == -1) {
if($(this).width() > 99 || s.indexOf('.thumb.') != -1) {
s = _this.imgsrc(s);
_this.src.push(s);
_this.alt.push($(this).attr('alt'));
if(src == s) _this.d = j;
j++;
}
}
});
if(!this.src[0]) return;
this.max = this.src.length;
this.htm = '';
$('#viewer').html(''+(this.d+1)+'/'+this.max+''+this.htm+'');
$('#viewer div').on('click.viewer',function(e){
if(e.target.nodeName == 'DIV') _this.close();
if(e.target.nodeName == 'IMG')_this.slide(_this.c+1, 1);
});
$('#viewer s').on('click.viewer',function(e){
_this.slide(_this.c-1, 1);
});
$('#viewer u').on('click.viewer',function(e){
_this.slide(_this.c+1, 1);
});
$('#viewer i').on('click.viewer',function(e){
_this.close();
});
$('#viewer').on('dblclick.viewer',function(e){
_this.close();
});
this.slide = function(o, a) {
if(o < 0 || o > this.max-1) {return;}
if(o == 0) { $('#viewer s').fadeOut(); } else {$('#viewer s').fadeIn();}
if(o == this.max-1) { $('#viewer u').fadeOut(); } else {$('#viewer u').fadeIn();}
if(a) {
$('#viewer-img').hide();
$('#viewer-img').attr('src', this.src[o]);
$('#viewer-img').fadeIn();
} else {
$('#viewer-img').attr('src', this.src[o]);
}
this.c = o;
$('#viewer b').html((o+1)+'/'+this.max);
if(this.alt[o]) {
$('#viewer p').html(this.alt[o]);
$('#viewer p').show();
} else {
$('#viewer p').html('');
$('#viewer p').hide();
}
}
this.close = function() {
$('body').css('overflow', 'auto');
$('.ui-mask').hide();
$('#viewer').html('');
$('#viewer').fadeOut();
}
$('body').css('overflow', 'hidden');
$('.ui-mask').show();
this.slide(this.d, 0);
if(this.max == 1) $('#viewer s,#viewer u').hide();
$('#viewer').fadeIn();
return true;
}
function Dtoast(msg, fid, time) {
var time = time ? time : 3;
var fid = fid ? fid : '';
$('.ui-toast').remove();
$('body').append(''+msg+'
');
var w = $('.ui-toast').width();
if(w < 14) w = msg.length*14;
if(msg.indexOf('') != -1 && time < 4) time = 60;
$('.ui-toast').css('left', $(document).scrollLeft()+(document.body.clientWidth-w)/2 - 16);
$('.ui-toast').fadeIn('fast', function() {
setTimeout(function() {
$('.ui-toast').fadeOut('slow', function() {
if(fid) $('#'+fid).focus();
});
}, time*1000);
});
}
function Dwait(t1, t2) {
$('.ui-wait').remove();
$('body').append('');
t1 = t1 >= 0 ? t1 : 3;
t2 = t2 >= 0 ? t2 : 30;
if(t1 > 0) setTimeout(function(){$('.ui-wait').on('click mouseover', function(){$('.ui-wait').remove();});}, t1*1000);
if(t2 > 0) setTimeout(function(){$('.ui-wait').remove();}, t2*1000);
}
function Dlock(obj, t1, t2, css) {
if(!obj) {
if($('#dform :submit').length > 0) {
obj = $('#dform :submit');
} else if($('.sbt :submit').length > 0) {
obj = $('.sbt :submit');
}
}
if(obj.length > 0) {
$('.ui-lock').remove();
obj.before('');
if(css) $('.ui-lock').css(css);
t1 = t1 >= 0 ? t1 : 3;
t2 = t2 >= 0 ? t2 : 0;
if(t1 > 0) setTimeout(function(){$('.ui-lock').on('mouseover', function(){$('.ui-lock').remove();});}, t1*1000);
if(t2 > 0) setTimeout(function(){$('.ui-lock').remove();}, t2*1000);
} else {
Dwait();
}
}
function Dwindow(u, w, h) {
var ww = document.body.scrollWidth;
var wh = $(window).height();
w = w ? w : ww - 100;
h = h ? h : wh - 200;
dWin = window.open(u,'dwindow','height='+h+'px,width='+w+'px,top='+parseInt((wh-h)/2)+'px,left='+parseInt((ww-w)/2)+'px,resizable=no,scrollbars=yes');
}
function Dchat(u) {
Dwindow(u, 1000, 600);
}
function GoMobile(url) {
if(url && url != window.location.href && (UA.indexOf('phone') != -1 || UA.indexOf('mobile') != -1 || UA.indexOf('android') != -1 || UA.indexOf('ipod') != -1) && get_cookie('mobile') != 'pc' && UA.indexOf('ipad') == -1) {Go(url);}
}
function PushNew() {
if(document.hidden) return;
$('#destoon_push').remove();
s = document.createElement("script");
s.type = "text/javascript";
s.id = "destoon_push";
s.src = DTPath+"api/push"+DTExt+"?refresh="+RandStr()+".js";
document.body.appendChild(s);
}
function set_cookie(n, v, d) {
var e = '';
var f = d ? d : 365;
e = new Date((new Date()).getTime() + f * 86400000);
e = "; expires=" + e.toGMTString();
document.cookie = CKPrex + n + "=" + v + ((CKPath == "") ? "" : ("; path=" + CKPath)) + ((CKDomain =="") ? "" : ("; domain=" + CKDomain)) + e;
}
function get_cookie(n) {
var v = ''; var s = CKPrex + n + "=";
if(document.cookie.length > 0) {
o = document.cookie.indexOf(s);
if(o != -1) {
o += s.length;
end = document.cookie.indexOf(";", o);
if(end == -1) end = document.cookie.length;
v = unescape(document.cookie.substring(o, end));
}
}
return v;
}
function del_cookie(n) {var e = new Date((new Date()).getTime() - 1 ); e = "; expires=" + e.toGMTString(); document.cookie = CKPrex + n + "=" + escape("") +";path=/"+ e;}
function set_local(n, v) {window.localStorage ? localStorage.setItem(CKPrex + n, v) : set_cookie(n, v);}
function get_local(n) {return window.localStorage ? localStorage.getItem(CKPrex + n) : get_cookie(n);}
function del_local(n) {window.localStorage ? localStorage.removeItem(CKPrex + n) : del_cookie(n);}
function substr_count(str, exp) {if(str == '') return 0;var s = str.split(exp);return s.length-1;}
function checked_count(id) {return $('#'+id+' :checked').length;}
function lang(s, a) {for(var i = 0; i < a.length; i++) {s = s.replace('{V'+i+'}', a[i]);} return s;}
function get_cart() {var cart = parseInt(get_cookie('cart'));return cart > 0 ? cart : 0;}
function cutstr(str, mark1, mark2) {
if(mark1) {
var p1 = str.indexOf(mark1);
if(p1 != -1) str = str.substr(p1 + mark1.length);
}
if(mark2) {
var p2 = str.indexOf(mark2);
if(p2 != -1) str = str.substr(0, p2);
}
return str;
}
function player(u, w, h, a, p) {
var w = w ? w : 800;
var h = h ? h : 450;
var a = a ? 1 : 0;
var i = '';
if(u.indexOf('id=') != -1) {
i = cutstr(u, 'id=', '&');
} else if(u.indexOf('/upload/') != -1) {
i = cutstr(u, '/upload/', '.');
i = i.replace(/\//g, '');
}
if(!i.match(/^[a-z0-9\-_]{6,32}$/i)) i = RandStr(32);
var s = DTPath+'api/player'+DTExt+'?auth='+encodeURIComponent(u)+'&width='+w+'&height='+h+'&auto='+a+'&vid='+i;
if(p && typeof p == 'object') { for(var k in p) { s += '&'+k+'='+encodeURIComponent(p[k]); } }
return '';
}
function Dpwd(pwd, min, max, mix) {
min = parseInt(min);
if(min < 6) min = 6;
max = parseInt(max);
if(max > 30) max = 30;
if(pwd.length == 32) return ['pwd', 'ok'];
if(pwd.length < min) return ['min', min];
if(pwd.length > max) return ['max', max];
if((','+mix+',').indexOf(',1,') != -1 && !pwd.match(/[0-9]/)) return ['mix', '09'];
if((','+mix+',').indexOf(',2,') != -1 && !pwd.match(/[a-z]/)) return ['mix', 'az'];
if((','+mix+',').indexOf(',3,') != -1 && !pwd.match(/[A-Z]/)) return ['mix', 'AZ'];
if((','+mix+',').indexOf(',4,') != -1) {
var str = pwd.replace(/[0-9a-z]/gi, '');
if(str.length < 1) return ['mix', '..'];
}
return ['pwd', 'ok'];
}
if(isIE && !window.XMLHttpRequest) {document.write('');}
$(function(){
if(isIE) {
$(window).bind('scroll.back2top', function() {
var st = $(document).scrollTop(), winh = $(window).height();
(st > 0) ? $('.back2top').show() : $('.back2top').hide();
});
} else {
$(window).on('scroll.back2top', function() {
$(document).scrollTop() > 0 ? $('.back2top').show() : $('.back2top').hide();
});
}
$(document).on('keydown', function(e) {
if(e.ctrlKey) {
if(e.keyCode == 83) {
if($('#dform').length > 0) {
e.preventDefault();
$('#dform :submit').trigger('click');
}
}
} else {
if(e.keyCode == 37) {
if($('#destoon_previous').length > 0 && typeof document.activeElement.name == 'undefined') {Go(Dd('destoon_previous').value);}
} else if(e.keyCode == 39) {
if($('#destoon_next').length > 0 && typeof document.activeElement.name == 'undefined') {Go(Dd('destoon_next').value);}
} else if(e.keyCode == 27) {
if($('#Dtop').length > 0) {
cDialog();
} else if(window.parent.document.getElementById('Dtop') != null) {
window.parent.cDialog();
}
} else if(e.keyCode == 38 || e.keyCode == 40 || e.keyCode == 13) {
try{if(Dd('search_tips').style.display != 'none' || Dd('search_tips').innerHTML != ''){SCTip(k);return false;}}catch(e){}
}
}
});
$('.back2top a').on('click', function() {
$('html,body').animate({scrollTop:0}, 200);
});
$('.back2top').on('contextmenu', function(e) {
e.preventDefault();
$('.back2top').remove();
});
});