$(document).ready( function() {
var currentPage = location.href;
	
	$('ul.primaryNav a').each(function(i, v) {						 
		if (v == currentPage) {
			$(v).css('color', '#eeeeee', 'backgroundColor', '#333').addClass('current');
		}
	});


// Changes the sitesearch input value for the Google Search Appliance

hospSearch = "http://www.uihealthcare.com";
centerSearch = "http://www.uihealthcare.com/depts/uiheartcare";

$('#headerContent form').bind("click dblclick select change", function() {
	if ($('input#heartCenter').attr("checked")) {
		$('input[name="sitesearch"]').val(centerSearch);
	}
	else if($('input#hospital').attr("checked")) {
		$('input[name="sitesearch"]').val(hospSearch);
	}
});


/*	
//Contact Us form
$(document).ready( function() {
	var html = "Mail has been sent.";
	$('li.contact').html('<span class="emailus">Contact Us</span> \
			<div id="dialog" title="Contact Us"> \
			<p>We welcome your questions and comments about UI Heart and Vascular Center and the services we offer. We ask that you reserve questions about your specific condition for your appointment with us, as this e-mail connection is not meant for handling patient-specific health information.</p> \
				<address> \
					University of Iowa Hospitals and Clinics<br /> \
					UI Heart and Vascular Center<br /> \
					200 Hawkins Drive<br /> \
					Iowa City, IA 52242<br /> \
					319-356-2777 \
				</address> \
				<form method="post" action="" id="feedback"> \
					<fieldset> \
						<label for="Name">Name</label> \
						<input class="text" type="text" name="Name" id="Name" /> \
						<label for="From">Email (required)</label> \
						<input class="text" type="text" name="From" id="From" /> \
						<label for="comments">Questions or comments</label> \
						<textarea name="comments" cols="45" rows="8" id="comments"></textarea> \
					</fieldset> \
					<fieldset> \
						<input name="URL" type="hidden" value="' + location.href + '" /> \
						<input type="hidden" name="Subject" value="UI Heart and Vascular Center Question" /> \
						<input type="hidden" name="ID" value="X9KBk1Zj" /> \
				</fieldset> \
				</form> \
				<div id="results"></div> \
			</div>');
	$('#dialog').hide();
	$(".emailus").click(function() {	
		$("#dialog").dialog({
			autoResize: false,
			closeOnEscape: true,
			height: 565,
			width: 400,
			modal: true,
			buttons: {
				'Send Your Message': function() {
					$("#results").html("<p>Sending...</p>");
					$.ajax({
						timeout: "2000",
						type: "GET",
						url: "/cgi-bin/mailproxy",
						data: $("#feedback").serialize(),
						success: function(data, textStatus) {
							if(data == "") { 
								$("#results").html("<p>Your message has been sent.</p>");
							}
							else {
								$("#results").html("<p>" + data + "</p>");
							}
						},
						error: function () {
							$("#results").html("<p>Sending failed.</p>");
						}
					});
				}
			},
			close: function() {
				$(this).dialog('destroy');
			}
		});
	});
	});
*/
});
