// ==UserScript==
// @name		BOL no ads
// @namespace		http://www.rulac.net/userjs/imdb-no-ads/
// @description		remove ads
// @version		1.7
// @include		http://*.bug.hr/*
// ==/UserScript==

document.addEventListener("DOMContentLoaded", function(){
	// remove iframe adds
	iframe	= document.getElementsByTagName("iframe");
	for (i = 0; i < iframe.length; i++){			
		iframe[i].setAttribute("style", "display:none;width:0px;");
	}
	if (flash_ad = document.getElementById("FLASH_AD")){
		flash_ad.setAttribute("style", "display:none;width:0px;");
	}
	if (nethr_flashad = document.getElementById("nethr_flashad")){
		nethr_flashad.setAttribute("style", "display:none;width:0px;");
	}
	divs	= document.getElementsByTagName("div");
	for (i = 0; i < divs.length; i++){
		if (divs[i].getAttribute("class") == "banner" || divs[i].getAttribute("class") == "logo-ms" || divs[i].getAttribute("class") == "header_icons" || divs[i].getAttribute("class") == "m-banner" || divs[i].getAttribute("class") == "oglas" || divs[i].getAttribute("class") == "top-banner"){	
			divs[i].setAttribute("style", "display:none;");
			removeWho(divs[i]);
		}
	}
	if(location.href.indexOf("www.bug.hr/master/") == -1){
		if (header1 = document.getElementById("header")){
			header1.setAttribute("style", "height:95px;width:100%;float:left;margin:0 0 -28px;position:relative;z-index:60;");
		}
		divs	= document.getElementsByTagName("div");
		for (i = 0; i < divs.length; i++){
			if (divs[i].getAttribute("class") == "header-bg"){
				divs[i].setAttribute("style", "height:95px;width:100%;float:left;clear:both;background-image:url(/images/header-bg.png) no-repeat; background-position: bottom center");
			}
		}
		uls	= document.getElementsByTagName("ul");
		for (i = 0; i < divs.length; i++){
			if (uls[i].getAttribute("class") == "sub-nav"){	
				uls[i].setAttribute("style", "top:64px;right:29px;position:absolute;z-index:100;margin:0;padding:25px 0 0;float:right;");
			}
		}
	}
    	object	= document.getElementsByTagName("object");
    	for (i = 0; i < object.length; i++){
    		embed			= object[i].getElementsByTagName("embed")[0];
    		if (embed.src.lastIndexOf("/ads/") > -1){
    			object[i].setAttribute("style", "display:none;");
    		}
    	}
	function removeWho(who){
		if (typeof who == 'string') who=document.getElementById(who);
		if (who && who.parentNode){
			while (who.firstChild){
				who.removeChild(who.firstChild);
			}
		}
	}
}, false);