﻿$(document).ready(function () {

            $("a.DisplayMap").fancybox({
                'overlayOpacity': 0.7,
                'overlayColor': '#FFF',
                'hideOnContentClick': false,
                'overlayShow': true,
                'frameWidth': 800,
                'frameHeight': 550

            });

            $("a.ContactRanches").fancybox({
                'overlayOpacity': 0.7,
                'overlayColor': '#FFF',
                'hideOnContentClick': false,
                'type': 'iframe',
                'overlayShow': true,
                'frameWidth': 690,
                'frameHeight': 420,
                'width':690,
                'height':420
            });

            $("#tabs").tabs();

            $("a.YouTube").fancybox({
                'overlayOpacity': 0.7,
                'overlayColor': '#FFF',
                'hideOnContentClick': false,
                'type': 'iframe',
                'overlayShow': true,
                'frameWidth': 580,
                'frameHeight': 360,
                'width': 580,
                'height': 360
            });

            $("a.TopPop").fancybox({
                'overlayOpacity': 0.7,
                'overlayColor': '#FFF',
                'overlayShow': true,
                'hideOnContentClick': true,
                'type': 'iframe',
                'width': 520,
                'height': 420,
                'frameWidth': 520,
                'frameHeight': 420,
                'onClosed': function () {
                    $.cookie("TopPop", "true", { path: '/', expires: 7 });
                    $.fancybox.close()
                }
            });


            $("a.TopPop2").fancybox({
                'overlayOpacity': 0.7,
                'overlayColor': '#FFF',
                'overlayShow': true,
                'hideOnContentClick': true,
                'type': 'iframe',
                'width': 520,
                'height': 150,
                'frameWidth': 520,
                'frameHeight': 150,
                'onClosed': function () {
                    $.fancybox.close()
                }
            });

            $(".thumb .slider").hover(function () {
                //$(this).fadeTo("fast", 0.3);  This should set the opacity to 100% on hover
                $(this).find(".mask").stop().animate({ height: '30px', opacity: '0.9' }, 162);
            }, function () {
                //$(this).fadeTo("slow", 1.0);  This should set the opacity back to 60% on mouseout
                $(this).find(".mask").stop().animate({ height: '0', opacity: '0' }, 400);
            });
           
            $("*[class^=accordian]").accordion({ collapsible: true, active: false, autoHeight: false });
            $(".tool[title]").tooltip({ events: { def: 'focus mouseenter,blur mouseleave', input: 'mouseover focus,mouseout blur'} });

            $("#menu ul li").hoverIntent({
                interval: 150, // milliseconds delay before onMouseOver
                over: drops_show,
                timeout: 500, // milliseconds delay before onMouseOut
                out: drops_hide
            });
            $("#menu ul li").addClass('with-js');


            $("#txtSearchBox").autocomplete({
                source: function (request, response) {
                    $.ajax({
                        url: "/services/ranchfinder.asmx/FetchKeywordList",
                        data: "{ 'searchValue': '" + request.term + "' }",
                        dataType: "json",
                        type: "POST",
                        contentType: "application/json; charset=utf-8",
                        dataFilter: function (data) { return data; },
                        success: function (data) {
                            response($.map(data.d, function (item) {
                                return {
                                    value: item.Keyword
                                }
                            }))
                        }
                    });
                },
                minLength: 2
            });
           
        });

        function drops_show() { $(this).addClass('show'); }
        function drops_hide() { $(this).removeClass('show'); }

       

