﻿

//main menu

function onloadmenu() {
    $('.SubMenuPalceHolderClass').css('height', '0px');
    didsel = '';
    Alldivs = document.getElementsByTagName('div');
    for (i = 0; i < Alldivs.length; i++) {
        if (Alldivs[i].className == 'MainMenuControlSelPlaceHolderClass') {
            didsel = Alldivs[i].id;
        }
    }
}
function mouseOver(selected) {

    if (didsel != '') {
        document.getElementById(didsel).className = 'MainMenuControlPlaceHolderClass';
    }
    document.getElementById(selected.id).className = 'MainMenuControlSelPlaceHolderClass';
    $('.SubMenuPalceHolderClass').css('height', '100%');
    $('.SubMenuPalceHolderClass').css('overflow', 'visible');
}
function mouseOut(selected) {


    document.getElementById(selected.id).className = 'MainMenuControlPlaceHolderClass';
    if (didsel != '') {
        document.getElementById(didsel).className = 'MainMenuControlSelPlaceHolderClass';
    }
    $('.SubMenuPalceHolderClass').css('height', '0px');
    $('.SubMenuPalceHolderClass').css('overflow', 'hidden');
}
//main menu 

function recommslider() {

    $('.HomeRecommPalceHolderClass').cycle({
        fx: 'zoom', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
        timeout: '10000',
        prev: '#prev',
        next: '#next',
        pause: true
    });
}


function servicecycleresume() {

    $('.HomeTreatmentPlaceHolderClass').cycle('resume');

}
function servicecyclepause() {

    $('.HomeTreatmentPlaceHolderClass').cycle('pause');

}

function servicecycle(slide) {

    $('.HomeTreatmentPlaceHolderClass').cycle({

        fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
        timeout: '12000',
        cleartype: true,
        cleartypeNoBg: true,
        startingSlide: slide
    });
}
function servicecycleStart(slide) {
    $('.HomeTreatmentPlaceHolderClass').cycle({

        fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
        timeout: '12000',
        cleartypeNoBg: true,

        startingSlide: slide
    });
}
function russchangeclass(selected) {
    document.getElementById(selected.id).className = 'RusGoToRussClass';
}
function russchangeclass2(selected) {
    document.getElementById(selected.id).className = 'MasterGoToRussClass';

}
function engchangeclass(selected) {
    document.getElementById(selected.id).className = 'EngGoTEngClass';
}
function engchangeclass2(selected) {
    document.getElementById(selected.id).className = 'MasterGoTEngClass';

}
function toglerec() {

    $('.RecommNameClass').toggle(function(e) {

        $(this).next().next('.RecommAnswerClass').css('height', '100%');
        var maxHeight = $(this).next().next('.RecommAnswerClass').height();
        $(this).next().next('.RecommAnswerClass').css('height', '73px');
        //$(this).parent().prev('.FeatureContentLabelDivClass').css('height', '55px');
        $(this).next().next('.RecommAnswerClass').animate({
            height: maxHeight

        }, 800, function() {
            $(this).next().next().next('.RecommOpenAnswerClass').removeClass('RecommOpenAnswerClass').addClass('RecommCloseAnswerClass');
            $(this).next().next().next('.RecommCloseAnswerClass').text('סגור ההמלצה');


        })

    }, function(e) {
        $(this).next().next('.RecommAnswerClass').animate({
            height: '73px'
        }, 800, function() {
            $(this).next().next().next('.RecommCloseAnswerClass').removeClass('RecommCloseAnswerClass').addClass('RecommOpenAnswerClass');
            $(this).next().next().next('.RecommOpenAnswerClass').text('קרא כל ההמלצה');

        })
    });
}
function callfancyrec() {

    $(".RecommentationVideoClass").fancybox({
        'padding': 1,
        'autoScale': true,
        'transitionIn': 'elastic',
        'transitionOut': 'elastic',
        'speedIn': 600,
        'speedOut': 500,
        'easingIn': 'easeOutBack',
        'easingOut': 'easeInBack',
        'type': 'image'


    });
}


