function swapImageOn(){
	this[0]=new Image(); this[0].src="/objects/images/nav/about_on.gif";
	this[1]=new Image(); this[1].src="/objects/images/nav/doctors_on.gif";
	this[2]=new Image(); this[2].src="/objects/images/nav/appointments_on.gif";
	this[3]=new Image(); this[3].src="/objects/images/nav/locations_on.gif";
	this[4]=new Image(); this[4].src="/objects/images/nav/orthopedicsfaq_on.gif";
	this[5]=new Image(); this[5].src="/objects/images/nav/events_on.gif";
}

function swapImageOff(){
	this[0]=new Image(); this[0].src="/objects/images/nav/about_off.gif";
	this[1]=new Image(); this[1].src="/objects/images/nav/doctors_off.gif";
	this[2]=new Image(); this[2].src="/objects/images/nav/appointments_off.gif";
	this[3]=new Image(); this[3].src="/objects/images/nav/locations_off.gif";
	this[4]=new Image(); this[4].src="/objects/images/nav/orthopedicsfaq_off.gif";
	this[5]=new Image(); this[5].src="/objects/images/nav/events_off.gif";
}

if (document.images) {
	var swapOn = new swapImageOn();
	var swapOff = new swapImageOff();
}  

function imageSwap(image, direction, index) {
	if (direction == 'on'){
		image.src = swapOn[index].src;
	} else {
		image.src = swapOff[index].src;
	}
}

function validateReferral(referral) {
    if (referral.length) {
		$('#patient_info').submit();
    } else {
		$('#errorReferral').html('Please enter referral information. How did you hear about us?');
		openDiv('errorReferral');
		return false;
    }
}

/* SHOWING AND HIDING
--------------------- */
function toggleDiv(divId) {
    $('#' + divId).slideToggle().delay(500);
}

function openDiv(divId) {
    $('#' + divId).slideDown(500);
}

function closeDiv(divId) {
    $('#' + divId).slideUp(500);
}

/* ANIMATED SCROLLING
--------------------- */
function scrollWindow(divId) {
	$j('html, body').animate({
		scrollTop: $('#' + divId).offset().top
	}, 500);
}

