sfHover = function() {
	var sfEls = document.getElementById("nav").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 checkBox(o_whichBox) {
	if (o_whichBox.checked == true) {
		o_whichBox.parentNode.style.backgroundColor = '#ffa';
	}
	else {
		o_whichBox.parentNode.style.backgroundColor = '#fff';
	}
}

openWins = new Array();
curWin = 0;

function doPopUpFull(theURL, theWidth, theHeight, windowName ) {
	openWins[curWin] = window.open(theURL, windowName,
		'toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,' 
		+ 'width=' + theWidth + ',height=' + theHeight );

	openWins[curWin++].focus();
}
function doProfilePopup(s_name,i_type) {
	var i_width = 600;
	var i_height = 400;
	if (1==i_type) {
		i_width = 640;
		i_height = 810;
	} else if (2==i_type) {
		i_width = 620;
		i_height = 420;
	} else if (4==i_type) {
		i_width = 550;
		i_height = 700;
	} else if (8==i_type) {
		i_width = 280;
		i_height = 690;
	}
	
	doPopUpFull('/fivestar/blank/displayProfile.jsp?img='+s_name+'&type='+i_type,i_width,i_height,'profile');
}

function submitHomeFind(o_form) {
	var proTypeSelected = false;
	var msaSelected = false;
	var proTypIds = o_form.proTypeId;
//	for (var i=0;i<proTypIds.length;i++) {
//		var proTypeIdTest = proTypIds[i];
//		if (proTypeIdTest.checked == true ) {
//			proTypeSelected = true;
//			break;
//		}
//	}
	for (var j=1;j<o_form.msaId.options.length;j++) {
		var msaTest = o_form.msaId.options[j];
		if (msaTest.selected == true) {
			msaSelected = true;
			break;
		}
	}
	for (var j=1;j<o_form.proTypeId.options.length;j++) {
		var proTypeTest = o_form.proTypeId.options[j];
		if (proTypeTest.selected == true) {
			proTypeSelected = true;
			break;
		}
	}
	if (!proTypeSelected || !msaSelected) {
		alert('Please select a professional type and a metro area to search for.');
		return false;
	}
	return true;
}

$(document).ready(function() {
	$(".tooltip").tooltip();
	$("iframe").contents().find("a").attr("target", "_blank");
});