var newWindowLinks = {
	init: function () {
		var anchors, no, i;
		anchors = Base.getElementsByClass('new-window');
		no = anchors.length;
		for (i=0; i < no; i++) {
			Base.addEventListener(anchors[i], 'click', newWindowLinks.open);
		}
	},
	open: function (event) {
		var return_value = true;
		if (window.open(this.href)) {
			Base.preventDefault(event);
			return_value = false;
		}
		return return_value;
	}
}

var googleSearchForm = {
	init: function () {
		Base.addEventListener(Base.byId('google-search-banner'), 'submit', function () { this.q.value='site:www.chimneyrock.co.uk ' + this.searchtermlistbanner.value; }
		);
		Base.addEventListener(Base.byId('google-search-footer'), 'submit', function () { this.q.value='site:www.chimneyrock.co.uk ' + this.searchtermlistfooter.value; }
		);
	}
	
};
var siteBookmarkIE = {
	init: function () {
		if (typeof window.external.AddFavorite !== 'undefined') {
			Base.addEventListener(Base.byId('IE-Bookmark'), 'click', siteBookmarkIE._addBookmarkIE);
		}
	},
	_addBookmarkIE: function (event) {
		window.external.AddFavorite('http://www.chimneyrock.co.uk/', 'Chimney Rock Web Design');
		// don't forget to cancel the default action (called from anchor href #null), irrespective of success
		Base.preventDefault(event);
		return false; 
	}
};
Base.start(googleSearchForm);
Base.start(siteBookmarkIE);
Base.start(newWindowLinks);