function show_areas(show)
{
    if(show)
    {
        $("p#more_areas_link").hide();
        $("p#less_areas_link").show();
        $("li.liareahidden").show();
    }
    else
    {
        $("p#more_areas_link").show();
        $("p#less_areas_link").hide();
        $("li.liareahidden").hide();
    }
}

function show_categories(show)
{
    if(show)
    {
        $("p#more_categories_link").hide();
        $("p#less_categories_link").show();
        $("li.licategoryhidden").show();
    }
    else
    {
        $("p#more_categories_link").show();
        $("p#less_categories_link").hide();
        $("li.licategoryhidden").hide();
    }
}

function upload_photo()
{
    $("a#add-photo-button").hide();
    $("div#file-upload-box").show();
}

$(document).ready(function()
{
    //var editbut = document.getElementById("update-bus");
    //editbut.onclick = function hidediv (editbut){
    //    var homeboxfirst = document.getElementById("homeboxfirst");
    //    var homeboxsecond = document.getElementById("homeboxsecond");
    //    var editbut = document.getElementById("update-bus");
    //    homeboxfirst.style.display = "none";
    //    homeboxsecond.style.display = "";
    //    editbut.style.display = "none";
    //    return false;
    //}
    
    var whattext = "e.g. French Restaurant";
	var whatField = document.getElementById("search_what");
	whatField.blur();
	if(whatField.value==""){
		whatField.style.color="#ccc";
		whatField.setAttribute("value", whattext);
		whatField.value= whattext;
	} else {
		whatField.focus();
	}
	whatField.onfocus=whattextFieldClear;
	whatField.onblur=whattextFieldCheck;
        
    var wheretext = "e.g. Leeds or Fulham or SW3";
	var whereField = document.getElementById("search_where");
	whereField.blur();
	if(whereField.value==""){
		whereField.style.color="#ccc";
		whereField.setAttribute("value", wheretext);
		whereField.value= wheretext;
	} else {
		whereField.focus();
	}
	whereField.onfocus=wheretextFieldClear;
	whereField.onblur=wheretextFieldCheck;

	var whatField2 = document.getElementById("ac_what2");
	whatField2.blur();
	if(whatField2.value==""){
		whatField2.style.color="#ccc";
		whatField2.setAttribute("value", whattext);
		whatField2.value= whattext;
	}
	whatField2.onfocus=whattextFieldClear;
	whatField2.onblur=whattextFieldCheck;
        
	var whereField2 = document.getElementById("ac_where2");
	whereField2.blur();
	if(whereField2.value==""){
		whereField2.style.color="#ccc";
		whereField2.setAttribute("value", wheretext);
		whereField2.value= wheretext;
	}
	whereField2.onfocus=wheretextFieldClear;
	whereField2.onblur=wheretextFieldCheck;
        
    function whattextFieldClear(){
        if(this.value==whattext){
            this.style.color="#000";
            this.setAttribute("value","");
            this.value="";
        }
    }
    
    function whattextFieldCheck(){
        if(this.value==""){
            this.style.color="#ccc";
            this.value=whattext;
        }
    }
        
    function wheretextFieldClear(){
        if(this.value==wheretext){
            this.style.color="#000";
            this.setAttribute("value","");
            this.value="";
        }
    }
    
    function wheretextFieldCheck(){
        if(this.value==""){
            this.style.color="#ccc";
            this.value=wheretext;
        }
    }
	
	$("a#similar_list_a").click( function() {
		
		$("div#google_map").hide();
		$("div#similar_list").show();
		$("a#similar_map_a").removeClass('selected');
		$("a#similar_list_a").addClass('selected');
		return false;
		
	});
	
	$("a#similar_map_a").click( function() {
		
		$("div#similar_list").hide();
		$("div#google_map").show();
		$("a#similar_list_a").removeClass('selected');
		$("a#similar_map_a").addClass('selected');
		return false;
	
	});
    
});
