/* javascript.js */

/*	
	©2012 West Lethbridge Family Chiropractic
	www.westlethbridgechiropractic.ca
	
	Web Design by:
	Brad Hussey / Brightside Studios / January 2012
	www.bradhussey.ca
*/

$(function() {

	$('#appointment-time-elliott').hide();
	
	$('input:radio').change(function() {
		
		if ($('#doc-amy').is(':checked')) {
			$('#appointment-time-amy').show();
			$('#appointment-time-elliott').hide();
		} else if ($('#doc-elliott').is(':checked')) {
			$('#appointment-time-amy').hide();
			$('#appointment-time-elliott').show();
		}
		
    });



	//To switch directions up/down and left/right just place a "-" in front of the top/left attribute
	//Vertical Sliding
	$('.boxgrid.slidedown').hover(function(){
		$(".cover", this).stop().animate({top:'-260px'},{queue:false,duration:300});
	}, function() {
		$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:300});
	});
	//Horizontal Sliding
	$('.boxgrid.slideright').hover(function(){
		$(".cover", this).stop().animate({left:'325px'},{queue:false,duration:300});
	}, function() {
		$(".cover", this).stop().animate({left:'0px'},{queue:false,duration:300});
	});
	//Diagnal Sliding
	$('.boxgrid.thecombo').hover(function(){
		$(".cover", this).stop().animate({top:'260px', left:'325px'},{queue:false,duration:300});
	}, function() {
		$(".cover", this).stop().animate({top:'0px', left:'0px'},{queue:false,duration:300});
	});
	//Partial Sliding (Only show some of background)
	$('.boxgrid.peek').hover(function(){
		$(".cover", this).stop().animate({top:'90px'},{queue:false,duration:160});
	}, function() {
		$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:160});
	});
	//Full Caption Sliding (Hidden to Visible)
	$('.boxgrid.captionfull').hover(function(){
		$(".cover", this).stop().animate({top:'160px'},{queue:false,duration:160});
	}, function() {
		$(".cover", this).stop().animate({top:'260px'},{queue:false,duration:160});
	});
	//Caption Sliding (Partially Hidden to Visible)
	$('.boxgrid.caption').hover(function(){
		$(".cover", this).stop().animate({top:'100px'},{queue:false,duration:160});
	}, function() {
		$(".cover", this).stop().animate({top:'160px'},{queue:false,duration:160});
	});
	
	$('#article1').hide();
	$('.show1').click(function() {
		$('#article1').toggle(1500);
		$('.show1').toggle();
	});
	
	$('#article2').hide();
	$('.show2').click(function() {
		$('#article2').toggle(1500);
		$('.show2').toggle();
	});
	
	$('#article3').hide();
	$('.show3').click(function() {
		$('#article3').toggle(1500);
		$('.show3').toggle();
	});
	
	$('#article4').hide();
	$('.show4').click(function() {
		$('#article4').toggle(1500);
		$('.show4').toggle();
	});
	
	$('#article5').hide();
	$('.show5').click(function() {
		$('#article5').toggle(1500);
		$('.show5').toggle();
	});
	
	$('.show1a').click(function() {
		$('#article1').toggle(1500);
		$('.show1').toggle();
	});
	
	$('a.new-window').click(function(){
        window.open(this.href);
        return false;
    });
	
	sfHover = function() {
		var sfEls = document.getElementById("navbar").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
	if (window.attachEvent) window.attachEvent("onload", sfHover);	

});