function changeImg(GallerySmall1) {
    alert($('#BGBigPic'));
    if ($('#BGBigPic') != null) {
        $('#BGBigPic').attr("src", "images/GalleryImages/" + GallerySmall1.replace("Small", "Big")).fadeIn("slow");
    }
}

$(document).ready(function textboxwatermark() {
    $('input').each(function() {
        $(this).watermark($(this).attr('watermark'));
        $(".ContactTextBoxMultilineStyle").watermark('הערות');
    });
});







function homevideofancy() {
    $(".HomeVideoClass").fancybox({
        'padding': 0,
        'autoScale': false,
        'transitionIn': 'elastic',
        'transitionOut': 'elastic',
        'speedIn': 600,
        'speedOut': 500,
        'easingIn': 'easeOutBack',
        'easingOut': 'easeInBack',
        'title': this.title,
        'width': 680,
        'height': 495,

        'type': 'swf',
        'swf': {
            'wmode': 'transparent',
            'allowfullscreen': 'true'
        }
    });
     };

function HomeClientTellVideofancy() {


     $(".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,
          
            'type': 'swf',
            'swf': {
                'wmode': 'transparent',
                'allowfullscreen': 'true'
            }
        });
    };




    function BGfadeEvent() {
        $('#Event_BG').cycle({
            fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
            timeout: 0,
            pause: true,
            next: '#nextEventBG',
            prev: '#prevEventBG',
            width: '100%',
            height: '602px',
            after: function (currSlideElement, nextSlideElement, options, forwardFlag) {
               // resizeSlide();
            },
            onPrevNextEvent: function (isNext, zeroBasedSlideIndex, slideElement) {

                var count = $('.inagecountclass').text();
                var num = $('.imagenumclass').text();
                if (isNext == true) {
                    // alert(zeroBasedSlideIndex);
                    $('.imagenumclass').text(zeroBasedSlideIndex + 1);

                } else {
                    //   alert(zeroBasedSlideIndex);
                    if (zeroBasedSlideIndex == 26) {
                        $('.imagenumclass').text(count);
                    } else {
                        $('.imagenumclass').text(zeroBasedSlideIndex + 1);
                    }
                }
            }
        });
    };

    function resizeSlide() {



        currentWidth = $('#Event_BG').width();
        currentHeight = $('#Event_BG').height();

        //$(slide).show(); // Make sure we have dimensions to calculate.

        // Reorientate image based off of the aspect ratio.
        var bg = $('.DefaultMainBgIMG');



        if (bg.width() <= currentWidth) {
            bg.css({ width: '100%', height: 'auto' });


        } else if (bg.height() < currentHeight) {
            bg.css({ width: 'auto', height: '100%' });
        }
    }

    function resizeSlide2() {

        changecss($('.GalleryBgIMG'))


    }
    function changecss(myimage) {


        currentWidth = $('#Event_BG').width();
        currentHeight = $('#Event_BG').height();
        var myWidth = $(myimage).width();
        var myHeight = $(myimage).height();

        $(myimage).css('width', '1024px');
        
        if (currentWidth * 1000 / myWidth > currentHeight * 1000 / myHeight) {
            $(myimage).css('width', 'auto');
            $(myimage).css('height', currentHeight);

           

        } else {

            $(myimage).css('height', 'auto');
            $(myimage).css('width', currentWidth);
            var mypad = (currentWidth - $(myimage).width()) / 2;
            $(myimage).css('padding-left', mypad + 'px');

        }


    }

    function gonext() {
        alert('');

    }
    function galleryslide(slide) {

        $('.imagenumclass').text((slide + 1));
        $('#Event_BG').cycle({

            fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
            timeout: 0,
            pause: true,
            next: '#nextEventBG',
            prev: '#prevEventBG',
            width: '100%',
            height: '602px',
            startingSlide: slide,
            _toggleInfo:false
        });
    }

  


    function recommFEvent() {
        $('.recommFooter').cycle({
            fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
            timeout: 7000,
            pause: true,
            next: '#nextEventBG',
            prev: '#prevEventBG',
            width: '345px',
            height: '100px'

        });
    };


    function togglerie9() {

        var hiddenstyle = $('#middlediv').css('display');

        $('#middlediv').toggle({
            duration: 400,
            easing: 'easeInSine'
        });
        if (hiddenstyle == "none") {
            $(".EventDetailsButtonPlaceHolder").css({ "background-image": "url('images/EventImages/EventInfoButtonBG.png')" });
        } else {
            $(".EventDetailsButtonPlaceHolder").css({ "background-image": "url('images/EventImages/EventGalleryButtonBG.png')" });
        }
    };


    function togglerdetails() {

        var hiddenstyledetails = $('#detailsdiv').css('display');
        //    alert(hiddenstyledetails);

        $('#gallerydiv').slideUp({
            duration: 400,
            easing: 'easeInSine'
        });

        $(".EventGalleryButtonPlaceHolder").css({ "background-image": "url('images/EventImages/EventGalleryButtonBG.png')" });

        $('#detailsdiv').toggle({
            duration: 400,
            easing: 'easeInSine'
        });
        if (hiddenstyledetails == "none") {
            $(".EventDetailsButtonPlaceHolder").css({ "background-image": "url('images/EventImages/EventInfoButtonBG.png')" });
        } else {
            $(".EventDetailsButtonPlaceHolder").css({ "background-image": "url('images/EventImages/EventGalleryButtonBG.png')" });
        }
    };

    function togglergallery() {

        var hiddenstylegallery = $('#gallerydiv').css('display');
        //    alert(gallerydiv);

        //    $('#detailsdiv').css({ "display": "none" });

        $('#detailsdiv').slideUp({
            duration: 400,
            easing: 'easeInSine'
        });

        $(".EventDetailsButtonPlaceHolder").css({ "background-image": "url('images/EventImages/EventGalleryButtonBG.png')" });

        $('#gallerydiv').toggle({
            duration: 400,
            easing: 'easeInSine'
        });
        if (hiddenstylegallery == "none") {
            $(".EventGalleryButtonPlaceHolder").css({ "background-image": "url('images/EventImages/EventInfoButtonBG.png')" });
        } else {
            $(".EventGalleryButtonPlaceHolder").css({ "background-image": "url('images/EventImages/EventGalleryButtonBG.png')" });
        }
    };


    //called when map loads
    function onInit() {
        var map = g_waze_map.map;
        //var shapes = new OpenLayers.Layer.Vector("Shapes");
        //map.addLayer(shapes);
        //var pentagon = OpenLayers.Geometry.Polygon.createRegularPolygon(new OpenLayers.Geometry.Point(34.78441, 32.08946), 0.001, 5, 0);
        //var pentagon_feature = new OpenLayers.Feature.Vector(pentagon);
        //shapes.addFeatures([pentagon_feature]);
        //			var line = new OpenLayers.Geometry.LineString([
        //					new OpenLayers.Geometry.Point(34.79514, 32.09127),
        //					new OpenLayers.Geometry.Point(34.79544, 32.08985),
        //					new OpenLayers.Geometry.Point(34.79544, 32.08861),
        //					new OpenLayers.Geometry.Point(34.79544, 32.08736),
        //					new OpenLayers.Geometry.Point(34.79514, 32.08577)
        //				]);
        //var line_feature = new OpenLayers.Feature.Vector(line);
        //shapes.addFeatures([line_feature]);

        //search API example, calls 'find_callback' when search returns
        //g_waze_map.find('ה באייר תא', 'find_callback');
        map = g_waze_map.map;
        //var first_result = response[0];
        var lonlat = new OpenLayers.LonLat(34.89887, 32.02651);
        g_waze_map.map.setCenter(lonlat);
        var size = new OpenLayers.Size(36, 47);
        var offset = new OpenLayers.Pixel(-(size.w / 2), -size.h);
        var icon = new OpenLayers.Icon('http://www.waze.co.il/images/home.png', size, offset);
        var markers = new OpenLayers.Layer.Markers("Markers");
        map.addLayer(markers);
        markers.addMarker(new OpenLayers.Marker(lonlat, icon));
        map.addPopup(new OpenLayers.Popup.FramedCloud("test", lonlat, null,
							"<div style='font-family:Arial,sans-serif;font-size:0.8em;color:black;'>שורשים<div>",
							anchor = null, true, null));
    };

    g_waze_config = {
        div_id: "map",
        locale: "israel",
        center_lon: 34.89887,
        center_lat: 32.02651,
        zoom: 6,
        token: "3b1005da-f53a-4d72-b3c2-e5566c56c4b2",
        alt_base_layer: "israel_colors",
        alt_map_servers: "http://ymap1.waze.co.il/wms-c/",
        callback: onInit
        //framed_cloud_image_url:"http://www.waze.co.il/test_api/cloud.png"
    };



    // add id="map" to the required div
    //<script type="text/javascript" src="http://www.waze.co.il/js/WazeEmbeddedMapNoJQuery.js"></script>


    function ContactMapPlaceHolderfancybox() {
        $("a.ContactMapPlaceHolder").fancybox({
            'transitionIn': 'elastic',
            'transitionOut': 'elastic',
            'easingIn': 'easeOutBack',
            'easingOut': 'easeInBack',
            'speedIn': 1200,
            'speedOut': 600,
            //'autoScale': false,
            'type': 'iframe',
            'padding': 5,
            'hideOnContentClick': true,
            'enableEscapeButton': true,
            'overlayShow': true,
            'titleShow': false,
            'showCloseButton': true,
            'width': 625,
            'height': 500
        });
    };


    function BGfade() {

        $('#Default_BG').cycle({
            fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
            timeout: 0,
            pause: true,
            next: '#nextBG',
            prev: '#prevBG',
            width: '100%',
            height: '702px'
        });
    };


    function toggleCustomer() {

        $('.CustomerFooterTextTitle').toggle(function(e) {

            $(this).next().next('.RecommendText').css('height', '100%');
            var maxHeight = $(this).next().next('.RecommendText').height();
            $(this).next().next('.RecommendText').css('height', '50px');
            //$(this).parent().prev('.FeatureContentLabelDivClass').css('height', '55px');
            $(this).next().next('.RecommendText').animate({
                height: maxHeight

            }, 800, function() {
                $(this).next('.RecommendOpenClose').removeClass('RecommendOpenClose').addClass('RecommendOpenClose2');
                $(this).next('.RecommendOpenClose2').text('סגור המלצה');
            })

        }, function(e) {
            $(this).next().next('.RecommendText').animate({
                height: '50px'
            }, 800, function() {
                $(this).next('.RecommendOpenClose2').removeClass('RecommendOpenClose2').addClass('RecommendOpenClose');
                $(this).next('.RecommendOpenClose').text('ראה כל ההמלצה');
            })
        });
    };

    function Galleriaload() {
        Galleria.loadTheme('galleria/themes/classic/galleria.classic.min.js');
        $(".Disheslargeimagesclass").galleria({
            width: 670,
            height: 475,
            transition: 'fade',
            carousel: true,
            imagePan: true

        });


    };

    function DishFEvent() {
        $('.Disheslargeimagesclass').cycle({
            fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
            timeout: 7000,
            pause: true,
            next: '#nextEventBG2',
            prev: '#prevEventBG2',
            width: '660px',
            height: '355px'

        });
    };

    function dichecycle(slide) {

        $('.Disheslargeimagesclass').cycle({

            fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
            timeout: '7000',
            cleartype: true,
            cleartypeNoBg: true,
            startingSlide: slide
        });
    }
