// JavaScript Document
var fields = new Array();

// Empty text fields when the user clicks on them
function emptyField(field,value) {
	if (!fields[field]) {
		if (document.getElementById(field).value == value) {
			document.getElementById(field).value = "";
			fields[field] = 1;
		} else if (document.getElementById(field).value == "") {
			document.getElementById(field).value = value;
			fields[field] = 0;
		} else {
			fields[field] = 0;
		}
	}
}

// Show a pop up window
function openWindow(file,width,height,alt) {
	
	window.open("/popup.php?image=" + file + "&alt=" + alt,
alt,"menubar=0,resizable=0,width=" + width + ",height=" + height); 
	
	
}

// Tell users that the buttons cannot be used in the preview pages
function functionDisabled() {
	alert("This is just a preview of your listing.\nThese buttons will only work when your listing \nappears on the site.");
}

// If they have selected the UK then show the county dropdown
function countrySelected(country,country_default) {

	if (document.getElementById('county_select')) {
	
		// If it's the UK
		if (country == country_default) {
			
			document.getElementById('county_select').style.display = "inline";
			document.getElementById('county_txt').style.display = "none";
		
		} else {
		
			document.getElementById('county_select').style.display = "none";
			document.getElementById('county_txt').style.display = "inline";
			
		}
	
	}

}

function searchCountrySelected(country,country_default) {

	// See if it's a suitable page
	if (document.getElementById('c_county_id')) {
	
		// If it's the UK
		if (country == country_default) {
		
			document.getElementById('c_county_id').style.display = "inline";
			document.getElementById('c_county').style.display = "none";
		
		} else {
		
			document.getElementById('c_county_id').style.display = "none";
			document.getElementById('c_county').style.display = "inline";
			
		}

	}
	
}

function otherCountrySelected(country,country_default) {

	// See if it's a suitable page
	if (document.getElementById('o_county_select')) {
	
		// If it's the UK
		if (country == country_default) {
		
			document.getElementById('o_county_select').style.display = "inline";
			document.getElementById('o_county_txt').style.display = "none";
		
		} else {
		
			document.getElementById('o_county_select').style.display = "none";
			document.getElementById('o_county_txt').style.display = "inline";
			
		}

	}
	
}

function checkStatus() {
	
	// See if the property status is Sold
	if (document.getElementById('property-status').value == 3) {
		
		document.getElementById('warning').style.display = "block";
		
	} else {
		
		document.getElementById('warning').style.display = "none";
		
	}
	
}

/*
function checkStatus(form) {
	
	var response = false;
	
	// See if the property status is Sold
	if (document.getElementById('property-status').value == 3) {
		
		var confirmed = confirm("You have opted to set your property status to \"Sold\"\nPlease note that once you classify your\nproperty as sold it will be taken off the site\nand should you wish to relist it again\nyou will be charged the full listing fee\nonce again. Only state your property\nas sold when all contracts have been exchanged.");
		
		if (confirmed == true) {
		
			alert("Congratulations on selling your property, we\ndo hope that Look2Move was useful for you.\nYour property will be shown on the site for\n30 more days and then will be removed.");

			response = true
			
		}
	
	if (response) {
		
		return true;
		
	} else {
		
		return false;
		
	}
	
}
*/