// Opens the Provider Information Window from the Search Results Page
function ShowProviderInformation(url)
{
	window.open(url, null, "height=600,width=600,status=no,toolbar=no,menubar=no,location=no");
}

function ShowTermsConditions(url)
{
	window.open(url, null, "height=600,width=600,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes");
}

function OpenMailLink(address)
{
	window.open("mailto: " + address, null, "");
}

function Caption(captionTitle, captionText)
{
	return overlib(captionText, CAPTION, captionTitle, TEXTSIZE, '10pt', CAPTIONSIZE, '3');
} 

function FocusFormField(FieldName)
{
	var field_object = getFormElement(FieldName);
	field_object.focus();
}

function updateIFrame( myURL )
{
	document.getElementById("VerificationFrame").src = myURL;
}

function ScrollToSearchResults()
{
	var objLayer = document.getElementById("BeginResults");
	intPos = getTopCoordinate(objLayer)
	
	window.scrollTo(0, intPos);
}

/// <summary>
/// Retrieves the top coordinate of an object
/// </summary>
/// <param name="obj">The object whose coordinates are being sought</param>
/// <returns>An integer representing the Y position of the object</returns>
function getTopCoordinate(obj)
{
	var intYPos = obj.offsetTop;
	var objTemp = obj.offsetParent;

	while (objTemp != null) {
		intYPos += objTemp.offsetTop;
		objTemp = objTemp.offsetParent;
	}

	return(intYPos);
}

/// <summary>
/// Retrieves the left coordinate of an object
/// </summary>
/// <param name="obj">The object whose coordinates are being sought</param>
/// <returns>An integer representing the X position of the object</returns>
function getLeftCoordinate(obj)
{
	var intXPos = obj.offsetLeft;
	var objTemp = obj.offsetParent;
	
	while (objTemp != null) {
		intXPos += objTemp.offsetLeft;
		objTemp = objTemp.offsetParent;
	}

	return(intXPos);
}

function AddPhoneResults()
{
	var phonecounseling = getFormElement("PhoneCounseling");
	phonecounseling.checked = true;
  
	var button_search = getFormElement("BUTTON_Search");
	button_search.click();
}