function getXmlHttp(){var a;if(window.XMLHttpRequest){a=new XMLHttpRequest()}else{a=new ActiveXObject("Microsoft.XMLHTTP")}return a}function SendGetRequest(c,a){var b=getXmlHttp();b.open("GET",a,true);b.onreadystatechange=function(){if(b.readyState==4){if(b.status==200){try{restxt=b.responseText;document.getElementById(c).innerHTML=restxt}catch(d){}}}};b.send(null)}var progress_bar_counter=0;function ShowProgressBar(){document.getElementById("progressbar").style.display="";document.getElementById("fade_bg").style.display="";progress_bar_counter++}function HideProgressBar(){progress_bar_counter--;if(progress_bar_counter==0){document.getElementById("progressbar").style.display="none";document.getElementById("fade_bg").style.display="none"}}function SendDownloadForm(){var c=document.getElementById("download-form");var g=c.action;var k=new Array();var a=0;for(a=0;a<c.elements.length;a++){var d=c.elements[a];var j=d.name;var f=d.value;k.push(j+"="+encodeURIComponent(f))}var b=k.join("&");ShowProgressBar();var h=getXmlHttp();h.open("POST",g,true);h.setRequestHeader("Content-type","application/x-www-form-urlencoded");h.setRequestHeader("Content-length",b.length);h.setRequestHeader("Connection","close");h.onreadystatechange=function(){if(h.readyState==4){if(h.status==200){try{var n=h.responseText;var l=new RegExp("^error:","gim");if(n.match(l)){alert(n.replace(l,""));HideProgressBar()}else{document.location.href=n}}catch(m){}}}};h.send(b)}function LoadForm(a,b){element=document.getElementById(a);if(element.childNodes.length<3){element.innerHTML="Loading form...";SendGetRequest(a,b)}else{element.innerHTML=""}}var rated=new Array();function UpdateRate(a,b){if(rated[a]!=1){SendGetRequest(a,b);rated[a]=1}}function UpdateContainerFromUrl(c,a){var b=getXmlHttp();b.open("GET",a,true);b.onreadystatechange=function(){if(b.readyState==4){if(b.status==200){try{restxt=b.responseText;document.getElementById(c).innerHTML=document.getElementById(c).innerHTML+restxt}catch(d){}}}};b.send(null)}var no_sug=0;var suggs=Array();var suggs_cache=Array();var sugg_index=-1;var sugg_last_keypress=0;var sugg_keypress_interval=300;function NotEmptyLine(a,c,b){return(a!="")}function SuggestFromBackend(d,a,c){if(new Date().getTime()-sugg_last_keypress>=sugg_keypress_interval){var b=getXmlHttp();b.open("GET","/hint/?qs="+escape(d),true);b.onreadystatechange=function(){if(b.readyState==4){if(b.status==200){try{restxt=b.responseText;suggs=restxt.split("\n").filter(NotEmptyLine).sort();suggs_cache[d]=suggs;sugg_index=-1;DisplaySuggs(a,c);document.getElementById(c).style.display=""}catch(f){}}}};b.send(null)}}function Suggest(b,c,a){sugg_last_keypress=new Date().getTime();if(!Array.prototype.filter){Array.prototype.filter=function(f){var h=this.length;if(typeof f!="function"){throw new TypeError()}var k=new Array();var d=arguments[1];for(var j=0;j<h;j++){if(j in this){var g=this[j];if(f.call(d,g,j,this)){k.push(g)}}}return k}}if(no_sug==0&&b.length>1){if(suggs_cache[b]){suggs=suggs_cache[b];sugg_index=-1;DisplaySuggs(c,a);document.getElementById(a).style.display=""}else{setTimeout("SuggestFromBackend('"+b+"', '"+c+"', '"+a+"');",sugg_keypress_interval)}}else{document.getElementById(a).style.display="none";document.getElementById(a).innerHTML=""}no_sug=0}function SetQuery(b,c,a){no_sug=1;document.getElementById(c).value=b;document.getElementById(a).style.display="none";document.getElementById(a).innerHTML=""}function HideSuggest(a){document.getElementById(a).style.display="none";document.getElementById(a).innerHTML=""}function SuggestKeyPress(d,c,g,b,a){var h=window.event?event:d;var f=h.charCode?h.charCode:h.keyCode;if(f==38&&sugg_index>-1){sugg_index--;DisplaySuggs(g,b)}else{if(f==40&&sugg_index<suggs.length-1){sugg_index++;DisplaySuggs(g,b)}else{if(f==13){if(document.getElementById(b).style.display==""&&sugg_index>-1){SetQuery(suggs[sugg_index],g,b)}else{if(document.getElementById(g).value!=""){document.forms[a].submit()}}}else{if(f==27){HideSuggest(b)}else{if(f>=48||f==8||f==46||f==32){Suggest(c,g,b)}else{}}}}}return false}function DisplaySuggs(c,f){var b="";if(suggs.length>0){for(i=0;i<suggs.length;i++){var a="sugg_"+i;var d="onclick=\"javascript:SetQuery('"+suggs[i]+"', '"+c+"', '"+f+"')\"";if(i==sugg_index){b+="<span "+d+' id="'+a+'" class="request_hint_item_active">'+suggs[i]+"</span><br>\n"}else{b+="<span "+d+' id="'+a+'" class="request_hint_item">'+suggs[i]+"</span><br>\n"}}}else{b='<span style="font-style:italic;">No suggestions found...</span>\n'}document.getElementById(f).innerHTML=b}function CloseGoFrame(){parent.document.getElementById("fiframes").rows="0,*"}function ShowAdvanced(){e=document.getElementById("search-detail");if(e.style.display=="block"){e.style.display="none"}else{e.style.display="block"}}function ShowTab(a,c,b,d){for(i=1;i<=c;i++){if(i==a){document.getElementById(b+i).style.display="";document.getElementById(d+i).className="active"}else{document.getElementById(b+i).style.display="none";document.getElementById(d+i).className=""}}}function ShowSpoilerContent(a){document.getElementById(a+"_head").style.display="none";document.getElementById(a+"_content").style.display=""}function HideSpoilerContent(a){document.getElementById(a+"_head").style.display="";document.getElementById(a+"_content").style.display="none"}function InitEventTracker(){var h="";if(typeof(page_current)=="undefined"){h=location.pathname.split("/")[1];if(h==""){h="/"}}else{h=page_current}var b={"/":[{id:"newcomers",action:"newcomers"},{id:"blogposts-last",action:"blogposts-last"},{id:"downloads-top",action:"downloads-top"},{id:"trends_files_1",action:"downloads-top"},{id:"trends_files_2",action:"downloads-top"},{id:"cloud",action:"search-last"},{id:"downloads-my",action:"downloads-my"},{id:"searchform",action:"select-hosting",child:"select"},{id:"searchform",action:"search-form",child:"input"},{id:"toolbar",action:"toolbar-download"},{id:"banners_1",action:"banners",child:"iframe"},{id:"banners_2",action:"banners",child:"iframe"},{id:"banners_3",action:"banners",child:"iframe"},{id:"banners_4",action:"banners",child:"iframe"},{id:"banners_5",action:"banners",child:"iframe"},{id:"banners_6",action:"banners",child:"iframe"},{id:"banners_7",action:"banners",child:"iframe"},{id:"banners_8",action:"banners",child:"iframe"},{id:"banners_8",action:"banners",child:"iframe"},{id:"banners_10",action:"banners",child:"iframe"}],download:[{id:"search-result",action:"serp"},{id:"search-result-exact",action:"search-result-exact"},{id:"search-similar",action:"similar"},{id:"tab_1",action:"tags"},{id:"search-latest",action:"latest"},{id:"search-tags",action:"tags"},{id:"tab_2",action:"tags"},{id:"search-pager",action:"pager"},{id:"searchform",action:"select-hosting",child:"select"},{id:"searchform",action:"search-form",child:"input"},{id:"link-more-result",action:"link-more-result"},{id:"search-orderby",action:"search-orderby"},{id:"banners_1",action:"banners",child:"iframe"},{id:"banners_2",action:"banners",child:"iframe"},{id:"banners_3",action:"banners",child:"iframe"},{id:"banners_4",action:"banners",child:"iframe"},{id:"banners_5",action:"banners",child:"iframe"},{id:"banners_6",action:"banners",child:"iframe"},{id:"banners_7",action:"banners",child:"iframe"},{id:"banners_8",action:"banners",child:"iframe"},{id:"banners_8",action:"banners",child:"iframe"},{id:"banners_10",action:"banners",child:"iframe"}],fileinfo:[{id:"search-latest",action:"latest"},{id:"search-tags",action:"tags"},{id:"search-related",action:"relate"},{id:"tab_1",action:"relate"},{id:"search-download",action:"last-download"},{id:"tab_2",action:"relate"},{id:"searchform",action:"select-hosting",child:"select"},{id:"searchform",action:"search-form",child:"input"},{id:"banners_1",action:"banners",child:"iframe"},{id:"banners_2",action:"banners",child:"iframe"},{id:"banners_3",action:"banners",child:"iframe"},{id:"banners_4",action:"banners",child:"iframe"},{id:"banners_5",action:"banners",child:"iframe"},{id:"banners_6",action:"banners",child:"iframe"},{id:"banners_7",action:"banners",child:"iframe"},{id:"banners_8",action:"banners",child:"iframe"},{id:"banners_8",action:"banners",child:"iframe"},{id:"banners_10",action:"banners",child:"iframe"}]};var a;if(b[h]!==undefined){a=b[h]}else{return false}for(i in a){if(a[i].child===undefined){a[i].child="a"}var j=document.getElementById(a[i].id);if(j!==null){var f=h;var g=a[i].action;if(a[i].current!=null&&a[i].current){childs.push(j)}else{childs=j.getElementsByTagName(a[i].child)}for(y in childs){if(childs[y].nodeType!=1){continue}if(childs[y].className!==undefined){if(childs[y].className.match("trackEvent-none")){continue}var c=[];if((c=childs[y].className.match("trackEventAction-(.+)"))!==null){g=c[1]}}var d=childs[y].nodeName.toLowerCase();if(d=="a"){(function(k,m,l){addHandler(childs[k],"click",function(){pageTracker._trackEvent(m,l,this.href)})})(y,f,g)}else{if(d=="input"){(function(k,m,l){addHandler(childs[k],"click",function(){pageTracker._trackEvent(m,l,this.name)})})(y,f,g)}else{if(d=="select"){(function(k,m,l){addHandler(childs[k],"change",function(){pageTracker._trackEvent(m,l,this.value)})})(y,f,g)}else{if(d=="iframe"){(function(l,k,m,n){setTimeout(function(){addHandler(n.ownerDocument.body,"click",function(){pageTracker._trackEvent(k,m,this.src)})},5000)})(y,f,g,childs[y])}}}}}}}}setGlobalOnLoad(InitEventTracker);function addHandler(c,b,a){if(typeof c.addEventListener!="undefined"){c.addEventListener(b,a,false)}else{if(typeof c.attachEvent!="undefined"){c.attachEvent("on"+b,a)}}}function removeHandler(c,b,a){if(typeof c.removeEventListener!="undefined"){c.removeEventListener(b,a,false)}else{if(typeof c.detachEvent!="undefined"){c.detachEvent("on"+b,a)}}}function setGlobalOnLoad(b){var c=window.addEventListener||window.attachEvent?window:document.addEventListener?document:null;if(c){if(c.addEventListener){c.addEventListener("load",b,false)}else{if(c.attachEvent){c.attachEvent("onload",b)}}}else{if(typeof window.onload=="function"){var a=window.onload;window.onload=function(){a();b()}}else{window.onload=b}}};
