﻿// Initialize Cufon
Cufon('#content .title')
	 ('#content .subtitle')
	 ('#siteTitle div')
	 ('.sectionTitle')
	 ('#intro h1')
	 ('.article h2')
	 ('.article h3')
	 ('ul.sectionList h3 a', { hover: true })
	 ('ul.articleList h2', { hover: true })
	 ('ul.articleList h3', { hover: true })
	 ('#allTopics h2')
	 ('#footer ul.nyINorge li')
	 ('#relatedContent h2')
	 ('#postit h3');

$(document).ready(function() {

	// Default input field values
	$('#searchArea input[title!=""]').hint();
	$('#tipAFriend input[title!=""]').hint();

	// Class control on searchresults
	$('body.searchResults #searchArea #search').blur(function () {
		// On blur, add class
		$(this).addClass('blur');
	}).focus(function () {
		// On focus, remove class
		$(this).removeClass('blur');
	}).blur();

	// Scroll to top
	$('#toTop a').click(function(){
		$('html, body').animate({
			scrollTop: $($(this).attr("href"))
			.offset().top }, 500);
		return false;
	});

	// Control wether to use overlay or _blank window
	$('#screenReaderHelper').click(function(){
		if($.cookie('overlay') !== 'disabled') {
			// Disable overlay
			$.cookie('overlay','disabled');
		} else {
			// Use overlay
			$.cookie('overlay','null');
		}
		location.reload(true);
	});

	// Check if overlay is disabled
	if($.cookie('overlay') == 'disabled') {
	    // Show stepswrapper content
	    $(".stepswrapper").show();
	    $("a.overlay").removeAttr("href").css("color", "#000").css("font-size", "1.3em");
	    $("#relatedContent .box.steps .inner").css("background-image", "none");
	} else {
	    // Hide all stepswrapper containers
	    $(".stepswrapper").hide();
	}

});
