// ==UserScript==
// @name           Blingo Hide Sponsored Links
// @namespace      http://downloads.joeyday.com
// @description    Hides sponsored links sections on Blingo.com.
// @include        http://www.blingo.com/search*
// @include        http://blingo.com/search*
// ==/UserScript==

function addGlobalStyle(css) {
    var head, style;
    head = document.getElementsByTagName('head')[0];
    if (!head) { return; }
    style = document.createElement('style');
    style.type = 'text/css';
    style.innerHTML = css;
    head.appendChild(style);
}

addGlobalStyle('div.sponsoredSection { visibility: hidden; height: 0; margin: 0; padding: 0}');
addGlobalStyle('div.bottomSponsoredSection { visibility: hidden; height: 0; margin: 0; padding: 0}');

var divs = document.getElementsByTagName('div');
var wasSponsored = false;
for (var i = 0; i < divs.length; i++) {
    var thisElem = divs[i];
    if (thisElem.className && thisElem.className == 'resultsSectionSeparator') {
        if (!wasSponsored) {
            thisElem.parentNode.removeChild(thisElem);
            wasSponsored = true;
        }
        else {
            wasSponsored = false;
        }
    }
    
}


