﻿/**
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne <brian@cherne.net>
*/
(function($) { $.fn.hoverIntent = function(f, g) { var cfg = { sensitivity: 7, interval: 100, timeout: 0 }; cfg = $.extend(cfg, g ? { over: f, out: g} : f); var cX, cY, pX, pY; var track = function(ev) { cX = ev.pageX; cY = ev.pageY; }; var compare = function(ev, ob) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); if ((Math.abs(pX - cX) + Math.abs(pY - cY)) < cfg.sensitivity) { $(ob).unbind("mousemove", track); ob.hoverIntent_s = 1; return cfg.over.apply(ob, [ev]); } else { pX = cX; pY = cY; ob.hoverIntent_t = setTimeout(function() { compare(ev, ob); }, cfg.interval); } }; var delay = function(ev, ob) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); ob.hoverIntent_s = 0; return cfg.out.apply(ob, [ev]); }; var handleHover = function(e) { var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget; while (p && p != this) { try { p = p.parentNode; } catch (e) { p = this; } } if (p == this) { return false; } var ev = jQuery.extend({}, e); var ob = this; if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); } if (e.type == "mouseover") { pX = ev.pageX; pY = ev.pageY; $(ob).bind("mousemove", track); if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout(function() { compare(ev, ob); }, cfg.interval); } } else { $(ob).unbind("mousemove", track); if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout(function() { delay(ev, ob); }, cfg.timeout); } } }; return this.mouseover(handleHover).mouseout(handleHover); }; })(jQuery);

$(document).ready(function() {
    /*
    $(".topnav").hoverIntent(function() {
    $(this).find(".SubNav").fadeIn(200);
    }, function() {
    $(this).find(".SubNav").fadeOut(200);
    });
    */

    var COOKIE_NAME = 'FONTSIZE';
    var options = { path: '/', expires: 10 };
    var size = ($.cookie(COOKIE_NAME)) ? $.cookie(COOKIE_NAME) : 14;
    $('html').css('font-size', size);

    // Reset Font Size
    var originalFontSize = $('html').css('font-size');
    // Increase Font Size
    $("#increaseButton").click(function() {
        var currentFontSize = $('html').css('font-size');
        var currentFontSizeNum = parseFloat(currentFontSize, 10);
        var newFontSize = currentFontSizeNum * 1.2;
        newFontSize = (newFontSize > 14) ? 15 : newFontSize;
        $('html').css('font-size', newFontSize);
//        var currentBoxFontSize = $('.box').css('font-size');
//        var newBoxFontSize = parseFloat(currentBoxFontSize, 10) * 1.2;
//        newBoxFontSize = (newBoxFontSize > 14) ? 15 : newBoxFontSize;
        $('.box').css('font-size', newFontSize);
        $.cookie(COOKIE_NAME, newFontSize, options);
        return false;
    });
    // Decrease Font Size
    $("#decreaseButton").click(function() {
        var currentFontSize = $('html').css('font-size');
        var currentFontSizeNum = parseFloat(currentFontSize, 10);
        var newFontSize = currentFontSizeNum * 0.8;
        newFontSize = (newFontSize < 9) ? 9 : newFontSize;
        $('html').css('font-size', newFontSize);
//        var currentBoxFontSize = $('.box').css('font-size');
//        var newBoxFontSize = parseFloat(currentBoxFontSize, 10) * 0.8;
//        newBoxFontSize = (newBoxFontSize > 9) ? 9 : newBoxFontSize;
        $('.box').css('font-size', newFontSize);
        $.cookie(COOKIE_NAME, newFontSize, options);
        return false;
    });

    Shadowbox.init({
        players: ["iframe", "img"]
    });

    $('#bookmarkButton').bookmark({ popup: true, sites:
        ['delicious', 'digg', 'linkedin', 'stumbleupon']
    });

    $(".handbook").click(function() {
        Shadowbox.open({
        content: '<div class="options"><div>Choose a handbook to download:<ul><li><a href="/PDF/MPC_PAC_Member_Handbook_Complete_2011.PDF" target="_blank">PAC Member Handbook</a></li><li><a href="/PDF/MPC_Member_Handbook_HC_English_Complete_20110217.pdf" target="_blank">HealthChoice Member Handbook (English)</a></li><li><a href="/PDF/MPC_Member_Handbook_HC_Spanish_Complete_20110217.pdf" target="_blank">HealthChoice Member Handbook (Espa&ntilde;ol)</a></li></ul></div></div>',
            player: 'html',
            title: 'Download',
            width: 350,
            height: 150
        });
        return false;
    });
    
    $(".babybook").click(function() {
        Shadowbox.open({
        content: '<div class="options"><div>Choose a download:<ul><li><a href="/PDF/MPC_Baby_Book_with_Compliance_Number_English_20100824.pdf" target="_blank">Baby Book (English)</a></li><li><a href="/PDF/MPC_Baby_Book_with_Compliance_Number_Spanish_20100824.pdf" target="_blank">Baby Book (Spanish)</a></li></ul></div></div>',
            player: 'html',
            title: 'Baby Book',
            width: 350,
            height: 150
        });
        return false;
    });

});

var languages = ["English", "Arabic", "Bosnian", "Farsi", "Russian", "Spanish", "Vietnamese"];

