var yourlocal_what_submit = (document.getElementById('your_local').what.value != 'What?') ;
var yourlocal_where_submit = (document.getElementById('your_local').where.value != 'Where?') ;

function yourlocal_whatfield_blur(field) {
	if(field.value=='') {
		field.value='What?';
		field.style.color='#666';
		yourlocal_what_submit = false;
	} else {
		yourlocal_what_submit = true;
		field.style.color='#000';
	}
}

function yourlocal_whatfield_focus(field) {
	if(field.value=='What?') {
		yourlocal_what_submit = false;
		field.value='';
		field.style.color='#000';
	}
}

function yourlocal_wherefield_blur(field) {
	if(field.value=='') {
		field.value='Where?';
		field.style.color='#666';
		yourlocal_where_submit = false;
	} else {
		yourlocal_where_submit = true;
		field.style.color='#000';
	}
}

function yourlocal_wherefield_focus(field) {
	if(field.value=='Where?') {
		yourlocal_where_submit = false;
		field.value='';
		field.style.color='#000';
	}
}

function yourlocal_form_submit(f){ 		
	var okay = true;
	
	if(!yourlocal_what_submit) {
		f.what.style.color='red';
		okay = false;
	}

	if(!yourlocal_where_submit) {
		f.where.style.color='red';
		okay = false;
	}
	if(!okay) return false;
		
	var yourlocalwhere = f.where.value.toLowerCase().replace(/[\s]+/, '-'); 			
	var yourlocalwhat = f.what.value.toLowerCase().replace(/[\s]+/, '-');						 			  
	win = window.open('http://www.yourlocal.ie/search/' + yourlocalwhere + '/' + yourlocalwhat + '/', 'yourlocal'); 			
	return false; 			
} 			
