/**
##
# Project: PHPDisk
# This is NOT a freeware, use is subject to license terms.
#
# Site: http://www.phpdisk.com
#
# $Id: javascript.js 167 2009-02-11 07:37:58Z along $
#
# Copyright (C) 2008-2009 PHPDisk Team. All Rights Reserved.
#
##
*/
var userAgent = navigator.userAgent.toLowerCase();
var is_ie = document.all;
var is_opera = userAgent.indexOf('opera') > -1;
var timer = false;
if(typeof Array.prototype.push=='undefined'){Array.prototype.push=function(){var l=this.length;for(var i=0;i Array.prototype.in_array=function(v){for(var i=0;i Array.prototype.remove=function(v){for(var i=0;i Object.prototype.toQueryString=function(){var q=[];for(var x in this){var t=typeof this[x];if(t!='function'&&t!='object')q.push([x,encodeURIComponent(this[x])].join('='));}return q.join('&');}
function rand(){return String(Math.floor(Math.random()*10000000000));}
function rand2(){return rand()+rand()+rand()+rand()+rand();}
function getObj(sId){return document.getElementById(sId);}
function checkIt(b,c){if(b){b.checked=!c;b.click();b.checked=c;}}
function showIt(sId,v){var x=$(sId);if(x)x.style.display=(v?'block':'none');}
function togView(sId){var el=$(sId);if(el){el.style.display=el.style.display=='none'?'':'none';}}
function checkAllBoxes(form,fieldName,chkVal){formObj=$(form);if(!formObj)return false;var checkBoxes=formObj.getElementsByTagName('input');for(var i=0;i function countCheckedBoxes(form,fieldName){formObj=$(form);if(!formObj)return false;var checkBoxes=formObj.getElementsByTagName('input');var checkedBoxes=0;for(var i=0;i function pInt(oF){if(oF){oF.value=parseInt(oF.value);if(oF.value=='NaN'){oF.value=0;}}}
function pop(sURL){return!window.open(sURL);}
function go(url){if(url.substr(0,7)!='http://')url=base_url+url;window.location=url;return false;}
function htmlspecialchars(s){var t={'&':'&','"':'"',"'":''','':'>'};for(var k in t){rx=new RegExp(k,'g');s=s.replace(rx,t[k]);}return s;}
function addslashes(s){s=s.replace(/'/gi,"'");s=s.replace(/"/gi,""");return s;}
function alternateRowColor(obj,el,c1,c2){if(obj){var els=obj.getElementsByTagName(el);var j=0;for(var i=0;i function basename(s){var p=-1;for(var i=0;i function dirname(s){var p=-1;for(var i=0;i function togImage(im,n){if(!im)return false;var alt=im.getAttribute('alternateImage');if(!alt)alt=dirname(im.src)+'/'+n;var cur=im.src;im.src=alt;im.setAttribute('alternateImage',cur);}
function get_extension(n){n=n.substr(n.lastIndexOf('.')+1);return n.toLowerCase();}
function str_slice(s,l){if(s.length>l)return s.substr(0,l/2)+'...'+s.substr(s.length-(l/2));return s;}
function str_preview(s,l){return s.length>l?s.substr(0,l)+'...':s;}
function setStyles(obj,styles){if(!obj)return false;for(var k in styles)obj.style[k]=styles[k];}
function number_format(n){n+='';x=n.split('.');x1=x[0];x2=x.length>1?'.'+x[1]:'';var rgx=/(\d+)(\d{3})/;while(rgx.test(x1)){x1 = x1.replace(rgx,'$1'+','+'$2');}return x1+x2;}
function setParentSize(i,s){if(!s)s=2;i.parentNode.parentNode.style.width=i.width+s+'px';i.parentNode.parentNode.style.height=i.height+s+'px';}
function set_border(i,p,s){if(typeof s=='undefined')s=2;p.style.width=i.width+s+'px';p.style.height=i.height+s+'px';}
function trim(v,p){var t=Math.pow(10,p);return Math.round(v*t)/t;}
function get_size(v,u){if(!u)u='B';if(v>1024){if(u=='B')return get_size(v/1024,'KB');if(u=='KB')return get_size(v/1024,'MB');if(u=='MB')return get_size(v/1024,'GB');if(u=='GB')return get_size(v/1024,'TB');}return trim(v,0)+' '+u;}
function deleteNode(n){return n.parentNode.removeChild(n);}
function confirmGo(s,url){if(confirm(s))go(url);return false;}
String.prototype.wordWrap = function(m, b, c){ //v1.0
var i, j, l, s, r = this.split("\n");
if(m > 0) for(i = -1, l = r.length; ++i < l;){
for(s = r[i], r[i] = ""; s.length > m;
j = c ? m : (j = s.substr(0, m).match(/\S*$/)).input.length - j[0].length
|| j.input.length + (j = s.substr(m).match(/^\S*/)).input.length + j[0].length,
r[i] += s.substr(0, j) + ((s = s.substr(j)).length ? b : "")
);
r[i] += s;
}
return r.join("\n");
};
function Timer(){
this.t=false;
this.intv=false;
this.start=function(func,delay){this.stop();this.t=window.setTimeout(func,delay);};
this.stop=function(){if(this.t)window.clearTimeout(this.t);}
this.startInterval=function(func,delay){this.intv=window.setInterval(func,delay);};
this.stopInterval=function(){if(this.intv)window.clearInterval(this.intv);}
}
function get_icon(ext)
{
var icons =
{
'default':'file.gif',
'jpg' : 'jpg.gif',
'jpeg' : 'jpg.gif',
'png' : 'png.gif',
'gif' : 'gif.gif',
'avi' : 'wmv.gif',
'wmv' : 'wmv.gif',
'mp3' : 'mp3.gif',
'zip' : 'zip.gif',
'rar' : 'rar.gif',
'pdf' : 'pdf.gif',
'ppt' : 'ppt.gif',
'txt' : 'txt.gif',
'doc' : 'doc.gif',
'xls' : 'xls.gif'
}
return icons[ext] ? icons[ext] : icons['default'];
}