﻿//for our JS flash reduction
$('html').addClass('js');

//Global
$(document).ready(function() {
    
    $('html').removeClass('js');


    //always scroll to top 
    //(Done to disable jquery tabs behavior, but this will break all anchor links.  Probably need to make conditional.)

    //window.scrollTo(0, 0);

    $('.back_to_top').click(function() {
        window.scrollTo(0, 0);
        return false;
    });

    //product video flash player
    $('#product-video').flash({
        src: '/content/flash/flvPlayer.swf',
        width: 254,
        height: 218,
        quality: "High",
        base: "/content/flash/",
        flashvars: { flvName: '/content/video/' + $('#product-video').attr("name") + '.flv', text2Display: 'Click here to listen to Pat\'s comments!' }
    });

    $('.live_chat_activa').click(function() {
    //old
        
        _alc.startChat(11315);
        e.preventDefault();
        return false;
    });

    $('.live_chat').click(function() {
        
        popup_url = "https://server.iad.liveperson.net/hc/38070259/?cmd=file&file=visitorWantsToChat&site=38070259&referrer=" + escape(document.location);
        window.open(popup_url, 'chat38070259', 'width=475,height=400,resizable=yes');
        
        return false;
    });

});


function formatCurrency(num) {
    num = isNaN(num) || num === '' || num === null ? 0.00 : num;
    return parseFloat(num).toFixed(2);
}

/*
* ScrollToElement 1.0
* Copyright (c) 2009 Lauri Huovila, Neovica Oy
*  lauri.huovila@neovica.fi
*  http://www.neovica.fi
*  
* Dual licensed under the MIT and GPL licenses.
*/
(function ($) {
    $.scrollToElement = function ($element, speed) {

        speed = speed || 750;
        var offset = $element.offset();
        
        $("html, body").animate({
            scrollTop:offset.top,
            scrollLeft:offset.left
        }, speed);
        return $element;
    };

    $.fn.scrollTo = function (speed) {
        speed = speed || "normal";
        return $.scrollToElement(this, speed);
    };
})(jQuery);

