// JavaScript Document
function getPhysicians( action ) {
	var nextAction = action;
	var specCheckBoxes = document.getElementsByName( "specialtyID" );
	var specList = "";
	
	for ( var i = 0; i < specCheckBoxes.length; i++ ) {
		if ( specCheckBoxes[i].checked ) {
			specList += specCheckBoxes[i].value + ",";
		}
	}
	
	if ( specList.length == 0 ) {
		alert( "You must select at least one specialty." );
		return;
	}
	else {
		specList = specList.substr( 0, specList.length - 1 );
	}
	
	var argumentString = "&nextAction=" + nextAction;
	argumentString += "&practiceHGID=" + document.getElementById( "practiceHGID" ).value;
	argumentString += "&officeID=" + document.getElementById( "officeID" ).value;
	argumentString += "&specList=" + specList;
	argumentString += "&boardCert=" + ( ( document.getElementById( "boardCertified" ).checked ) ? "C" : "" );
	argumentString += "&gender=" + document.getElementById( "gender" ).value;
	argumentString += "&discipline=" + document.getElementById( "discipline" ).value;
	argumentString += "&yearsSinceGrad=" + document.getElementById( "yearsSinceGrad" ).value;
	argumentString += "&boardCert=" + document.getElementById( "awards" ).value;
	argumentString += "&nocache=" + Math.floor( Math.random() * 1000001 );
	
	ajaxFactory( voidObject, "availablePhysicians", "/directory_search/404/group-directory/ajax/ajax_group_phys_results.cfm?action=getPhysicians" + argumentString, "POST", true, getPhysiciansComplete() );
}

function getPhysiciansComplete() {
	document.getElementById( "availablePhysicians" ).style.display = "block";
}

function getFullReport( action ) {
	var physCheckBoxes = document.getElementsByName( "HGID" );
	var hgidList = "";
	
	for ( var i = 0; i < physCheckBoxes.length; i++ ) {
		if ( physCheckBoxes[i].checked ) {
			hgidList += physCheckBoxes[i].value + ",";
		}
	}
	
	if ( hgidList.length == 0 ) {
		alert( "You must select at least one physician." );
		return;
	}
	else {
		hgidList = hgidList.substr( 0, hgidList.length - 1 );
	}
	
	var argumentString = "&hgidList=" + hgidList;
	argumentString += "&nocache=" + Math.floor( Math.random() * 1000001 );
	
	ajaxFactory( voidObject, "physicianResults", "/directory_search/404/group-directory/ajax/ajax_group_phys_results.cfm?action=" + action + argumentString, "POST", true, getGetFullReportComplete() );
}

function getGetFullReportComplete() {
	document.getElementById( "physicianResults" ).style.display = "block";
}