function $x(xpath,root,cb){
        root=root?root:document;
        try{
                var a=document.evaluate(xpath,root,null,7,null);
        }catch(e){
                return[];
        }
        if(cb){
                for(var i = 0; i < a.snapshotLength; i++) {
                        cb(a.snapshotItem(i));
                }
                return a.snapshotLength;
        }else{
                var b=[];
                for(var i = 0; i < a.snapshotLength; i++) {
                        b[i] = a.snapshotItem(i);
                }
                return b;
        }
 }
function $c(type,params){
        if(type=="#text"||type=="#"){
                return document.createTextNode(params);
        }else if(typeof(type)=="string"&&type.substr(0,1)=="#"){
                return document.createTextNode(type.substr(1));
        }else{
                var node=document.createElement(type);
        }
        for(var i in params)if(i=="kids"){
            for(var j in params[i]){
                if(typeof(params[i][j])=='object'){
                                node.appendChild(params[i][j]);
                }
            }
        }else if(i=="#text"){
                node.appendChild(document.createTextNode(params[i]));
        }else{
                node.setAttribute(i,params[i]);
        }
        return node;
 }
function ins(to,what,before){
        try{
                if(before===undefined){
                        if(what instanceof Array){
                                for(var i=0;i<what.length;i++){
                                        to.appendChild(what[i]);
                                }
                        }else{
                                to.appendChild(what);
                        }
                        
                }else if(before===0||typeof(from)=="object"){
                        if(before===0){
                                before=to.firstChild;
                        }
                        if(what instanceof Array){
                                for(var i=0;i<what.length;i++){
                                        to.insertBefore(what[i],before);
                                }
                        }else{
                                to.insertBefore(what,before);
                        }
                }
        }catch(e){      return e;       }
}
if(window.addEventListener)
window.addEventListener('load',function(e){
	var tmp;
	$x("//table[@class='blog']/tbody/tr/td/div/table[@class]|//td[@class='article_column']/table[@class]",0,function(x){
		if(tmp){
			var p=$x("./tbody/tr/td/p",x);
			p=p[0];
			var a=$c("a",{href:tmp,kids:$x(".//img",p)});
			ins(p,a,0);
			tmp=null;
		}else{
			tmp=$x(".//a",x)
			tmp=tmp?tmp[0].href:"--";
		}
	});
},1);
