var q;var counter=0;function ajj(quu){var http;if(window.XMLHttpRequest){http=new XMLHttpRequest();}else{http=new ActiveXObject("Microsoft.XMLHTTP"); }http.onreadystatechange=function(){if(http.readyState==4){if(http.responseText!="OK"){alert(http.responseText);}updater(true);}};http.open("GET",quu,true);http.send(null);}function clear(){if(confirm("Warning if you do this you will not be able to modify or delete these links anymore.")){window.location="http://url2.tk/?user=clear";}}function change(a,b){var yyy=prompt("New URL: ",b);if(yyy){ajj("?a=change&id="+encodeURIComponent(a)+"&new="+encodeURIComponent(yyy));}}function updater(lol){if(lol){document.getElementById("rf").innerText="Updating...";}var http;if(window.XMLHttpRequest){http=new XMLHttpRequest();}else{http=new ActiveXObject("Microsoft.XMLHTTP");}http.onreadystatechange=function(){if(http.readyState==4){upd.innerHTML=http.responseText;document.getElementById("rf").innerText="Refresh";}};http.open("GET","?a=myurls&random="+Math.random(),true);http.send(null);}function del(xx){if(confirm("This cannot be undone. Are you sure you want to delete this link?")){ajj("?a=delete&id="+encodeURIComponent(xx));}}function autolink(s){var hlink=/\s(ht|f)tp:\/\/([^ \,\;\:\!\)\(\"\'\<\>\f\n\r\t\v])+/g;return(s.replace(hlink,function ($0,$1,$2) {s=$0.substring(1,$0.length);while(s.length>0 && s.charAt(s.length-1)=='.')s=s.substring(0,s.length-1);return " "+s.link(s);}));}function ajax(item,url){var http;if(window.XMLHttpRequest){http=new XMLHttpRequest();}else{http=new ActiveXObject("Microsoft.XMLHTTP");}http.onreadystatechange=function(){if(http.readyState==4){q.value=q.value.replace("http://url2.tk/!"+item,"http://url2.tk/"+http.responseText);u();document.getElementById("g").style.opacity="1";}};http.open("GET","?q="+encodeURIComponent(url.replace(/ +$/,"")),true);http.send(null);}function s(e,id){ajax(id,e);document.getElementById("g").style.opacity="0";return "http://url2.tk/!"+id+" ";}function h(e){q.value=q.value.replace(/\n/g," ");m=/(http|ftp|https):\/\/(?!url2\.tk)[^ ]{3,255} /.exec(q.value);if(m){q.value=q.value.replace(m[0],s(m[0],counter++));}u();}function tweet(){q.value=q.value.replace(/[\t\n]/g," ");q.value=q.value.replace(/^ +/,"");q.value=q.value.replace(/ +$/,"");window.location="http://twitter.com/?status="+encodeURIComponent(q.value);}function u(){document.getElementById("c").innerText=140-q.value.length;p.innerHTML=autolink(" "+q.value);}function hide(){document.getElementById("x").style.display="none";document.getElementById("xs").style.display="block";document.getElementById("xs").innerHTML="<a href=\"javascript:show()\">Show My URLS</a>";}function show(){document.getElementById("x").style.display="block";document.getElementById("xs").innerHTML="<a href=\"javascript:hide()\">Hide URLS</a>";}setInterval("updater(false)",10000);var stshow=false;function settings(){stshow=!stshow;var ov=document.getElementById("ov");document.getElementById("sh").style.display=stshow?"block":"none";if(stshow){ov.style.background="white";ov.style.border="1px solid black";}else{ov.style.background="";ov.style.border="1px solid white";}}function ask(){var nc="ask="+(document.getElementById("askfirst").checked?"y":"n")+";expires="+(new Date( new Date().getTime()+1000*60*60*24*365).toGMTString())+";path=/;domain=url2.tk";document.cookie=nc;}if(document.getElementById("q")){q=document.getElementById("q");}if(document.getElementById("upd")){upd=document.getElementById("upd");}
