// JavaScript Document
jQuery(document).ready(function($) {
	//Search Box
	$('#s').focusin(function(){
		var sv = $('#s').attr('value'); 
		if( sv == 'Search' ){ 
			$(this).attr('value', '');
		}
	});
	$('#s').focusout(function(){
		var sv = $('#s').attr('value'); 
		if( !sv ){ 
			$(this).attr('value', 'Search');
		}
	});
	
	$("#CharityGiftBox").css('cursor', 'pointer').hover(function(){
			var title = $(this).find('a').attr('title');
			$(this).attr('title', title);
			$(this).addClass('hover');
	},function(){
			$(this).removeClass('hover');														 
	}).click(function(){
		var target = $(this).find('a').attr('target');
		if( target ){
			window.open( $(this).find('a').attr('href') );
		}else{
			window.location = $(this).find('a').attr('href');
		}
	});
	
	function AddFAQlinks(element){
		if( $(element).length ){
			var titles = new Array();
			$(element).each(function (i) {
				titles[i] = '<li><a href="#Q'+i+'">'+$(this).html()+'</a></li>';
				$(this).attr('id', 'Q'+i).prepend('<a class="faq" href="#Top">Back to Top</a>');	
			});
			$(element+':eq(0)').before('<ol id="FAQlist">'+titles.join(' ')+'</ol>');
		}
	}
	AddFAQlinks('.faq h3');
});
