﻿function callfancy() {
    $(".GalleryFancyBoxClass").fancybox({
        'padding': 0,
        'autoScale': false,
        'transitionIn': 'elastic',
        'transitionOut': 'elastic',
        'speedIn': 600,
        'speedOut': 500,
        'easingIn': 'easeOutBack',
        'easingOut': 'easeInBack',
        titleShow: false,
        'width': 649,
        'height': 445,
        overlayColor: '#000',
        'overlayOpacity': 0.8,
        'type': 'image'

    });
}
function callFancyRecomm() {
    $(".HomeClientTellVideoClass").fancybox({
        'padding': 0,
        'autoScale': false,
        'transitionIn': 'elastic',
        'transitionOut': 'elastic',
        'speedIn': 600,
        'speedOut': 500,
        'easingIn': 'easeOutBack',
        'easingOut': 'easeInBack',
        'title': this.title,
        'width': 680,
        'height': 495,
        overlayColor: '#000',
        'overlayOpacity': 0.8,
        // 'href': this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
        'type': 'swf',
        'swf': {
            'wmode': 'transparent',
            'allowfullscreen': 'true',
            'allowNetworking':'internal'
        }
    });
}

function callFancyRecomm2() {
    $(".HomeClientTellVideoClass").fancybox({
        'padding': 0,
        'autoScale': false,
        'transitionIn': 'elastic',
        'transitionOut': 'elastic',
        'speedIn': 600,
        'speedOut': 500,
        'easingIn': 'easeOutBack',
        'easingOut': 'easeInBack',
        'title': this.title,
        'width': 680,
        'height': 495,
        overlayColor: '#000',
        'overlayOpacity': 0.8,
        hideOnContentClick: false,
        // 'href': this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
        'type': 'swf',
        'swf': {
            'wmode': 'transparent',
            'allowfullscreen': 'true', 
            'allowNetworking': 'internal'
        }
    });
}
function showQ(selected) {

    if ($(selected).parent().next('.RecommBubbleClass').css('height') != '0px') {

        $('.RecommBubbleClass').css('height', '0px');
        $('.RecommRecommReadClass').text('קרא את כל ההמלצה');
        $('.RecommRecommReadClass').css('z-index', '99');

    } else {

        $('.RecommBubbleClass').css('height', '0px');
        $(selected).parent().next('.RecommBubbleClass').css('height', '274px');
        $(selected).next().next().next().next().next().next('.RecommReadClass').text('סגור את ההמלצה');
        $(selected).next().next().next().next().next().next('.RecommReadClass').css('z-index', '101');
    }
}
function showQ2(selected) {
    $('.RecommRecommReadClass').text('קרא את כל ההמלצה');
    $('.RecommRecommReadClass').css('z-index', '99');
    if ($(selected).parent().next('.RecommBubbleClass').css('height') != '0px') {
        $('.RecommBubbleClass').css('height', '0px');

    } else {

        $('.RecommBubbleClass').css('height', '0px');
        $(selected).parent().next('.RecommBubbleClass').css('height', '274px');
        $(selected).text('סגור את ההמלצה');
        $(selected).css('z-index', '101');
    }
}
function hidbubble() { 
        $('.RecommBubbleClass').css('height', '0px');
        $('.RecommRecommReadClass').text('קרא את כל ההמלצה');
        $('.RecommRecommReadClass').css('z-index', '99');

    }
function showhide(clicked) {
    if ($(clicked).parent('.MasterFooterTab1Class').css('height') == '394px') {
        $(clicked).parent('.MasterFooterTab1Class').animate({
            height: '95px',
            marginTop: '290px'

        }, 800, function() {

            $('.MasterFooterTab1Class').css('margin-Top', '0px');
            $('.MasterFooterTab1Class').css('height', '110px');
            $('.MasterFooterPhoneClass').css('margin-Top', '0px');
            $('.MasterFooterTabClickClass').css('margin-bottom', '15px');


            $(clicked).next('.MasterFooterTab1CenterClass').css('background-image', 'url(Images/MasterImages/MasterFooterTranBG.png)');

        });
    }
    else {

        $('.MasterFooterTab1Class').css('margin-Top', '285px');
        $('.MasterFooterPhoneClass').css('margin-Top', '285px');
        $('.MasterFooterTab1Class').css('height', '110px');
        $(clicked).next().children('.MasterFooterTabClickClass').css('margin-bottom', '0px');
        $(clicked).next('.MasterFooterTab1CenterClass').css('background-image', 'url(Images/MasterImages/MasterFooterTabCenter.png)');
        
        $(clicked).parent('.MasterFooterTab1Class').animate({
            height: '394px',
            marginTop: '0px'

        }, 800, function() {
        });
    }
}
function mCustomScrollbars() {
    /* 
    malihu custom scrollbar function parameters: 
    1) scroll type (values: "vertical" or "horizontal")
    2) scroll easing amount (0 for no easing) 
    3) scroll easing type 
    4) extra bottom scrolling space for vertical scroll type only (minimum value: 1)
    5) scrollbar height/width adjustment (values: "auto" or "fixed")
    6) mouse-wheel support (values: "yes" or "no")
    7) scrolling via buttons support (values: "yes" or "no")
    8) buttons scrolling speed (values: 1-20, 1 being the slowest)
    */
    $("#mcs_container").mCustomScrollbar("vertical", 200, "easeOutCirc", 1.25, "fixed", "yes", "no", 0);


    var alldivs = document.getElementsByTagName('div');

    for (var i = 0; i < alldivs.length; i++) {
        var dv = alldivs[i];
        if (dv.id != null) {
            if (dv.id.indexOf('mcs_container') != -1) {

                $("#" + dv.id).mCustomScrollbar("vertical", 200, "easeOutCirc", 1.25, "fixed", "yes", "no", 0);
            }
        }
    }
  
}

/* function to fix the -10000 pixel limit of jquery.animate */
$.fx.prototype.cur = function() {
    if (this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null)) {
        return this.elem[this.prop];
    }
    var r = parseFloat(jQuery.css(this.elem, this.prop));
    return typeof r == 'undefined' ? 0 : r;
}

/* function to load new content dynamically */
function LoadNewContent(id, file) {
    $("#" + id + " .customScrollBox .content").load(file, function() {
        mCustomScrollbars();
    });
}
