﻿/*::::::::::::::::::::::::::::::::::::::::::::
Internal JS
Copyright © 2010 McMurry
::::::::::::::::::::::::::::::::::::::::::::*/

(function ($) {
	$(function () {
		// Marquee Links
		var a = $.url.segment(0);
		var b = $('#header a[href*=' + a + ']').attr('title');
		if (b != undefined && ($('body.find-a-physician').length == 0)) {
			$('#marquee').append('<div class="top-sitemap"><h2><span>' + b + ' Links</span></h2></div>');
			var c = $('#sidemenu ul > li a').not('#sidemenu ul li ul a');
			if (c.length > 0) {
				$('#marquee .top-sitemap').append('<ul></ul>');
				c.clone().appendTo('#marquee .top-sitemap ul');
				$('#marquee .top-sitemap ul a').wrap('<li />');
				var d = jQuery.url.attr('directory').split('/');
				var e = d[1] + '/' + d[2];
				if (d[2] != "") {
					$('#marquee .top-sitemap ul li a[href*=' + e + ']').parent('li').addClass('selected');
				}
			}
		}
		// Left Column Controls
		$('#main_sidebar').append('<div class="side-controls loading" />');
		$('#main_sidebar .side-controls').load('/ #content .column-right', function (responseText, textStatus, XMLHttpRequest) {
			if (textStatus == "success") {
				// Find a Physician
				$('#content .find-a-physician a.button').attr('href', 'javascript:void(0)').click(function () {
					var a = $('#content .find-a-physician select[id$=ddlPhysicianSpecialty]').val();
					if (a != 0) {
						window.location = '/Find-a-Physician/Default.aspx?specialty=' + a;
					}
				});
				// CTAs
				$('#content .ctas').cycle({ fx: 'fade', speed: '300', timeout: '5000', pause: 1 });
				// Popular Links
				$('#content .popular-links li').hover(function () {
					$(this).addClass('hover');
				}, function () {
					$(this).removeClass('hover');
				}).click(function () {
					window.location = $(this).find('a').attr('href');
				});
				// Remove Loading and Expand
				$('#main_sidebar .side-controls').animate({ paddingTop: '0' }, 'fast', function () { $(this).removeClass('loading'); });
				$('#main_sidebar .column-right').slideDown('fast');
			}
		});

		// Pager
		$(".pager a[disabled=disabled]").addClass("disabled");
		$(".pager .pager-command:last").addClass("pager-next");
		//show/hide job details
		$(".showlink").click(function (e) { $(this).parents(".listrow").children(".showhidepanel").slideToggle("fast"); });
		// Open Print Window
		$('#printForm').attr("target", "_blank");
	});
})(jQuery);

// Font Resizer
function fontResize(size) { var litContent = document.getElementById("litContent"); switch (size) { case "normal": litContent.style.fontSize = "1em"; break; case "medium": litContent.style.fontSize = "1.2em"; break; case "large": litContent.style.fontSize = "1.4em"; break; } }
// Print
function printpage() { document.getElementById("hdn_Title").value = document.title; document.getElementById("hdn_Content").value = document.getElementById("main_content").innerHTML; document.forms[1].submit(); }
// Bookmark
function bookmarkpage(bookmarkUrl) { var bookmarkTitle = document.title; if (window.sidebar) { window.sidebar.addPanel(bookmarkTitle, bookmarkUrl, ""); } else if (window.external) { window.external.AddFavorite(bookmarkUrl, bookmarkTitle); } else if (window.opera && window.print) { var elem = document.getElementById('menu_bookmark'); elem.setAttribute('href', bookmarkUrl); elem.setAttribute('title', bookmarkTitle); elem.setAttribute('rel', 'sidebar'); elem.click(); } }
// Textbox Char count
function CheckFieldLength(fn, rn, mc) { var len = fn.value.length; if (len > mc) { fn.value = fn.value.substring(0, mc); len = mc; } document.getElementById(rn).innerHTML = mc - len; }


$(document).ready(function () {
	$('p.phonedir_default').html('The following is a list of frequently requested telephone numbers. For patient names and room numbers, please contact the main switchboard for further assistance.');
});
