/*
[destoon b2b system] copyright (c) 2008-2013 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 : '')+'/';
var ajpath = (dtpath.indexof('://') == -1 ? dtpath : (dtpath.indexof(dmurl) == -1 ? dmurl : dtpath))+'ajax.php';
if(isie) try {document.execcommand("backgroundimagecache", false, true);} catch(e) {}
var xmlhttp;
var try = {
these: function() {
var returnvalue;
for (var i = 0; i < arguments.length; i++) {var lambda = arguments[i]; try {returnvalue = lambda(); break;} catch (e) {}}
return returnvalue;
}
}
function makerequest(querystring, php, func, method) {
xmlhttp = try.these(
function() {return new xmlhttprequest()},
function() {return new activexobject('msxml2.xmlhttp')},
function() {return new activexobject('microsoft.xmlhttp')}
);
method = (typeof method == 'undefined') ? 'post' : 'get';
if(func) xmlhttp.onreadystatechange = eval(func);
xmlhttp.open(method, method == 'post' ? php : php+'?'+querystring, true);
xmlhttp.setrequestheader('content-type', 'application/x-www-form-urlencoded');
xmlhttp.send(method == 'post' ? querystring : null);
}
function dd(i) {return document.getelementbyid(i);}
function ds(i) {dd(i).style.display = '';}
function dh(i) {dd(i).style.display = 'none';}
function dsh(i) {dd(i).style.display = dd(i).style.display == 'none' ? '' : 'none';}
function df(i) {dd(i).focus();}
var tid=0;
function tab(id) {
var ttab = dd('tab'+tid); var ttabs = dd('tabs'+tid); var tab = dd('tab'+id); var tabs = dd('tabs'+id);
if(id!=tid) {ttab.classname='tab'; tab.classname='tab_on'; ttabs.style.display='none'; tabs.style.display=''; tid = id; try{dd('tab').value=id;}catch(e){}}
}
function checkall(f, t) {
var t = t ? t : 1;
for(var i = 0; i < f.elements.length; i++) {
var e = f.elements[i];
if(e.type != 'checkbox') continue;
if(t == 1) e.checked = e.checked ? false : true;
if(t == 2) e.checked = true;
if(t == 3) e.checked = false;
}
}
function stoinp(s, i, p) {
if(dd(i).value) {
var p = p ? p : ',';
var a = dd(i).value.split(p);
for (var j=0; j '+str+sound('tip');dd(i).focus();}catch(e){}
window.settimeout(function(){dd('d'+i).innerhtml = '';}, t);
}
function inner(i,s) {try {dd(i).innerhtml = s;}catch(e){}}
function innertbd(i,s) {try {dd(i).innerhtml = s;} catch(e) {dd(i).parentnode.outerhtml=dd(i).parentnode.outerhtml.replace(dd(i).innerhtml,s);}}
function go(u) {window.location = u;}
function confirmuri(m,f) {if(confirm(m)) go(f);}
function showmsg(m, t) {
var t = t ? t : 5000; var s = m.indexof(l['str_delete']) != -1 ? 'delete' : 'ok';
try{dd('msgbox').style.display = '';dd('msgbox').innerhtml = m+sound(s);window.settimeout('closemsg();', t);}catch(e){}
}
function closemsg() {try{dd('msgbox').innerhtml = '';dd('msgbox').style.display = 'none';}catch(e){}}
function sound(f) {return '
';}
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;
var ss = document.body.getelementsbytagname(t);
for(var i=0;i= 7 || ieversion < 5) return;
var ss = document.body.getelementsbytagname(t);
for(var i=0;i 1;
}
}
function ext(v) {return v.substring(v.lastindexof('.')+1, v.length).tolowercase();}
function pushnew() {
$('#destoon_push').remove();
s = document.createelement("script");
s.type = "text/javascript";
s.id = "destoon_push";
s.src = dtpath+"api/push.js.php?refresh="+math.random()+".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 substr_count(str, exp) {if(str == '') return 0;var s = str.split(exp);return s.length-1;}
function lang(s, a) {for(var i = 0; i < a.length; i++) {s = s.replace('{v'+i+'}', a[i]);} return s;}
document.onkeydown = function(e) {
var k = typeof e == 'undefined' ? event.keycode : e.keycode;
if(k == 37) {
try{if(dd('destoon_previous').value && typeof document.activeelement.name == 'undefined')go(dd('destoon_previous').value);}catch(e){}
} else if(k == 39) {
try{if(dd('destoon_next').value && typeof document.activeelement.name == 'undefined')go(dd('destoon_next').value);}catch(e){}
} else if(k == 38 || k == 40 || k == 13) {
try{if(dd('search_tips').style.display != 'none' || dd('search_tips').innerhtml != ''){sctip(k);return false;}}catch(e){}
}
}