function animate_box(action, i) {

	//ensure height of the container is never set as more than its true height
	if (i > 500) return;
	
	//ensure no values below 1
	if (i < 1) i = 1;

	//work out the increment, posotive if showing the box, otherwise negative
	var increment = ( action == "show" ) ? 25 : -25;

	//get a x-browser reference to the search box
	var element = (document.all) ? document.all.dds : document.getElementById('dds');
	
	//set the elements new height
	element.style.height = "" + i + "px";
	
	//if showing the box, or hiding and the height isn't 1 then recursive call the function, with a new value of i
	if (i != 1 || action == "show") setTimeout("animate_box('" + action + "', " + (i + increment) + ")", 10);


} //endfunction

function toggle_search(toggle) {

	//set description code for both states
	var show_text = '<a href="javascript:toggle_search(\'show\');" class="white" \/>Click here for a new search<\/a>';
	var hide_text = '<a href="javascript:toggle_search(\'hide\');" class="white" \/>Click here to hide this box<\/a>';

	//get x-browser references to the elements
	var search_text = (document.all) ? document.all.search_text : document.getElementById('search_text');
	var dds_container = (document.all) ? document.all.dds_container : document.getElementById('dds_container');
	
	if(toggle == "show") { //if showing...

		//change the description text, show the box and change the background image
		search_text.innerHTML = hide_text;
		animate_box('show', 0);
		dds_container.style.backgroundImage = "url('/images/property_listing_start_new_search_expanded.png')";

	} else { //if hiding...
			
		//change the description text, hide the box and change the background image
		search_text.innerHTML = show_text;
		animate_box('hide', 500);
		dds_container.style.backgroundImage = "url('/images/property_listing_start_new_search.png')";
	
	} //endif

} //endfunction