function slideSwitch() {
    var $active = $('#slideshow img.active');
   if ( $active.length == 0 ) $active = $('#slideshow img:last');
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow img:first');
    var $sibs  = $active.siblings();
    var rndNum = Math.floor(Math.random() * $sibs.length );
    var $next  = $( $sibs[ rndNum ] );
	$active.addClass('last-active');
	$next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}
$(function() {
    setInterval( "slideSwitch()", 5000 );
});
jQuery(function(){
			jQuery('ul.sf-menu').superfish({ 
            delay:       1000,                            // one second delay on mouseout 
            animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation 
            speed:       'fast',                          // faster animation speed 
            disableHI:     false,
			autoArrows:  true,                           // disable generation of arrow mark-up 
            dropShadows: true                            // disable drop shadows 
        }); 
			jQuery('ul.sf-menu li:last').css('border','solid 0px #fff');
			$("a").each(function() {
			var title = $(this).text();
		    $(this).attr('title', title);
   		 });
			$("img").each(function() {
			var title = $(this).attr('alt');
			if(title ==''){
				 $(this).attr('alt', 'BC Guide Dog Services & Alberta Guide Dog Services');
				 $(this).attr('title', 'BC Guide Dog Services & Alberta Guide Dog Services');
				}
			 else{
				 $(this).attr('title', title);
				 }
		  //  $(this).attr('title', title); 
   		 });
		});
jQuery.fn.shortkeys = jQuery.fn.keys = function (obj, settings) {		
	var el = this;
	this.settings = jQuery.extend({
			split: "+",
			moreKeys: {}			
		}, settings || {});	
	this.wackyKeys = { '.': 190, ',': 188, ';': 59,	'Space': 32	};	
	this.formElements  = new Array("input", "select", "textarea", "button");
	this.keys = new Array();	
	this.onFormElement = false;
	this.keysDown = new Array();
	this.init = function (obj) {
		for(x in this.wackyKeys) {
			this.wackyKeys[x.toUpperCase()] = this.wackyKeys[x];
		}
		for(x in obj) {
			this.keys.push(x.split(this.settings.split));
		}
		for(i in this.keys) {
			var quickArr = new Array();
			for(j in this.keys[i]) {
				quickArr.push(this.convertToNumbers(this.keys[i][j].toUpperCase()));
			}
			quickArr.sort();
			this.keys[i] = quickArr;
		}
	};	
	this.convertToNumbers = function (inp) {
		if (this.wackyKeys[inp] != undefined) {
			return this.wackyKeys[inp];
		}
		return inp.toUpperCase().charCodeAt(0);
	};	
	this.keyAdd = function(keyCode) {
		this.keysDown.push(keyCode);
		this.keysDown.sort();
	};
	this.keyRemove = function (keyCode) {
		for(i in this.keysDown) {
			if(this.keysDown[i] == keyCode) {
				this.keysDown.splice(i,1);
			}
		};	
		this.keysDown.sort();	
	};		
	this.keyTest = function (i) {
		if (this.keys[i].length != this.keysDown.length) return false;
		for(j in this.keys[i]) {
			if(this.keys[i][j] != this.keysDown[j]) {
				return false;
			}
		}	
		return true;
	};
	this.keyRemoveAll = function () {
		this.keysDown = new Array();	
	};
	this.focused = function (bool) {
		this.onFormElement = bool;
	}	
	$(document).keydown(function(e) {
		el.keyAdd(e.keyCode);
		var i = 0;
		for(x in obj) {
			if(el.keyTest(i) && !el.onFormElement) {
				obj[x]();
				return false;
				break;	
			}			
			i++;
		};	
	});	
	$(document).keyup(function (e) {
		el.keyRemove(e.keyCode);
	});	
	for(x in this.formElements) {
		$(this.formElements[x]).focus( function () {
			el.focused(true);
		});
		$(this.formElements[x]).blur( function () {
			el.focused(false);
		});
	}	
	$(document).focus( function () {
		el.keyRemoveAll();
	});
	
	this.init(obj);
	jQuery.extend(this.wackyKeys, this.settings.moreKeys);

	return this;
}
$(document).ready(function() {
    $("img").each(function (i) {
	var imgSrc = $(this).attr("src");
	var x = $("img[src$='donate_paw.png']");
	 if(imgSrc == x.attr("src")){
		 $(this).addClass('donateButton');
		 }
	});
 jQuery("#up").fontscale("#content p, #content span, #content a, #content td, #content li, #content h2, #content h3, #content h4","up",{unit:"px",increment:1});
 jQuery("#down").fontscale("#content p, #content span, #content a, #content li, #content td, #content h2, #content h3, #content h4","down",{unit:"px",increment:1});
 jQuery("#reset").fontscale("#content p, #content span, #content a, #content li, #content h2, #content td, #content h3, #content h4","reset");
 jQuery('#up, #down').click(function() {
  jQuery("#content p, #content span, #content a, #content li, #content h2, #content h3, #content h4, #content td").addClass('lineNormal');
  jQuery.cookie('line', 'default');
});
  jQuery('#reset').click(function() {
  jQuery("#content p, #content span, #content a, #content li, #content h2, #content h3, #content td, #content h4").removeClass('lineNormal');
  jQuery.cookie('line', 'cssDefault');
});
    var line = jQuery.cookie('line');
    if (line == 'default') {
        jQuery("#content p, #content span, #content a, #content li, #content h2, #content h3, #content td, #content h4").addClass('lineNormal');
    };

});

