/*
Preload images script
*/

jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}

$.preloadImages("../images/apta.png", 
"../images/Trmts/Headneck2.jpg",
"../images/Trmts/LowerBa2.jpg",
"../images/Trmts/Shoulder3.jpg",
"../images/Trmts/Elbow2.jpg",
"../images/Trmts/Wrist2.jpg",
"../images/Trmts/Hip2.jpg",
"../images/Trmts/Knee3.jpg",
"../images/Trmts/Footankle2.jpg",
"../images/Barrington/marahhmcON.jpg",
"../images/Barrington/LindasummON.jpg",
"../images/Barrington/SteveMigON.jpg",
"../images/Barrington/LisannelaON.jpg",
"../images/Barrington/CatherineGreshON.jpg",
"../images/Cumberland/KarenSulliON.jpg",
"../images/Cumberland/Tom_AlmeidON.jpg",
"../images/Cumberland/DianeGuenardON.jpg",
"../images/Barrington/SteveMigON.jpg",
"../images/therapist1_on.jpg",
"../images/EastGreen/TammyRuggON.jpg",
"../images/EastGreen/AndreaGON.jpg",
"../images/EastGreen/AnneShoenerON.jpg",
"../images/EastGreen/therapist2_on.jpg",
"../images/EastGreen/therapist1_on.jpg",
"../images/Narragansett/MArioSantoON.jpg",
"../images/Narragansett/shawnbreON.jpg",
"../images/Ped/LisaHouON.jpg",
"../images/Narragansett/DEBsON.jpg",
"../images/Narragansett/therapist1_on.jpg",
"../images/NP/BriansmitON.jpg",
"../images/NP/JoshPerrON.jpg",
"../images/NP/LaurenjubinON.jpg",
"../images/NP/NicolchapON.jpg",
"../images/NP/RossLabosON.jpg",
"../images/Ped/JoanneMaraON.jpg",
"../images/Ped/LisaHouON.jpg",
"../images/Ped/JoanhON.jpg",
"../images/Ped/sherridemarcoON.jpg",
"../images/therapist1_on.jpg",
"../images/btn_appointment.png", 
"../images/btn_appointment_on.png", 
"../images/lepre_background.png", 
"../images/btn_next.png", 
"../images/lepre_logo.png", 
"../images/GeorTH.png", 
"../images/GeorON.png", 
"../images/Steve_Lepre09TH.png", 
"../images/Steve_Lepre09ON.png", 
"../images/btn_next_on.png");
 
/* jQuery hide/show for photo slide on home page*/
$(document).ready(function() {
	
	$('#nav_photos_slide_back').hide();
	$('#item2').hide();

	$('a#slick-next').click(function () {
		$('#item2').show();	
		$('#wrapper').scrollTo($(this).attr('href'), 800);	
		$('#nav_photos_slide_back').show();
		$('#nav_photos_slide_next').hide();
		return false;
	});
	
	$('a#slick-back').click(function () {
		$('#wrapper').scrollTo($(this).attr('href'), 800);	
		$('#item1').show();	
		$('#nav_photos_slide_back').hide();
		$('#nav_photos_slide_next').show();
		return false;
	});
	
});


//jQuery - show/hide text field when "other" selected in "Source"
$(document).ready(function() {
	$('#source_text').hide();
	
	  $('#Source').change(function() {
	    if( $(this).val() == 'Other' ){  
			$('#source_text').show();
			$('#OtherSource').focus();
		return false;
		}
		else{
			$('#source_text').hide();
		return false;
		}	
	  });
		return false;
});

