//gloabal variables
//var _REQUEST_FORM_URL = 'http://tsdeviis.tuhis.temple.edu/tuhs_generic_applications/Online_Appointment_Request_email.aspx';
//var _WEBSITE_URL = 'http://tuh.tuhs.prv';
var _REQUEST_FORM_URL = 'https://www.templehealth.org/appointments/Online_Appointment_Request_email.aspx';
var _WEBSITE_URL = 'http://ortho.templehealth.org';



function getQueryParam(strParam)
{
	var strURL = window.location.toString();
	var strQuery = '';
	var strSearchTerm = '';

	if (strURL.indexOf('?') > 0)
	{
		//grab all of the querysting info
		var strQuery = strURL.substring(strURL.indexOf('?'));

		if (strQuery.indexOf(strParam + '=') > 0)
		{

			//Kill anything before the term we need
			strQuery = strQuery.substring(strQuery.indexOf(strParam + '='))
			strQuery = strQuery.substring(strQuery.indexOf('=') + 1)

			//Kill anything after our search term
			if (strQuery.indexOf('&') > 0){strQuery = strQuery.substring(0, strQuery.indexOf('&'));}

			//Replace any URL spaces (%20)
			while (strQuery.indexOf('%20') > 0 )
			{
				strQuery = strQuery.replace('%20', ' ');
			}

			strSearchTerm = strQuery
		}
	}

	return strSearchTerm;
}

function getSPTemplateHeader()
{
	var strURL = window.location.toString();
	var strReturn = "";
	
	if (strURL.indexOf('/content/bariatric_') > 0)
	{
		strReturn = "<img title=\"Bariatric Surgery\" height=\"136\" src=\"/content/Upload/AssetMgmt/images/bariatric_landing.jpg\" width=\"643\" border=\"0\" />";
	}
	else if (strURL.indexOf('/content/heart_') > 0)
	{
		strReturn = "<img title=\"Heart Center\" height=\"136\" src=\"/content/Upload/AssetMgmt/images/heart_landing.jpg\" width=\"643\" border=\"0\" />"
	}
	else if (strURL.indexOf('/content/orthopaedic_') > 0)
	{
		strReturn = "<img title=\"Orthopaedic Center\" height=\"136\" src=\"/content/Upload/AssetMgmt/images/ortho_landing.jpg\" width=\"643\" border=\"0\" />"
	}
	else if (strURL.indexOf('/content/spine_') > 0)
	{
		strReturn = "<img title=\"Spine Center\" height=\"136\" src=\"/content/Upload/AssetMgmt/images/spine_landing.jpg\" width=\"643\" border=\"0\" />"
	}
	else
	{
		strReturn = "<img title=\"Jeanes Hospital\" height=\"136\" src=\"/content/Upload/AssetMgmt/images/noimage_landing.jpg\" width=\"643\" border=\"0\" />"
	}
	document.write(strReturn);
}

function getSPTemplateFeature()
{
	var strURL = window.location.toString();
	var strPage = ""
	var strReturn = "";
	
	
	
	if (strURL.indexOf('/content/bariatric_') > 0)
	{
		strPage = "/content/BFeatureBox1.htm";
		strReturn = "<div id=\"featArt1\"><iframe scrolling=\"no\" width=\"181\" frameborder=\"0\" height=\"300\" marginheight=\"0\" marginwidth=\"0\" src=\"" + strPage + "\"></iframe></div>";
		strPage = "/content/BFeatureBox2.htm";
		strReturn = strReturn + "<div id=\"featArt2\"><iframe scrolling=\"no\" width=\"181\" frameborder=\"0\" height=\"300\" marginheight=\"0\" marginwidth=\"0\" src=\"" + strPage + "\"></iframe></div>";
	}
	else if (strURL.indexOf('/content/heart_') > 0)
	{
		strPage = "/content/HFeatureBox1.htm";
		strReturn = "<div id=\"featArt1\"><iframe scrolling=\"no\" width=\"181\" frameborder=\"0\" height=\"300\" marginheight=\"0\" marginwidth=\"0\" src=\"" + strPage + "\"></iframe></div>";
		strPage = "/content/HFeatureBox2.htm";
		strReturn = strReturn + "<div id=\"featArt2\"><iframe scrolling=\"no\" width=\"181\" frameborder=\"0\" height=\"300\" marginheight=\"0\" marginwidth=\"0\" src=\"" + strPage + "\"></iframe></div>";
	}
	else if (strURL.indexOf('/content/orthopaedic_') > 0)
	{
		strPage = "/content/OFeatureBox1.htm";
		strReturn = "<div id=\"featArt1\"><iframe scrolling=\"no\" width=\"181\" frameborder=\"0\" height=\"300\" marginheight=\"0\" marginwidth=\"0\" src=\"" + strPage + "\"></iframe></div>";
		strPage = "/content/OFeatureBox2.htm";
		strReturn = strReturn + "<div id=\"featArt2\"><iframe scrolling=\"no\" width=\"181\" frameborder=\"0\" height=\"300\" marginheight=\"0\" marginwidth=\"0\" src=\"" + strPage + "\"></iframe></div>";
	}
	else if (strURL.indexOf('/content/spine_') > 0)
	{
		strPage = "/content/SFeatureBox1.htm";
		strReturn = "<div id=\"featArt1\"><iframe scrolling=\"no\" width=\"181\" frameborder=\"0\" height=\"300\" marginheight=\"0\" marginwidth=\"0\" src=\"" + strPage + "\"></iframe></div>";
		strPage = "/content/SFeatureBox2.htm";
		strReturn = strReturn + "<div id=\"featArt2\"><iframe scrolling=\"no\" width=\"181\" frameborder=\"0\" height=\"300\" marginheight=\"0\" marginwidth=\"0\" src=\"" + strPage + "\"></iframe></div>";
	}
	else
	{
		strPage = "/content/BFeatureBox1.htm";
		strReturn = "<div id=\"featArt1\"><iframe scrolling=\"no\" width=\"181\" frameborder=\"0\" height=\"300\" marginheight=\"0\" marginwidth=\"0\" src=\"" + strPage + "\"></iframe></div>";
		strPage = "/content/BFeatureBox2.htm";
		strReturn = strReturn + "<div id=\"featArt2\"><iframe scrolling=\"no\" width=\"181\" frameborder=\"0\" height=\"300\" marginheight=\"0\" marginwidth=\"0\" src=\"" + strPage + "\"></iframe></div>";
	}
	
	document.write(strReturn);
}

function getAppointmentLink(strLinkTxt)
{
	var strURL = window.location.toString();
	var strPage = ""
	var strReturn = "";
	
	
	
	if (strURL.indexOf('/content/bariatric_') > 0)
	{
		strReturn = "<a href=\"/content/bariatric_appointment.htm\">" + strLinkTxt + "</a>";
	}
	else if (strURL.indexOf('/content/heart_') > 0)
	{
		strReturn = "<a href=\"/content/heart_appointment.htm\">" + strLinkTxt + "</a>";
	}
	else if (strURL.indexOf('/content/orthopaedic_') > 0)
	{
		strReturn = "<a href=\"/content/orthopaedic_appointment.htm\">" + strLinkTxt + "</a>";
	}
	else if (strURL.indexOf('/content/spine_') > 0)
	{
		strReturn = "<a href=\"/content/spine_appointment.htm\">" + strLinkTxt + "</a>";
	}
	else
	{
		strReturn = "<a href=\"/content/appointment.htm\">" + strLinkTxt + "</a>";
	}
	
	document.write(strReturn);
}