
function CheckSearchText() {
	var searchText = document.getElementById('TopNav_tbSearchText');
	if (searchText.value.length == 0)
		searchText.value = 'Search for ...';
}
function SearchTextFocus() {
	SetSubmitButton('TopNav_SearchButton');
	var searchText = document.getElementById('TopNav_tbSearchText');
	var errorDiv = document.getElementById('searchError');
	errorDiv.style.display = 'none';
	searchText.value = '';
}
function LocationBlur() {
	var location = document.getElementById('TopNav_tbLocation');
	if (location.value.length == 0)
		location.value = 'Postcode or Town ...';
}
function LocationFocus() {
	SetSubmitButton('TopNav_SearchButton');
	var location = document.getElementById('TopNav_tbLocation');
	var errorDiv = document.getElementById('TopNav_locationError');
	if (errorDiv != null)
		errorDiv.style.display = 'none';
	location.value = '';
}
function SetScopeType(type) {
	var hiddenScopeType = document.getElementsByName('ScopeType')[0];
	hiddenScopeType.value = type;
	SelectScopeType();
}
function SelectScopeType() {
	var whatsOnSearch = document.getElementById('selWhatsOn');
	var classSearch = document.getElementById('selClassifieds');
	var hiddenScopeType = document.getElementsByName('ScopeType')[0];
	if (hiddenScopeType.value == "WhatsOn") {
		whatsOnSearch.src = "/images/topnav/whatsonon.gif";
		classSearch.src = "/images/topnav/classifiedsoff.gif";
	}
	else {
		whatsOnSearch.src = "/images/topnav/whatsonoff.gif";
		classSearch.src = "/images/topnav/classifiedson.gif";
	}	
}
function OnSearch() {
	var searchText = document.getElementById('TopNav_tbSearchText');
	var errorDiv = document.getElementById('searchError');
	if (searchText.value.length == 0 || searchText.value == 'Search for ...') {
		errorDiv.style.display = 'block';
		return false;
	}
	return true;
}
function CreateBookmarkLink() {   
	if( window.external ) { 
		// IE Favorite		
		window.external.AddFavorite( url, title); 
	}	
	else if(window.opera && window.print) { 
		// Opera Hotlist		
		return true; 
	}
} 
function OutputBookmark(){
	if (window.external) {  
		document.write('&nbsp;|&nbsp;<a rel=nofollow href = "javascript:CreateBookmarkLink();">Add to Favorites</a>');   
	} 
	else if (window.opera && window.print) {
		document.write('&nbsp;|&nbsp;<a rel=nofollow href = "javascript:CreateBookmarkLink();">Add Bookmark</a>'); 
	}
}