//jQuery - jScrollPane for scroll bar	//if scroll bars not working, remove reinitialiseOnImageLoad!!
	$(function()
	{
		$('#right_column_text').jScrollPane({dragMaxHeight:10, scrollbarWidth:10, scrollbarMargin:10});	
		return false;
	});
	
	$(function()
	{
		$('#wide_column_text').jScrollPane({dragMaxHeight:10, scrollbarWidth:10, scrollbarMargin:5});	
		return false;
	});
	
	$(function()
	{
		$('#about_therapists_text').jScrollPane({dragMaxHeight:10, scrollbarWidth:10, scrollbarMargin:5});	
		return false;
	});
	
	$(function()
	{
		$('#about_officers_text').jScrollPane({dragMaxHeight:10, scrollbarWidth:10, scrollbarMargin:5});	
		return false;
	});
	
	$(function()
	{
		$('#about_treatments').jScrollPane({dragMaxHeight:10, scrollbarWidth:10, scrollbarMargin:0, reinitialiseOnImageLoad:true});	
		return false;
	});
	
	
	$(function()
	{
		$('#barr_team_bios').jScrollPane({dragMaxHeight:10, scrollbarWidth:10, scrollbarMargin:0});	
//		$("div[id^='team_bios']").jScrollPane({dragMaxHeight:10, scrollbarWidth:10, scrollbarMargin:0, reinitialiseOnImageLoad:true});	
		return false;
	});
	
	$(function()
	{
		$('#cumb_team_bios').jScrollPane({dragMaxHeight:10, scrollbarWidth:10, scrollbarMargin:0});	
		return false;
	});
	
	$(function()
	{
		$('#eg_team_bios').jScrollPane({dragMaxHeight:10, scrollbarWidth:10, scrollbarMargin:0});	
		return false;
	});
	
	$(function()
	{
		$('#ng_team_bios').jScrollPane({dragMaxHeight:10, scrollbarWidth:10, scrollbarMargin:0});	
		return false;
	});
	
	$(function()
	{
		$('#np_team_bios').jScrollPane({dragMaxHeight:10, scrollbarWidth:10, scrollbarMargin:0});	
		return false;
	});
	
	
//hide/show administrator info
$(document).ready(function() {

$('#ceo').hide();
$('#coo').hide();
$('#clear').show();

$("a[id^='officer']").click(function () { 

	$('#intro').hide();

	var adminclass = $(this).attr('class');
	var newclass = adminclass + ' selected';
	
	$("a.selected").removeClass("selected");
	
    $(this).addClass(newclass);
 
	$('.rmv_admin').hide();
	
	var adm = $(this).attr('href');
	$(adm).show();

	return false;
});

});

//hide/show therapists info
$(document).ready(function() {

$("div[id^='city']").hide();
$('#clear').show();

$("a[id^='loc']").click(function () { 

	$('#intro').hide();

	var therpclass = $(this).attr('class');
	var newclass = therpclass + ' selected';
	
	$("a.selected").removeClass("selected");
	
    $(this).addClass(newclass);
 
	$('.rmv').hide();
	
	var therp = $(this).attr('href');
	$(therp).show();

	return false;
});

});

//hide/show treatment & services info
$(document).ready(function() {

$("div[id^='treatment']").hide();
$('#clear').show();

$("a[id^='tmts']").click(function () { 

	var treatclass = $(this).attr('class');
	var newclass = treatclass + ' selected';
	
	$("a.selected").removeClass("selected");
	
    $(this).addClass(newclass);
 
	$('.rmv_treat').hide();
	
	var tmt = $(this).attr('href');
	$(tmt).show();

	return false;
});
		return false;

});

//hide/show locations info

$(document).ready(function() {

$("div[id^='city']").hide();
$("div[id^='therp']").hide();
$("div[id$='clear']").show();


$("a[id^='pl']").click(function () { 
	
	$('.rmv').hide();
	var get_place = $(this).attr('href');
	var place = get_place.substring(1);
	var map = '#gmap_' + place;

		$(get_place).show();
		$("li.selected").removeClass("selected");
		$(map).addClass('selected');

	return false;
});

$("a[id^='tm']").click(function () { 

	var therpclass = $(this).attr('class');
	var newclass = therpclass + ' selected';
	
	$("a.selected").removeClass("selected");
	
    $(this).addClass(newclass);
 
	$('.mv').hide();
	
	var therp = $(this).attr('href');
	$(therp).show();

	return false;
});

});

