﻿/*
*	Walton Regional Medical Center
*	Copyright © 2009, McMurry Inc.
*	http://www.mcmurry.com
*
*	Base Javascript
*/
$(function () {
	// Fix IE6 Flicker Bug
	try { document.execCommand('BackgroundImageCache', false, true); } catch (e) { }
	// 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");


	$('#header #search input').focus(function () {
		$(this).filter(function () {
			return $(this).val() == '' || $(this).val() == 'Search Walton Regional';
		}).val('').addClass('focus');
	}).blur(function () {
		$(this).filter(function () {
			return $(this).val() == '';
		}).val('Search Walton Regional').removeClass('focus');
	});
	// About Us
	$('#li_about_us .subnav ul').prependTo('#submenu-about .submenu');
	$('#submenu-about').replaceAll('#li_about_us .subnav');

	// Our Services
	$('#li_our_services .subnav ul').prependTo('#submenu-services .submenu');
	$('#submenu-services').replaceAll('#li_our_services .subnav');

	// Patients & Visitors
	$('#li_patient_visitors .subnav ul').prependTo('#submenu-patients .submenu');
	$('#submenu-patients').replaceAll('#li_patient_visitors .subnav');

	// Find a Physician
	$('#li_find_a_physician').append('<div class="subnav"></div>');
	$('#li_find_a_physician .subnav ul').prependTo('#submenu-physicians .submenu');
	$('#submenu-physicians').replaceAll('#li_find_a_physician .subnav');

	// News & Events
	$('#li_news_events .subnav ul').prependTo('#submenu-calendar .submenu');
	$('#submenu-calendar').replaceAll('#li_news_events .subnav');

	// Career Center
	$('#li_career_center .subnav ul').prependTo('#submenu-careers .submenu');
	$('#submenu-careers').replaceAll('#li_career_center .subnav');

	$('#menu ul li').hoverIntent(dPanel);
	$('#menu a').removeAttr('title');
	$('.about #li_about_us div, .services #li_our_services div, .patients #li_patient_visitors div, .physicians #li_find_a_physician div, .calendar #li_news_events div, .careers #li_career_center div').remove();
	$('a[title*="block"]').remove();
});
var dPanel = { interval: 100, sensitivity: 10, over: addPanel, timeout: 100, out: removePanel };
function addPanel() { $($(this).find('div.submenu-wrap')).fadeIn('fast'); $(this).addClass('hover'); }
function removePanel() { $($(this).find('div.submenu-wrap')).fadeOut('fast'); $(this).removeClass('hover'); }

// 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; }


$(window).bind("mousemove",function(){
	$('a[title*="block"]').remove();
});
