﻿// Collapsing List =============================================

var CollapsingList = {
	Init: function() {
		$(".cont-collapsing li h3").click(function() {
			$(this).parent().hasClass("open") ? $(this).parent().removeClass("open") : $(this).parent().addClass("open");
			if ($.browser.msie && $.browser.version <= 6) $('#page').css('height', 'auto').css('height', $('#page').height() + 'px');
		});

		//hover class for ie6
		$(".cont-collapsing li h3").hover(function() { $(this).addClass('hover'); }, function() { $(this).removeClass('hover'); });
	}
}

// Back to Top Link =================================================

var InsertBackToTopLink = {
	Init: function() {
		var htmlCode =	'<!-- Back to top -->'+
						'<p class="back-to-top">'+
						'<a class="arrow-link" href="#page">Back to top</a>'+
						'</p>'+
						'<!-- / Back to top -->';
		var documentHeight = $(document).height() - 100;
		var windowHeight = window.innerHeight;
		if (documentHeight > windowHeight) {
			$("#col-two").append(htmlCode);
		}
	}}

// Initialise methods onto Frontend Object ================================================================================
var Frontend = {
	CollapsingList: CollapsingList,
	InsertBackToTopLink: InsertBackToTopLink
};