// Code for CSS Tab Menu
sfHover = function() {
	var sfEls = document.getElementById("tabs").getElementsByTagName("li");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

function popitup(url, width, height) {
	var left = (screen.width/2)-(width/2);
	var top = (screen.height/2)-(height/2);
	
	newwindow=window.open(url,'Castlebeck','height='+height+',width='+width+',top='+top+',left='+left);
	if (window.focus) {newwindow.focus()}
	return false;
}

function togglePriceFields(elem)
{
	if(elem.value == 2) {
		// disable and hide the min price field
		document.getElementById('min').disabled=true;
		document.getElementById('min').style.display='none';
		// disable and hide the max price field
		document.getElementById('max').disabled=true;
		document.getElementById('max').style.display='none';
		
		// enable and show the min price pcm field
		document.getElementById('min_pcm').disabled=false;
		document.getElementById('min_pcm').style.display='inline';
		// enable and show the max price pcm field
		document.getElementById('max_pcm').disabled=false;
		document.getElementById('max_pcm').style.display='inline';
	} else {
		// disable and hide the min price pcm field
		document.getElementById('min_pcm').disabled=true;
		document.getElementById('min_pcm').style.display='none';
		// disable and hide the max price pcm field
		document.getElementById('max_pcm').disabled=true;
		document.getElementById('max_pcm').style.display='none';
		
		// enable and show the min price field
		document.getElementById('min').disabled=false;
		document.getElementById('min').style.display='inline';
		// enable and show the max price field
		document.getElementById('max').disabled=false;
		document.getElementById('max').style.display='inline';
	}
}