//IE Suckerfish
startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("topLevelNav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
}
window.onload=startList;

	//Controls Scroll Function
	function toTop(id){
	document.getElementById(id).scrollTop=0
	}

	defaultStep=1
	step=defaultStep
	function scrollDivDown(id){
	document.getElementById(id).scrollTop+=step
	timerDown=setTimeout("scrollDivDown('"+id+"')",10)
	}

	function scrollDivUp(id){
	document.getElementById(id).scrollTop-=step
	timerUp=setTimeout("scrollDivUp('"+id+"')",10)
	}

	function toBottom(id){
	document.getElementById(id).scrollTop=document.getElementById(id).scrollHeight
	}

	function toPoint(id){
	document.getElementById(id).scrollTop=100
	}

$(document).ready(function() {
	
	//$('body').css('background-color', '#FFF');
	//$('ul.slideConditions').hide();
	
	$('#scrollUp').hover(function() {
		$('#scrollUp img').css('background-color', '#7B3536');
			}, function() {
		$('#scrollUp img').css('background-color', 'transparent');
	});
	$('#scrollDown').hover(function() {
		$('#scrollDown img').css('background-color', '#7B3536');
			}, function() {
		$('#scrollDown img').css('background-color', 'transparent');
	});

	//Hover Function for Hours
	$("#hoursHover").click(function() {
		$("#hours").fadeIn('slow')
	});
		$("#hours").mouseout(function() {
			$("#hours").fadeOut('slow')
		});
		$("#locationHover").click(function() {
			$("#hours").hide()
		});

	/*Hover Function for Location
	$("#locationHover").click(function() {
		$("#location").fadeIn('slow')
	});
		$("#location").mouseout(function() {
			$("#location").fadeOut('slow')
		});
		$("#hoursHover").click(function() {
			$("#location").hide()
		});*/

	//Hover Function for Background Color of Div
	$("#hoursHover").click(function() {
		$("#hoursLocation").css('background-color', '#400705')
	});

	//$("#locationHover").click(function() {
	//	$("#hoursLocation").css('background-color', '#400705')
	//});

	//Hover Function for Changing "Appointment" Background-Image
	$("#locationHover").hover(function() {
		$(this).css('background-position', '0 -8px');
	}, function() {
		$(this).css('background-position', '0 0');
	});
	$("#hoursHover").hover(function() {
		$(this).css('background-position', '0 -8px');
	}, function() {
		$(this).css('background-position', '0 0');
	});
	$("#appointmentHover").hover(function() {
		$(this).css('background-position', '0 -10px');
	}, function() {
		$(this).css('background-position', '0 0');
	});
	$("#paperwork").hover(function() {
		$(this).css('background-position', '0 -10px');
	}, function() {
		$(this).css('background-position', '0 0');
	});

	
	//Change BG
	//$("#eyeExam").click(function(){
	//	$("#contentArea").addClass('examBG');
	//});
	//	$("#eyeExam").click(function(){
	//		$("#contentArea").removeClass('lensBG');
	//	});
	//$("#lensExam").click(function(){
	//	$("#contentArea").addClass('lensBG');
	//});
	//	$("#lensExam").click(function(){
	//		$("#contentArea").removeClass('examBG');
	//	});
	//$("#LASIK").click(function(){
	//	$("#contentArea").addClass('lensBG');
	//});
	//	$("#LASIK").click(function(){
	//		$("#contentArea").removeClass('examBG');
	//	});
	//$("#links").click(	function(){
	//	$("#contentArea").removeClass('conditionBG');
	//});
	//$("#eyeConditions").click(function(){
	//	$("#contentArea").addClass('conditionBG');
	//});
	//$("#faqs").click(function(){
	//	$("#contentArea").addClass('conditionBG');
	//});
	
	//
	//$("#specialtyLens").click(function(){
	//	$("#contentArea").addClass('specialtyBG').removeClass('contactLensBG');
	//});
	//$("#contactLens").click(function(){
	//	$("#contentArea").addClass('contactLensBG').removeClass('specialtyBG');
	//});
	//$("#fashionLens").click(function(){
	//	$("#contentArea").removeClass('specialtyBG');
	//	$("#contentArea").removeClass('contactLensBG');
	//});
	
	
	//$("#retinalCamera").click(function(){
	//	$("#contentArea").removeClass('lab');
	//});
	//$("#smartcentration").click(function(){
	//	$("#contentArea").removeClass('lab');
	//});
	//$("#lab").click(function(){
	//	$("#contentArea").addClass('lab');
	//});
	////
	
	
	//Toggle Functions
	$(".slideConditions").hide();
	$(".slideFAQ").hide();
	$("#eyeConditions").click(function(){
		$(".slideConditions").toggle();
	});
	$("#faqs").click(function(){
		$(".slideFAQ").toggle();
	});
	$(".faqButton").click(function() {
		$("#faqs").toggleClass('hover');
	});
	
	$(".conditionButton").click(function() {
		$("#eyeConditions").toggleClass('hover');
	});
	
	$(".formButton").click(function() {
		$("form").toggle();
	});
	
	$("#back").click(function() {
		$("form").toggle();
	});
	
	//End Toggle Functions


	//Server Requests for Doctor Page
	$("#barreto").click(barreto);
	$("#boersma").click(boersma);
	$("#anita").click(anita);
	
	//Server Requests for Facilities Page
	//$("#retinalCamera").click(retinalCamera);
	//$("#smartcentration").click(smartcentration);
	//$("#lab").click(lab);
	
	//Server Requests for Services Page
	$("#eyeExam").click(eyeExam);
	$("#lensExam").click(lensExam);
	$("#LASIK").click(LASIK);
	
	//Server Requests for Product Page
	$("#fashionLens").click(fashionLens);
	$("#specialtyLens").click(specialtyLens);
	$("#contactLens").click(contactLens);
	
	//Server Requests for Resources Page
	$("#links").click(links);
	$("#eyeConditions").click(eyeConditions);
	//$("#commonConditions").click(commonConditions);
	//$("#eyeDiseases").click(eyeDiseases);
	//$("#preventiveCare").click(preventiveCare);
	$("#faqs").click(faqs);
	//$("#appointments").click(appointments);
	//$("#insurance").click(insurance);
	
});			
			
