// ==UserScript==
// @name           ebis Yahoo! stuff
// @namespace      gorn.ch
// @description    Does some nice things :)
// @include        http://search.yahoo.com/*
// ==/UserScript==

function xpath(doc, xpath) {
    return doc.evaluate(xpath, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
    }
    
function checkpath() {
    var nodes = xpath(document, "//a[@class='yschttl'][starts-with(@href, 'http://rds.yahoo.com/')]");
    for (var i=0;  i < nodes.snapshotLength  ;i++) {
        var yahooLink = nodes.snapshotItem(i).href;
        var cut       = yahooLink.lastIndexOf('**') + 2;
        nodes.snapshotItem(i).href = unescape(yahooLink.substr(cut));
    }
}

function clearList() {
    var items = xpath(document, "//div[@id='yschweb']/ol/li");
    for (var i=0;  i < items.snapshotLength  ;i++) {
        if ( i%2 == 0) {
            items.snapshotItem(i).style.clear = 'left';
        }
    }
}

clearList();
checkpath();
