// JavaScript Document

/*
* Add events to buttons for mouseover and mouse out effects.
*/

//Execute on page load.
$(function(){ 
	//Toggle buttons to their on state when mouseing over these buttons.
	$("a.jqButton").mouseover(		
		function(){
			$(this).children().switchBtnOn();
		}
	);
	//Toggle buttons to their off state when mousing out of these buttons.
	$("a.jqButton").mouseout(		
		function(){
			$(this).children().switchBtnOff();
		}
	);
	//Toggle buttons to their on state when focussed.
	$("a.jqButton").focus(		
		function(){
			$(this).children().switchBtnOn();
		}
	);
	//Toggle buttons to their off state when blurred.
	$("a.jqButton").blur(		
		function(){
			$(this).children().switchBtnOff();
		}
	);
	
	//Toggle buttons to their on state when mouseing over these buttons.
	$("input.jqButton").mouseover(		
		function(){
			$(this).switchBtnOn();
		}
	);
	//Toggle buttons to their off state when mousing out of these buttons.
	$("input.jqButton").mouseout(		
		function(){
			$(this).switchBtnOff();
		}
	);
	//Toggle buttons to their on state when mouseing over these buttons.
	$("input.jqButton").focus(		
		function(){
			$(this).switchBtnOn();
		}
	);
	//Toggle buttons to their off state when mousing out of these buttons.
	$("input.jqButton").blur(		
		function(){
			$(this).switchBtnOff();
		}
	);
	
	//dynamically switch button image from the on state to the off state.
	jQuery.fn.switchBtnOff = function() {
		curSrc = $(this).attr('src');
		newSrc = curSrc.replace("_on", "_off");
		//alert(newSrc);
		$(this).attr('src',newSrc);
	};
	
	//dynamically switch button image from the off state to the on state.
	jQuery.fn.switchBtnOn = function() {
		curSrc = $(this).attr('src');
		newSrc = curSrc.replace("_off", "_on");
		//alert(newSrc);
		$(this).attr('src',newSrc);
	};
	
});

function reloadBtn()
{
		//Toggle buttons to their on state when mouseing over these buttons.
	$("a.jqButton").mouseover(		
		function(){
			$(this).children().switchBtnOn();
		}
	);
	//Toggle buttons to their off state when mousing out of these buttons.
	$("a.jqButton").mouseout(		
		function(){
			$(this).children().switchBtnOff();
		}
	);
	//Toggle buttons to their on state when focussed.
	$("a.jqButton").focus(		
		function(){
			$(this).children().switchBtnOn();
		}
	);
	//Toggle buttons to their off state when blurred.
	$("a.jqButton").blur(		
		function(){
			$(this).children().switchBtnOff();
		}
	);
	
	//Toggle buttons to their on state when mouseing over these buttons.
	$("input.jqButton").mouseover(		
		function(){
			$(this).switchBtnOn();
		}
	);
}

