function ihcShowMap(url) 
{
    var ihcMapWindow = window.open(url, "mapWin","width=675,height=525,bgcolor=#ffffff,resizable=yes,scrollbars=yes,top=5,left=5,border=0");
    ihcMapWindow.focus();
}

function showPopup(url, width, height)
{
	var popupWindow = window.open(url, "providerWin", "width="+width+",height="+ height+",resizable=yes,scrollbars=yes,top=5,left=5,border=0");
	popupWindow.focus();
}

function triggerSearch(selectId)
{
	$('#resultsPerPage').attr("value", $("#"+selectId).attr("value"));
	$("form").submit();
}

function isNotEmpty(prop)
{
	if(prop !== null && prop !== "")
	{
		return true;	
	}
	return false;
}

function appendCriteria(propValue, name, str)
{
	if(isNotEmpty(propValue))
	{
		if(isNotEmpty(str))
		{
			return " and " + name;
		}
		else
		{
			return name;
		}
	}
	return "";
}

function submitStats(brand)
{
	try
  	{
		s.pageName="Provider Search Results";
		s.prop9 = $('#specialty :selected').text();
		s.prop16 = brand;
		
		s.prop6 = ""; 
		
		if(isNotEmpty(s.prop9))
		{
			s.prop6 = "Specialty";
		}
		
		s.prop6 += appendCriteria($("#lastName").attr("value"), "Last Name", s.prop6);
		s.prop6 += appendCriteria($("#firstName").attr("value"), "First Name", s.prop6);
		s.prop6 += appendCriteria($("#hospitalAffiliation :selected").text(), "Hospital Affiliation", s.prop6);
		s.prop6 += appendCriteria($("#city").attr("value"), "City", s.prop6);
		s.prop6 += appendCriteria($("#zipCode").attr("value"), "Zip Code", s.prop6);
		s.prop6 += appendCriteria($("#county").attr("value"), "County", s.prop6);
		s.prop6 += appendCriteria($("#language :selected").text(), "Languages", s.prop6);
		s.prop6 += appendCriteria($("#clinicAffiliation :selected").text(), "Clinic Affiliation", s.prop6);
		
		if($("#maleGender").attr("checked") || $("#femaleGender").attr("checked"))
		{
			s.prop6 += appendCriteria("Gender", "Gender", s.prop6);
		}
		
		if($("#acceptingNewPatients").attr("checked"))
		{
			s.prop6 += appendCriteria("Accepting New Patients", "Accepting New Patients", s.prop6);
		}
		
		if( $("#hoursWeekdayEarly").attr("checked") || $("#hoursWeekdayLate").attr("checked") || $("#hoursWeekend").attr("checked") )
		{
			s.prop6 += appendCriteria("Extended Office Hours", "Extended Office Hours", s.prop6);
		}
		
		if( $("#showOnlyImgProviders").attr("checked") )
		{
			s.prop6 += appendCriteria("Show Only Img Providers", "Show Only Img Providers", s.prop6);
		}
		
		if( $("#showOnlyMyHealthProviders").attr("checked") )
		{
			s.prop6 += appendCriteria("Show Only MyHealth Providers", "Show Only MyHealth Providers", s.prop6);
		}
		
    	s.t();
  	}
  	catch(e){ }
}

// Slider related 
function convertToDistance(sliderValue)
{
	switch (sliderValue) 
	{
	  	case 0:
			return 0;
	  	case 20:
			return 5;
	  	case 40:
			return 10;
	  	case 60:
			return 25;
	  	case 80:
			return 50;
	  	case 100:
			return 100;
	 	default:
			return 0;
	}
}
function convertToSliderValue(distance)
{
	switch (distance) 
	{
	  	case 5:
			return 20;
	  	case 10:
		 	return	40;
	  	case 25:
			return 60;
	  	case 50:
			return 80;
	  	case 100:
			return 100;
		default:
			return 0;	
	}
}




