
jQuery(function() {
    jQuery('p.actions')
        .find('a.print')
            .click(function() {
                beforePrint();
                window.print();
                afterPrint();
                return false;
            })
            .end()
        .find('a.fontDn, a.fontUp')
            .click(function() {
                wrapper = jQuery(this).parents('#wrapSec');
                wrapper = wrapper[wrapper.length - 1];
                if ( typeof wrapper.font_change_set == 'undefined' ) {
                    wrapper.font_change_set = 100;//91.67;
                    //approx sized based on css
                    jQuery(wrapper).css('font-size', wrapper.font_change_set+'%');
                }
                var sizeDifference = 10;
                if ( jQuery(this).hasClass('fontDn') ) {
                    sizeDifference *= -1;
                }
                wrapper.font_change_set += sizeDifference;
                jQuery(wrapper).css('font-size', wrapper.font_change_set+'%');
                return false;
            })
            .end();
    jQuery('input[name=item_added_to_cart]')
        .each(function() {
            $notification = jQuery('<div id="notification">Item added to cart.</div>');
            $notification
                .append('<br /><a href="/view-cart">View Cart</a>')
                .css({
                    position: 'absolute',
                    padding: '0.3em',
                    width: 200,
                    top: 5,
                    left: '50%',
                    marginLeft: -100,
                    background: '#000',
                    color: '#fff',
                    textAlign: 'center',
                    'border-radius': 10,
                    '-webkit-border-radius': 10,
                    '-moz-border-radius': 10,
                    fontSize: '2em',
                    opacity: 0.9,
                    lineHeight: 1.4
                    //border: '1px solid #ffefae'
                })
                .hide()
                .find('a').css({
                    color: '#FCB034',
                    textDecoration: 'underline'
                });
            jQuery('body').append($notification);
            window.setTimeout(function() {$notification.fadeIn('slow')}, 1000);
            window.setTimeout(function() {$notification.fadeOut(3000)}, 6000);
        });
});


jQuery(function(){
    if(jQuery.browser.msie && jQuery.browser.version=="6.0"){
        jQuery("input.submitButton[type=submit], #trainingCalendar .list2 .add input.ir, #events .list2 .add input.ir[type=submit], #event-dates input.ir[type=submit], #courses input.ir[type=submit], .addToCart input[type=submit]").hover(
            function(){
            //over state
            jQuery(this).css('backgroundPosition', '0 -26px');
        }, function() {
            //off state
            jQuery(this).css('backgroundPosition', '0 0');
        });
    }
});



//share this seems to overload the body.onclick(). I'm sure this is
//for a valid reason (click off of ST box), but it appears to mess
//with the default behaviour of IE/Chrome/Saf, resulting in the
//spinner/loading actions from working as expected. It then looks
//like the page has finished loading, even though you are on the
//same page and the URL is still loading.
//What we'll do in its place is rob ST of its readyList, do that
//ourself after we've set up all the links, and then restore the
//body.onclick to default...
var _stReadyList = [];
function overrideStReadyList() {
    while (SHARETHIS.readyList.length>0) {
       _stReadyList.push(SHARETHIS.readyList.pop());
    }
    //apply st's actions...
    for (i in _stReadyList) {
        _stReadyList[i].apply(document,[SHARETHIS]);
    }
    document.body.onclick = null;
}

(function($){
    //sharethis does not work under https- remove links in this case
    if("https:" == document.location.protocol){
        jQuery(function() {
            $('.share').remove();
        });
    }
    else{
        if (!(jQuery.browser.msie && jQuery.browser.version=="6.0")) {
            document.write('<script type="text/javascript" src="http://w.sharethis.com/button/sharethis.js#publisher=b86d1fc3-6d3d-49aa-bd10-e5df1cdf6d1f&type=website&onmouseover=false&tracking=google"></script>');
        }
        $(function() {
            var $shares = $('.share');
            if(jQuery.browser.msie && jQuery.browser.version=="6.0"){
                $shares.remove();
                return;
            }
            if ($shares.length > 0) {
                $shares.each(function() {
                    $this = $(this);
                    $this.parent('p').addClass('has_sharethis');
                    var title = '(no title)';
                    $titleEl = $this.parent().parent().find('h2');
                    if ($titleEl.length>0) {
                        title = $titleEl.text();
                    }
                    else {
                        title = $('title').text();
                    }
                    $this
                        .data('_shareObject', SHARETHIS.addEntry({
                            'title': title
                        }, {
                            'button': false
                        }))
                        .data('_shareObject').attachButton($(this).get(0));
                    $this.attr('href','javascript:void(0);');
                });
                overrideStReadyList();
            }
        });
	}
})(jQuery);



//#13445
(function($){
    $(function() {
        if (false) {
            if($("#username").attr('value') == ''){
                $("#username").toggleVal({ populateFrom: "custom", text: "Email" });
            }
            return;
        }
        var emailHelperText = 'Email';
        var passwordHelperText = 'Password';
        $('#username').focus(function() {
            $(this)
              .removeClass('tv-changed')
              .removeClass('tv-helper')
              .addClass('tv-focused')
              ;
            if ($(this).val() == emailHelperText) {
                $(this).val('');
            }
        }).blur(function() {
            $(this)
              .removeClass('tv-focused')
              .removeClass('tv-changed')
              ;
            if ($(this).val() == '') {
                $(this).val(emailHelperText);
                $(this).addClass('tv-helper');
            }
            else {
                $(this).addClass('tv-changed');
            }
        });
        if ($('#username').val() == '') {
            $('#username').addClass('tv-helper').val(emailHelperText);
        }
        $('#password').focus(function() {
            $(this)
              .removeClass('tv-changed')
              .removeClass('tv-helper')
              .addClass('tv-focused')
              ;
            if ($(this).val() == passwordHelperText) {
                $(this).val('');
            }
        }).blur(function() {
            $(this)
              .removeClass('tv-focused')
              .removeClass('tv-changed')
              ;
            if ($(this).val() == '') {
                //$(this).val(passwordHelperText);
                $(this).addClass('tv-helper');
            }
            else {
                $(this).addClass('tv-changed');
            }
        });
        if ($('#password').val() == '') {
            //$('#password').addClass('tv-helper').val(passwordHelperText);
            $('#password').addClass('tv-helper');
        }
    });
})(jQuery);







