
document.addEventListener('DOMContentLoaded', function () {
    var link = document.getElementById("close_tabs");
    
    link.addEventListener('click', function () {
	getActiveTab(removeTabs);
    });
});
function domain (tab) {
    var x = tab.url.split("/");
    return x[2];
}

function getActiveTab(callback) {
    chrome.tabs.query({
	active: true,
	currentWindow: true
    }, function(tab) {
	callback(tab)
    });
}

function removeTabs(tab){
    chrome.tabs.query({
	currentWindow: true
    }, function (tabs) {
	//console.log(tab[0].url == tabs[1].url);
	var x = domain(tab[0]);

	for (var i = 0; i < tabs.length; i++){
	    if (x == domain(tabs[i])){
		chrome.tabs.remove(tabs[i].id);
	    }
	}
    });
}
/*
window.onload =  function() {
    document.getElementById("close_tabs").addEventListener("click", function() {
        alert("hello");
    });
    
    document.getElementById("combine_windows").addEventListener("click", function() {
        newWindow();
    });
};
*/

@@ -197,16 +197,150 @@
     %7D);%0A
+    %0A    var site = document.getElementById(%22merge_windows%22);%0A    %0A    link.addEventListener('click', function () %7B%0A%09start();%0A    %7D);%0A
 %7D);%0Afunc
@@ -845,16 +845,18 @@
   %7D);%0A%7D%0A
+%0A%0A
 /*%0Awindo

test merger