function convert_from_bytes(bytes){if(bytes<1024){return bytes+" Byte"}if(bytes<1024*1024){return round(bytes/1024)+" KB"}if(bytes<1024*1024*1024){return round(bytes/1024/1024)+" MB"}if(bytes<1024*1024*1024*1024){return round(bytes/1024/1024/1024)+" GB"}if(bytes<1024*1024*1024*1024*1024){return round(bytes/1024/1024/1024/1024)+" TB"}}
function from_unixtime(timestamp,showtime){if(typeof date=="undefined"){var date=new Date()}if(timestamp==0){return"-"}date.setTime(timestamp*1000);var time_str=$.datepicker.formatDate('mm/dd/yy',date);if(showtime!==false){time_str+=", "+leading_zero(date.getHours())+":"+leading_zero(date.getMinutes())}return time_str}
function final_zero(no){if((""+no).length == 1){return no+"0"}else{return no}}
function leading_zero(no){if(no<10){return"0"+no}else{return no}}
function login_fields(field,type){if(field=="user"){value="username"}else{value="password"}if($('#l_'+field).val()!=""){type="click"}if(type=="click"){$('#l_'+field).css('background-image','none')}else if(type=='blur'){$('#l_'+field).css('background-image','url(/template/images/login_'+value+'.gif)')}}
function info(a){a=a.split("").reverse().join("").split("a|b");var b=a[1].split("");a[1]=new Array();var i=0;for(j=0;j<b.length;j++){if(j%3==0&&j!=0){i++}if(typeof(a[1][i])=="undefined"){a[1][i]=""}a[1][i]+=b[j]}b=new Array();a[0]=a[0].split("");for(i=0;i<a[1].length;i++){a[1][i]=parseInt(a[1][i].toUpperCase(),16);b[a[1][i]]=parseInt(i)}a[1]="";for(i=0;i<b.length;i++){if(typeof(a[0][b[i]])!="undefined"){a[1]+=a[0][b[i]]}else{a[1]+=" "}}return a[1]}
function dl_countdown(){var now=new Date();var milliseconds=finish-now;if(milliseconds<0){var obj;clearInterval(interval);$('#dl_wait').hide();$('#dl_ticket').show();var obj,obj2,obj3,obj4;obj=document.createElement('div');$(obj).attr('id','dll');obj2=document.createElement('p');obj3=document.createElement('a');$(obj3).attr('href','javascript:dl_start();');obj4=document.createElement('img');$(obj4).attr('src','/template/images/download-free_'+back+'.gif');$(obj4).attr('border','0');$(obj4).attr('alt',((file[5].indexOf("chk||",0)!=-1)?ddlc:ddl));$(obj3).append(obj4);$(obj3).append("<br />>> "+((file[5].indexOf("chk||",0)!=-1)?ddlc:ddl)+" <<");$(obj2).append(obj3);$(obj).append(obj2);$('#dl_ticket').append(obj);if(captcha!=false){old[3]=$('#dll').css("margin");$('#dll').css("margin","0");old[4]=$('#dll').css("width");$('#dll').css("width","500px")}}else{if(captcha==false&&typeof(file[5])!="undefined"&&file[5].indexOf("chk||",0)!=-1){old=new Array(5);old[0]=$('#dl_captcha').css("display");$('#dl_captcha').css("display","block");old[1]=$('#dl_wait').css("padding");$('#dl_wait').css("padding","0 340px 0 0");old[2]=$('#dl_wait').css("width");$('#dl_wait').css("width","528px");Recaptcha.create("6LdatrsSAAAAAHZrB70txiV5p-8Iv8BtVxlTtjKX","dl_captcha",{theme:"red",callback:Recaptcha.focus_response_field});captcha=file[5].split("hk||")[1]}var days=Math.floor(milliseconds/86400000);milliseconds-=days*86400000;var hours=Math.floor(milliseconds/3600000);milliseconds-=hours*3600000;var minutes=Math.floor(milliseconds/60000);milliseconds-=minutes*60000;var seconds=Math.floor(milliseconds/1000);milliseconds-=seconds*1000;var hundredths=Math.floor(milliseconds/10);$('#dl_min p').html(leading_zero(minutes));$('#dl_sec p').html(leading_zero(seconds));$('#dl_hs p').html(final_zero(hundredths))}}
function dl_info(){file=(info(nfo)).split(div);var obj,obj2,obj3;var icons=new Array("calculator","copy","clock");obj=document.createElement('div');$(obj).attr('id','file_facts');$('#download div').eq(0).append(obj);for(var i=0;i<3;i++){obj=document.createElement('div');obj2=document.createElement('span');$(obj2).addClass('ui-icon');$(obj2).addClass('ui-icon-'+icons[i]);$(obj).append(obj2);obj2=document.createElement('span');$(obj2).html(names[i]+":");$(obj2).addClass('name');$(obj).append(obj2);obj2=document.createElement('span');if(i===0){file[i]=convert_from_bytes(file[i])}if(i===2){file[i]=from_unixtime(file[i])}$(obj2).html(file[i]);$(obj).append(obj2);$("#file_facts").append(obj)}obj2=document.createElement('h2');$(obj2).html("File: ");obj3=document.createElement('span');$(obj3).html(file[3]);$(obj2).append(obj3);$("#file_facts").prepend(obj2)}
function dl_start(){if(!captcha){redirect(file[5])}else{$.ajax({type:"POST",url:url.split("///").join("/free/captcha/"),cache:false,timeout:20000,data:"dl_free=1&captcha="+captcha+"&recaptcha_challenge_field="+$("#recaptcha_challenge_field").val()+"&recaptcha_response_field="+$("#recaptcha_response_field").val(),success:function(response){if($.trim(response)=="0"){Recaptcha.reload()}else{Recaptcha.destroy();captcha=false;file[5]=$.base64Decode($.trim(response));finish=new Date();finish.setSeconds(finish.getSeconds()+wait);$('#dl_captcha').css("display",old[0]);$('#dl_wait').css("padding",old[1]);$('#dl_wait').css("width",old[2]);$('#dll').css("margin",old[3]);$('#dll').css("width",old[4]);$('#dl_ticket').html("");$("#dl_ticket").hide();$("#dl_wait").show();interval=setInterval("dl_countdown()",delay)}}})}}
function round(x){var k=(Math.round(x*100)/100).toString();k+=(k.indexOf('.')==-1)?'.00':'00';return k.substring(0,k.indexOf('.')+3).split('.').join(',')}
function keep_alive(){if(typeof(alive)!="undefined"&&alive!=""){$.ajax({async:true,type:"POST",url:alive,cache:false,data:"",timeout:20000,success:function(response){response=$.trim(response)}})}}
function shorten_string(string,length,type){var divider="...";if(string.length<=length){return string}else{if(type=="begin"){return string.substr(0,length-divider.length)+divider}if(type=="mid"){var part_len=parseInt((length-divider.length)/2);var offset=(length%2>0)?0:1;return string.substr(0,part_len+offset)+divider+string.substr(string.length-part_len-1)}if(type=="end"){return divider+string.substr(length-divider.length-1)}}return string}
function show_dialog(title,body,width,height){if(parseInt(width)<1){width=250}if(parseInt(height)<1){height=250}$("#dialog").dialog("destroy");$("#dialog").attr('title',title);$("#dialog p").html(body);$(function(){$("#dialog").dialog({autoOpen:false,modal:true,width:width,height:height});$("#dialog").dialog("open")})}
function toggleDisplay(id,status){if(status!="on"&&status!="off"){if($('#'+id).css('display')=='none'){$('#'+id).css('display','block')}else{$('#'+id).css('display','none')}}else{if(status=="on"){$('#'+id).css('display','block')}else{$('#'+id).css('display','none')}}}
function pdl(){var obj,obj2,obj3,obj4;obj=document.createElement('div');$(obj).attr('id','dll');obj2=document.createElement('p');obj3=document.createElement('a');$(obj3).attr('href',file[5]);$(obj3).attr('target',"_blank");obj4=document.createElement('img');$(obj4).attr('src','/template/images/download-premium_' + back + '.gif');$(obj4).attr('border','0');$(obj4).attr('alt','Download');$(obj3).append(obj4);$(obj3).append("<br />>> "+ddl+" <<");$(obj2).append(obj3);$(obj).append(obj2);$('#download div').eq(0).append(obj)}
function redirect(url) {window.location = url;}

