jQuery(document).ready(function() {

  jQuery("#websites a").each(function() {

    jQuery(this).click(function() {
      window.open(this.href);
      return false;
    });
  });


  jQuery("#keyword-search").InputHelper();

  jQuery("form.keyword").submit(function() {

    window.location='/home.php?/Find_your_short_break/Search;search=' + jQuery("#keyword-search", this).val();
    return false;

  });


  jQuery(".increase-textsize").click(function() {
    var currentFontSize = jQuery('html').css('font-size');
    var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum*1.2;
    jQuery("html").css("font-size", newFontSize);
    return false;
  });

  jQuery(".decrease-textsize").click(function() {
    var currentFontSize = jQuery('html').css('font-size');
    var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum/1.2;
    jQuery("html").css("font-size", newFontSize);
    return false;
  });

  jQuery(".toggle-textonly").toggle(

    function() {

      jQuery("style").each(function() {
        jQuery(this).attr("disabled", "disabled");
        jQuery("body").prepend("<ul id=\"access-context\"><li><a href=\"#\" class=\"context-toggle-textonly\">Toggle Text-only</a></li></ul>");
         jQuery("a.context-toggle-textonly").click(function() {
         jQuery("style").each(function() {
            jQuery(this).attr("disabled", "");
          });

          jQuery("link[rel=stylesheet]").each(function() {
            jQuery(this).attr("disabled", "");
          });

          jQuery("#access-context").remove();

         });
      });

      jQuery("link[rel=stylesheet]").each(function() {
        jQuery(this).attr("disabled", "disabled");
      })

    },

    function() {

      jQuery("style").each(function() {
        jQuery(this).attr("disabled", "");
      });

      jQuery("link[rel=stylesheet]").each(function() {
        jQuery(this).attr("disabled", "");
      });

      }


  );


});