$(function(){
	var $scroll = $('#scroll');
		$scroll.jScrollPane({scrollbarOnLeft:true, animateTo:true});
		$('a.scroll-to-element-demo').bind(
			'click',
			function()
			{
				var targetElementSelectorString = $(this).attr('rel');
				$scroll[0].scrollTo(targetElementSelectorString);
				return false;
			}
		);
});

function doctors () {
	$("#profileContent").load("profile/profileDoctors.html");
}
function facilities () {
	$("#profileContent").load("profile/profileFacilities.html");
}
function services () {
	$("#profileContent").load("profile/profileServices.html");
}
function products () {
	$("#profileContent").load("profile/profileProducts.html");
}
function giving () {
	$("#profileContent").load("profile/profileGiving.html");
}
function barreto () {
	$("#contentRight").load("doctors/barreto.html");
}
function boersma () {
	$("#contentRight").load("doctors/boersma.html");
}
function anita () {
	$("#contentRight").load("doctors/anita.html");
}
function retinalCamera () {
	$("#contentRight").load("facilities/retinalCamera.html");
}
function smartcentration () {
	$("#contentRight").load("facilities/smartcentration.html");
}
function lab () {
	$("#contentRight").load("facilities/lab.html");
}
function eyeExam () {
	$("#contentRight").load("services/eyeExam.html");
}
function lensExam () {
	$("#contentRight").load("services/lensExam.html");
}
function LASIK () {
	$("#contentRight").load("services/LASIK.html");
}
function links () {
	$("#contentRight").load("resources/links.html");
}
function eyeConditions () {
	$("#contentRight").load("resources/eyeConditions.html");
}
function commonConditions () {
	$("#contentRight").load("resources/commonConditions.html");
}
function eyeDiseases () {
	$("#contentRight").load("resources/eyeDiseases.html");
}
function preventiveCare () {
	$("#contentRight").load("resources/preventiveCare.html");
}
function faqs () {
	$("#contentRight").load("resources/faqs.html");
}
function appointments () {
	$("#contentRight").load("resources/appointments.html");
}
function insurance () {
	$("#contentRight").load("resources/insurance.html");
}
function fashionLens () {
	$("#contentRight").load("product/fashionLens.html");
}
function specialtyLens () {
	$("#contentRight").load("product/specialtyLens.html");
}
function contactLens () {
	$("#contentRight").load("product/contactLens.html");
}