/* libs */

/**
 * jQuery BASE64 functions
 *
 * 	<code>
 * 		Encodes the given data with base64.
 * 		String $.base64Encode ( String str )
 *		<br />
 * 		Decodes a base64 encoded data.
 * 		String $.base64Decode ( String str )
 * 	</code>
 */
(function($){var keyString="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var uTF8Encode=function(string){string=string.replace(/\x0d\x0a/g,"\x0a");var output="";for(var n=0;n<string.length;n++){var c=string.charCodeAt(n);if(c<128){output+=String.fromCharCode(c)}else if((c>127)&&(c<2048)){output+=String.fromCharCode((c>>6)|192);output+=String.fromCharCode((c&63)|128)}else{output+=String.fromCharCode((c>>12)|224);output+=String.fromCharCode(((c>>6)&63)|128);output+=String.fromCharCode((c&63)|128)}}return output};var uTF8Decode=function(input){var string="";var i=0;var c=c1=c2=0;while(i<input.length){c=input.charCodeAt(i);if(c<128){string+=String.fromCharCode(c);i++}else if((c>191)&&(c<224)){c2=input.charCodeAt(i+1);string+=String.fromCharCode(((c&31)<<6)|(c2&63));i+=2}else{c2=input.charCodeAt(i+1);c3=input.charCodeAt(i+2);string+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));i+=3}}return string};$.extend({base64Encode:function(input){var output="";var chr1,chr2,chr3,enc1,enc2,enc3,enc4;var i=0;input=uTF8Encode(input);while(i<input.length){chr1=input.charCodeAt(i++);chr2=input.charCodeAt(i++);chr3=input.charCodeAt(i++);enc1=chr1>>2;enc2=((chr1&3)<<4)|(chr2>>4);enc3=((chr2&15)<<2)|(chr3>>6);enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64}else if(isNaN(chr3)){enc4=64}output=output+keyString.charAt(enc1)+keyString.charAt(enc2)+keyString.charAt(enc3)+keyString.charAt(enc4)}return output},base64Decode:function(input){var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(i<input.length){enc1=keyString.indexOf(input.charAt(i++));enc2=keyString.indexOf(input.charAt(i++));enc3=keyString.indexOf(input.charAt(i++));enc4=keyString.indexOf(input.charAt(i++));chr1=(enc1<<2)|(enc2>>4);chr2=((enc2&15)<<4)|(enc3>>2);chr3=((enc3&3)<<6)|enc4;output=output+String.fromCharCode(chr1);if(enc3!=64){output=output+String.fromCharCode(chr2)}if(enc4!=64){output=output+String.fromCharCode(chr3)}}output=uTF8Decode(output);return output}})})(jQuery);

/**
 * jquery.simpletip 1.3.1. A simple tooltip plugin
 *
 * Copyright (c) 2009 Craig Thompson
 * http://craigsworks.com
 *
 * Licensed under GPLv3
 * http://www.opensource.org/licenses/gpl-3.0.html
 *
 * Launch  : February 2009
 * Version : 1.3.1
 * Released: February 5, 2009 - 11:04am
 */
(function($){function Simpletip(elem,conf){var self=this;elem=jQuery(elem);var tooltip=jQuery(document.createElement('div')).addClass(conf.baseClass).addClass((conf.fixed)?conf.fixedClass:'').addClass((conf.persistent)?conf.persistentClass:'').html(conf.content).appendTo(elem);if(!conf.hidden)tooltip.show();else tooltip.hide();if(!conf.persistent){elem.hover(function(event){self.show(event)},function(){self.hide()});if(!conf.fixed){elem.mousemove(function(event){if(tooltip.css('display')!=='none')self.updatePos(event)})}}else{elem.click(function(event){if(event.target===elem.get(0)){if(tooltip.css('display')!=='none')self.hide();else self.show()}});jQuery(window).mousedown(function(event){if(tooltip.css('display')!=='none'){var check=(conf.focus)?jQuery(event.target).parents('.tooltip').andSelf().filter(function(){return this===tooltip.get(0)}).length:0;if(check===0)self.hide()}})};jQuery.extend(self,{getVersion:function(){return[1,2,0]},getParent:function(){return elem},getTooltip:function(){return tooltip},getPos:function(){return tooltip.offset()},setPos:function(posX,posY){var elemPos=elem.offset();if(typeof posX=='string')posX=parseInt(posX)+elemPos.left;if(typeof posY=='string')posY=parseInt(posY)+elemPos.top;tooltip.css({left:posX,top:posY});return self},show:function(event){conf.onBeforeShow.call(self);self.updatePos((conf.fixed)?null:event);switch(conf.showEffect){case'fade':tooltip.fadeIn(conf.showTime);break;case'slide':tooltip.slideDown(conf.showTime,self.updatePos);break;case'custom':conf.showCustom.call(tooltip,conf.showTime);break;default:case'none':tooltip.show();break};tooltip.addClass(conf.activeClass);conf.onShow.call(self);return self},hide:function(){conf.onBeforeHide.call(self);switch(conf.hideEffect){case'fade':tooltip.fadeOut(conf.hideTime);break;case'slide':tooltip.slideUp(conf.hideTime);break;case'custom':conf.hideCustom.call(tooltip,conf.hideTime);break;default:case'none':tooltip.hide();break};tooltip.removeClass(conf.activeClass);conf.onHide.call(self);return self},update:function(content){tooltip.html(content);conf.content=content;return self},load:function(uri,data){conf.beforeContentLoad.call(self);tooltip.load(uri,data,function(){conf.onContentLoad.call(self)});return self},boundryCheck:function(posX,posY){var newX=posX+tooltip.outerWidth();var newY=posY+tooltip.outerHeight();var windowWidth=jQuery(window).width()+jQuery(window).scrollLeft();var windowHeight=jQuery(window).height()+jQuery(window).scrollTop();return[(newX>=windowWidth),(newY>=windowHeight)]},updatePos:function(event){var tooltipWidth=tooltip.outerWidth();var tooltipHeight=tooltip.outerHeight();if(!event&&conf.fixed){if(conf.position.constructor==Array){posX=parseInt(conf.position[0]);posY=parseInt(conf.position[1])}else if(jQuery(conf.position).attr('nodeType')===1){var offset=jQuery(conf.position).offset();posX=offset.left;posY=offset.top}else{var elemPos=elem.offset();var elemWidth=elem.outerWidth();var elemHeight=elem.outerHeight();switch(conf.position){case'top':var posX=elemPos.left-(tooltipWidth/2)+(elemWidth/2);var posY=elemPos.top-tooltipHeight;break;case'bottom':var posX=elemPos.left-(tooltipWidth/2)+(elemWidth/2);var posY=elemPos.top+elemHeight;break;case'left':var posX=elemPos.left-tooltipWidth;var posY=elemPos.top-(tooltipHeight/2)+(elemHeight/2);break;case'right':var posX=elemPos.left+elemWidth;var posY=elemPos.top-(tooltipHeight/2)+(elemHeight/2);break;default:case'default':var posX=(elemWidth/2)+elemPos.left+20;var posY=elemPos.top;break}}}else{var posX=event.pageX;var posY=event.pageY};if(typeof conf.position!='object'){posX=posX+conf.offset[0];posY=posY+conf.offset[1];if(conf.boundryCheck){var overflow=self.boundryCheck(posX,posY);if(overflow[0])posX=posX-(tooltipWidth/2)-(2*conf.offset[0]);if(overflow[1])posY=posY-(tooltipHeight/2)-(2*conf.offset[1])}}else{if(typeof conf.position[0]=="string")posX=String(posX);if(typeof conf.position[1]=="string")posY=String(posY)};self.setPos(posX,posY);return self}})};jQuery.fn.simpletip=function(conf){var api=jQuery(this).eq(typeof conf=='number'?conf:0).data("simpletip");if(api)return api;var defaultConf={content:'A simple tooltip',persistent:false,focus:false,hidden:true,position:'default',offset:[0,0],boundryCheck:true,fixed:true,showEffect:'fade',showTime:150,showCustom:null,hideEffect:'fade',hideTime:150,hideCustom:null,baseClass:'tooltip',activeClass:'active',fixedClass:'fixed',persistentClass:'persistent',focusClass:'focus',onBeforeShow:function(){},onShow:function(){},onBeforeHide:function(){},onHide:function(){},beforeContentLoad:function(){},onContentLoad:function(){}};jQuery.extend(defaultConf,conf);this.each(function(){var el=new Simpletip(jQuery(this),defaultConf);jQuery(this).data("simpletip",el)});return this}})();

/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
*/
jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1}var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000))}else{date=options.expires}expires='; expires='+date.toUTCString()}var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('')}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break}}}return cookieValue}};
