﻿$(document).ready(function() {
    $(".search_box_container .textbox").focus(function() {
        this.select();
        $(this).css("color", "#000000");
    });

    $(window).resize(Document_Resize);

    Document_Resize();

    //----- load font size from cookies -----
    var loadFontSize = LoadFontSize();
    $("body").css("font-size", loadFontSize + "px");

    $("#fontSm").click(function() {
        var fontSize = 14;
        $("body").css("font-size", fontSize + "px");
        SaveFontSize(fontSize);
    });

    $("#fontMd").click(function() {
        var fontSize = 18;
        $("body").css("font-size", fontSize + "px");
        SaveFontSize(fontSize);
    });
    $("#fontLg").click(function() {
        var fontSize = 22;
        $("body").css("font-size", fontSize + "px");
        SaveFontSize(fontSize);
    });
});

function SaveFontSize(fontSize) {
    $.cookie("YDFontSize", fontSize, { expires: 7, path: '/' });
}
function LoadFontSize()
{
	if (jQuery.cookie)
	{
		var fontSize = $.cookie("YDFontSize");
		if (fontSize != null && fontSize != "")
			return fontSize;
	}

	return 14;
}

function Document_Resize() {
    var document_height = $(document).height();
    var body_height = $("body").height();

    if (document_height > body_height) {
        var content = $("#content");

        content.height(content.height() + document_height - body_height);
    }
}
