// Settings
if (postcodeFired == null)	{ var postcodeFired = false;}
if (cityFired == null)		{ var cityFired = false;}
if (countyFired == null)	{ var countyFired = false;}


// Postcode Settings
var oFindPostcode = document.getElementById('findStore_postcode');

if (oFindPostcode != null){
	
	oFindPostcode.onfocus	=  function(event) { 
								if(oFindPostcode.value == 'Enter your postcode'){ oFindPostcode.value = '';}
							};
	
	oFindPostcode.onblur	=  function(event) { 
								if(oFindPostcode.value == ''){ oFindPostcode.value = 'Enter your postcode'; postcodeFired = false;}
								else { lastEntered = 'postcode';}
							};
}

// City Settings
var oFindCity = document.getElementById('findStore_city');

if (oFindCity != null){
	
	oFindCity.onfocus	=  function(event) { 
							if(oFindCity.value == 'Enter your town or city'){ oFindCity.value = '';}
						};
	
	oFindCity.onblur	=  function(event) { 
							if(oFindCity.value == ''){ oFindCity.value = 'Enter your town or city'; cityFired = false;}
							else { lastEntered = 'city';}
						};
}

// County Settings
var oFindCounty = document.getElementById('findStore_county');

if (oFindCounty != null){
	
	oFindCounty.onfocus	=  function(event) { 
							if(oFindCounty.value == 'Enter your county'){ oFindCounty.value = '';}
						};
	
	oFindCounty.onblur	=  function(event) { 
							if(oFindCounty.value == ''){ oFindCounty.value = 'Enter your county'; countyFired = false;}
							else { lastEntered = 'county';}
						};
}

function submitSearch(){

	if((oFindPostcode.value == 'Enter your postcode') || lastEntered == 'city'){
		oFindPostcode.value = '';
	}
	
	if((oFindCity.value == 'Enter your town or city') || lastEntered == 'postcode'){
		oFindCity.value = '';
	}
}

function prefillAddress (oElement, type) {
	
	var defaultText = 'Please supply your full address either by using the find button above (which will search for your address from the postcode you supplied) or else enter manually by typing in this box.';
	
	if (oElement.value == '' && (type == 'blur' || type =='')) {
		
		oElement.style.color 	= '#999';
		oElement.value 			= defaultText;
		
	} else if(oElement.value == defaultText && type == 'focus') {
		
		oElement.style.color 	= '#000';
		oElement.value 			= '';
	}
}

function redir (url) {
    location.href = url;
}

