function twitParser(a){this.twit_id="104254488";this.twitFollow=null;this.twits_max=5;this.twit_dir_level=0;this.twit_dir_name="../";this.twit_path="";if(typeof a.twitID!="undefined"){this.twit_id=a.twitID}if(typeof a.entries!="undefined"){this.twits_max=a.entries}if(typeof a.level!="undefined"){this.twit_dir_level=a.level;if(this.twit_dir_level>0){for(var b=0;b<this.twit_dir_level;++b){this.twit_path+=this.twit_dir_name}}}this.twit_path+="proxy.asp?url=https://twitter.com/statuses/user_timeline/"+this.twit_id+".rss";if(window.XMLHttpRequest){this.twit_obj=new XMLHttpRequest()}else{this.twit_obj=new ActiveXObject("Microsoft.XMLHTTP")}this.twit_obj.open("GET",this.twit_path,false);this.twit_obj.send("");if(this.twit_obj.readyState==4){if(this.twit_obj.status!=200){this.twit_path="../"+this.twit_path;this.twit_obj.open("GET",this.twit_path,false);this.twit_obj.send("");if(this.twit_obj.status!=200){this.twit_path="../../"+this.twit_path;this.twit_obj.open("GET",this.twit_path,false);this.twit_obj.send("")}}}this.twitDoc=this.twit_obj.responseText;this.twitDoc=this.strToXml(this.twitDoc);if(!this.validate()){return}this.parse();return this}twitParser.prototype.strToXml=function(a){if(window.DOMParser){parser=new DOMParser();xmlDoc=parser.parseFromString(a,"text/xml")}else{xmlDoc=new ActiveXObject("Microsoft.XMLDOM");xmlDoc.async="false";xmlDoc.loadXML(a)}return xmlDoc};twitParser.prototype.urlToLink=function(a){a=a.replace(/((http|ftp):\/\/[\w-_#.@\/~&%?=]+)/g,'<a href="$1" target="_blank">$1</a>');a=this.twitSearch(a);return a};twitParser.prototype.urlMatch=function(a){if(a.match(/^(http|ftp):\/\/[\w-_#.@%~&]+$/)){return true}else{return false}};twitParser.prototype.stripUsername=function(a){if(this.twitFollow==null){return false}return a.substr(this.twitFollow.split("/")[3].length+2,a.length)};twitParser.prototype.userLink=function(a){return a.replace(/@([\w_-]+)/,'<a href="http://twitter.com/$1" target="_blank">$1</a>')};twitParser.prototype.formatDate=function(a){a=a.replace(/(\+\S+) (.*)/,"$2 $1");date=new Date(Date.parse(a)).toLocaleDateString()+" "+new Date(Date.parse(a)).toLocaleTimeString();return date};twitParser.prototype.twitSearch=function(a){return a.replace(/((#)([\w\d-_]+))/g,'<a href="http://twitter.com/search?q=%23$3" target="_blank">$1</a>')};twitParser.prototype.validate=function(){if(this.twitDoc.getElementsByTagName("channel").length<=0){return false}tmp=this.twitDoc.getElementsByTagName("channel")[0];if((tmp=tmp.getElementsByTagName("link")).length<=0){return false}this.twitFollow=tmp[0].childNodes[0].nodeValue;if(typeof this.twitFollow!="string"){return false}if(typeof document.getElementById("twitContainer")=="undefined"||document.getElementById("twitContainer")==null||!document.getElementById("twitContainer")){return false}return true};twitParser.prototype.parse=function(){var f,b=this.twitDoc.getElementsByTagName("item");var d,e='<DIV class="RssContainer TwitterContainer">';for(var c=0,a=b.length;c<a;++c){f=b[c];if(c>this.twits_max-1){break}e+='<div class="twitter_item">';e+='<div class="twitter_link"><a href="'+f.getElementsByTagName("link")[0].childNodes[0].nodeValue+'">Lees op twitter</a></div>';d=f.getElementsByTagName("pubDate")[0].childNodes[0].nodeValue;e+='<div class="twitter_datum">'+this.formatDate(d)+"</div>";d=this.stripUsername(f.getElementsByTagName("title")[0].childNodes[0].nodeValue);e+='<div class="twitter_tekst">'+this.urlToLink(d)+"</div>";e+="</div>"}if(this.twitFollow!=null){e+='<a href="'+this.twitFollow+'" target="_blank"><div class="twitter_channellink"></div></a>'}e+="</div>";document.getElementById("twitContainer").getElementsByTagName("div")[0].innerHTML+=e};
