// Released under the GPL license
// http://www.gnu.org/copyleft/gpl.html
// Ajit Burad
// http://www.cse.iitb.ac.in/~ajitb
// http://burad.blogspot.com
// --------------------------------------------------------------------
//
// This is a Greasemonkey user script.  To install it, you need
// Greasemonkey 0.3 or later: http://greasemonkey.mozdev.org/
// Then restart Firefox and revisit this script.
// Under Tools, there will be a new menu item to "Install User Script".
// Accept the default configuration and install.
//
// To uninstall, go to Tools/Manage User Scripts,
 // select "URL Replacer", and click Uninstall.
//Author : Ajit Burad
//
// --------------------------------------------------------------------
//
// ==UserScript==
// @name          URL Replacer
// @namespace     http://diveintomark.org/projects/greasemonkey/
// @description   Replaces each url in a webpage with some predefined URL
// @include       http://*
// @include       https://*
// ==/UserScript==
var url1,url2;
url1 = ['www.youtube.com','youtube.com', 'www.video.google.com', 'video.google.com', 'adbanner', 'advertisement', 'adserver', 'doubleclick'];
url2 = ['208.65.153.242','208.65.153.242', 'video.l.google.com', 'video.l.google.com', ' ', ' ',' ',' ' ]; 
var a, links;
var tmp="a";
var p,q;
links = document.getElementsByTagName('a');
for (var i = 0; i < links.length; i++) {
    a = links[i];
    for(var j=0;j<url1.length; j++)
	{
	tmp = a.href+"" ;
	if(tmp.indexOf(url1[j]) != -1)
	{
	p=tmp.indexOf(url1[j]) ;
	q="http://";
	q = q + url2[j] + tmp.substring(p+url1[j].length,tmp.length);
	a.href=q ;
	}
	}
    }

//
// ChangeLog
// 2005-04-18 - 0.2 - MAP - Its just the beginning