function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName('a');
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute('href') && 	(/external/.test(anchor.getAttribute('rel'))) ) {
			anchor.target = '_blank';
			anchor.className = 'externalLink';
			anchor.setAttribute('title', 'Open in a new window');
		}
	}
}

var DEF_VAL = "Search..."; // Default Value
var AUTOSAVE_URL = "com.defaultstate.www" // Autosave URL
var NUM_RESULTS = 5 // Number of Results

var isSafari = ((parseInt(navigator.productSub)>=20020000)&&	 // detecting WebCore
			   (navigator.vendor.indexOf("Apple Computer")!=-1));
var searchBox = {
	'#q' : function(element){
		if (isSafari) {
			// changing type to "search"
			element.setAttribute('type', 'search');
			element.setAttribute('placeholder', DEF_VAL);
			element.setAttribute('autosave', AUTOSAVE_URL);
			element.setAttribute('results', NUM_RESULTS);
		} else {
			// doing the "Search this Site..."-Displaying- & -Hiding-Stuff
			element.onfocus = function() { if (this.value==DEF_VAL) this.value = ''; };
			element.onblur	= function() { if (this.value=='')		this.value = DEF_VAL; };
			if (element.value=='') element.value = DEF_VAL;
		}
	}
};

Behaviour.register(searchBox);
Event.observe(window, "load", externalLinks);