/* ------------------------------------------
SMOOTH LOCAL SCROLL
------------------------------------------ */

$(function() {
	$.localScroll();
	
	$("#tools").append("<p>Text size<a href=\"javascript:changeFontSize('-')\" title=\"Decrease text size\" class=\"minus\"><img src=\"/download/text_minus.gif\" alt=\"Decrease text size\" /></a><a href=\"javascript:changeFontSize('+')\" title=\"Increase text size\" class=\"plus\"><img src=\"/download/text_plus.gif\" alt=\"Increase text size\" /></a></p>");
	
	// Print page link
	$("#tools").append("<a href=\"javascript:void(0);\" onclick=\"window.print()\" class=\"print\">Print page</a>");
});


/* ------------------------------------------
FAQ EXPAND/CONTRACT
------------------------------------------ */

/*
$(document).ready(function(){
	
	$('div.c_FAQAnswer').hide();
	var allOpen = false;
	
	$('.showAllLink').click( function(){
		
		$('div.c_FAQAnswer').slideDown('fast');
		allOpen = true;
		return false;
	})
	
	$('.hideAllLink').click( function(){
		
		$('div.c_FAQAnswer').slideUp('fast');
	    allOpen = false;
		return false;
	})
	
	
	$("#c_FAQList h3").click( function(){
			
		
		if(allOpen == true && $(this).next('div.c_FAQAnswer').is(':visible') || allOpen == false && $(this).next('div.c_FAQAnswer').is(':visible')){
	
			$(this).next('div.c_FAQAnswer').slideUp('fast');
	
		}else if(allOpen == true && !$(this).next('div.c_FAQAnswer').is(':visible') || allOpen == false && !$(this).next('div.c_FAQAnswer').is(':visible')){
		
			$(this).next('div.c_FAQAnswer').slideDown('fast');
			
		}	
		
	});


});
*/

	$(document).ready(function(){
	//alert("correct js");


	$('div.c_FAQAnswer').hide();
	
	$('.showAllLink').click( function(){
		$(this).parent('p').parent('.section').children('div.c_FAQAnswer').slideDown('fast');
		return false;
	})
	
	$('.hideAllLink').click( function(){
		$(this).parent('p').parent('.section').children('div.c_FAQAnswer').slideUp('fast');
		return false;
	})


	$('a').not('.hideAllLink, .showAllLink').click( function(){
		
		if ($(this).parent('h3').next('.c_FAQAnswer').is(":hidden")) {
			$(this).parent('h3').next('.c_FAQAnswer').slideDown('fast');
		} else {
			
			$(this).parent('h3').next('.c_FAQAnswer').slideUp('fast');
		}
		
		
	});

        //$('div#search form').attr({
	      //  method: 'post',
        //	action: 'http://www.ocr.org.uk/search/index.asp'
        //});

        //$('a[href$=".aspx"]').each(function(){                 
         //   $(this).attr('href', $(this).attr('href').replace('.aspx', '.html'));            
        //});

});	
	

/* ------------------------------------------
CONTENT SHOW/HIDE FOR ASSESSORS/HERITAGE
------------------------------------------ */
	$(document).ready(function(){
	//alert("correct js");


	$('div.c_ShowContent,div.c_subShowContent').hide();
	
	$('.showAllLink').click( function(){
		$(this).parent('p').parent('.section').children('div.c_ShowContent,div.c_subShowContent').slideDown('fast');
		return false;
	})
	
	$('.hideAllLink').click( function(){
		$(this).parent('p').parent('.section').children('div.c_ShowContent,div.c_subShowContent').slideUp('fast');
		return false;
	})


	$('a').not('.hideAllLink, .showAllLink').click( function(){
		
		if ($(this).parent('h3,h4').next('div.c_ShowContent,div.c_subShowContent').is(":hidden")) {
			$(this).parent('h3,h4').next('div.c_ShowContent,div.c_subShowContent').slideDown('fast');
		} else {
			
			$(this).parent('h3,h4').next('div.c_ShowContent,div.c_subShowContent').slideUp('fast');
		}
		
		
	});
	
});
	
	/* ------------------------------------------
CONTENT SHOW/HIDE FOR FLAT PAGES
------------------------------------------ */

$(document).ready(function(){
	$("h2.triggerList,h3.triggerList").siblings().hide();
	$("h2.triggerList,h3.triggerList").parent("span").siblings().hide();
	$("h2.triggerList,h3.triggerList").click(function(){
		$(this).toggleClass("activeList").siblings().slideToggle("fast");
		$(this).toggleClass("activeList").parent("span").siblings().slideToggle("fast");
		return false;
	});
});

	/* ------------------------------------------
CONTENT SHOW/HIDE FOR ALL DOCS
------------------------------------------ */

$(document).ready(function(){
	$("h3.docsTriggerList").next().hide();
	$("h3.docsTriggerList").click(function(){
		$(this).toggleClass("active").next().slideToggle("fast");
		return false;
	});
});

	/* ------------------------------------------
CONTENT SHOW/HIDE FOR QUAL TYPE
------------------------------------------ */
	
$(document).ready(function(){
	$(".c_ShowQuals,.c_ShowInfo").hide();
	$("h2.trigger,h3.trigger,h4.trigger").click(function(){
		$(this).toggleClass("active").next().slideToggle("fast");
		return false;
	});

	var linkHtml = '<span class="change">[<a href="index.html" title="Display by qualification type">Display by qualification type</a>]</span>';
	$('h2.mainSub:first').append(linkHtml);

	$('h2.mainSub a').click(function(){
		if ($(this).text() === "Display by subject") {
			$(this).text("Display by qualification type");
			$(this).attr('title', "Display by qualification type");
			$(this).closest('h2').find('span.heading').text("SUBJECTS");
		} else if ($(this).text() === "Display by qualification type") {
			$(this).text("Display by subject");
			$(this).attr('title', "Display by subject");
			$(this).closest('h2').find('span.heading').text("QUALIFICATION TYPE");
		}
		$('div.qualContent').toggle();
		return false;
	});
});

