function showSearchBox()
{
	var t=document.getElementById("search_properties_table");
	var b=document.getElementById("show_hide_button");
	if(t.className=="search_properties_table_visible")
	{
		//hide the table
		t.className="search_properties_table_hidden";
		b.value="Refine Search Parameters";
	}
	else
	{
		//show the table
		t.className="search_properties_table_visible";
		b.value="Hide Search Parameters";
	}
}

function showAdvanced()
{
	var t=document.getElementById("search_advanced_div");
	var b=document.getElementById("search_advanced_button");
	if(t.style.visibility=="visible")
	{
		t.style.visibility="hidden";
		t.style.display="none";
		b.value="Show Advanced Options";
	}
	else
	{
		t.style.visibility="visible";
		t.style.display="block";
		b.value="Hide Advanced Options";
	}
}

function changeSearchSort()
{
	var f=document.getElementById("search_properties_form");
	f.sd.value=(parseInt(f.sd.value)+1)%2;
	f.submit(); 
}

var bp=null;

function theBigPicture(e,img)
{
	var x;
	var y;
	var width=300;
	var height=225;

	if(!bp)
	{
		bp=createPicturePopup(e,width,height);
		var popImg=document.createElement("img");
		popImg.src=img.src;
		bp.appendChild(popImg);
	}

	if (window.event)
	{
		x=window.event.clientX+document.documentElement.scrollLeft;
		y=window.event.clientY+document.documentElement.scrollTop;
	}
	else
	{
		if(e)
		{
			x=e.pageX;
			y=e.pageY;
		}
		else
		{
			x=0;
			y=0;
		}
	}
	x+=20;
	y+=20;
	x=Math.min(x,document.documentElement.clientWidth+document.documentElement.scrollLeft-width-20);
	y=Math.min(y,document.documentElement.clientHeight+document.documentElement.scrollTop-height-20);
	bp.style.top=Math.max(0,y)+"px";
	bp.style.left=Math.max(0,x)+"px";
}

function killBigPicture()
{
	if(bp)
	{
		document.body.removeChild(bp);
		bp=null;
	}
}
