// superfish menu nav
jQuery(document).ready(function() {

    jQuery.easing.def = "jswing";
    // Main navigation dropdowns
    $('ul.sf-menu').superfish({
        delay:       300,                            // one second delay on mouseout
        animation:   {
            height:'show'
        },              // fade-in and slide-down animation
        speed:       'fast',                         // faster animation speed
        autoArrows:  false,                           // disable generation of arrow mark-up
        disableHI:   true,
        dropShadows: false                           // disable drop shadows
    });
    
    $('img.captify').captify({});
    /* External links open in new windows */
    $("a[rel='external']").bind("click.external", function(){
        window.open(this.href);
        return false;
    });
    $(".lightbox").prettyPhoto({
        theme: 'facebook',
        show_title: false,
        social_tools: '',
        gallery_markup: ''
    });


    if(jQuery.validator) {
        $.extend($.validator.messages, {
            required: "",
            email: "Buraya geçerli bir e-posta girmelisiniz.",
            url: "Buraya geçerli bir web adresi girmelisiniz.",
            equalTo: "Yukarıdaki ile aynı değeri girmelisiniz",
            minlength: "Değer en az {0} karakter olmalıdır",
            number: "Buraya bir sayı girmelisiniz."
        });
    }
    $.validator.setDefaults({
        //debug: true,
        ignoreTitle: true
    })
    $(".vform").validate();


    
    $('.j-show-prodcate-list').hover(
        function() {

            $('ul.prodcate-list').show().animate({
                opacity: '1'
              }, 500, 'linear', function() {
              });

            $(this).addClass('active');

        },
        function() {
            $('ul.prodcate-list').hide().animate({
                opacity: '0'
              }, 100, 'linear', function() {
              });
            $(this).removeClass('active');
        }
    )

    $('.j-show-insidelist').hover(
        function() {
            $(this).addClass('active').find('div.insidelist').show().animate({
                opacity: '1'
              }, 500, 'linear', function() {
            });
        },
        function() {
            
            $(this).removeClass('active').find('div.insidelist').animate({
                opacity: '0'
              }, 100, 'linear', function() {
            }).hide();
            
        }
    )

    $('.j-tip').tipsy({
        //gravity: $.fn.tipsy.autoNS
        gravity: function () {
            if ( $(this).attr('gravity')!== undefined ) {
                return $(this).attr('gravity');
            } else {
                return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w';
            }
        }
    });

    $(".accordion-faq").tabs(".pane", {tabs: 'span', effect: 'slide'});

});

// simple hide no animation
function hide(id){
    if (document.getElementById){
        obj = document.getElementById(id);
        obj.style.display = "none";
    }
}

// simple show no animation
function show(id){
    if (document.getElementById){
        obj = document.getElementById(id);
        obj.style.display = "";
    }
}

// jquery hide, show and toggle
function ajaxshow(id){
    $(id).fadeIn("slow");
}
function ajaxhide(id){
    $(id).fadeOut("slow");
}
function toggle(id){
    $(id).slideToggle("fast");
}

// Cufon Replacements
Cufon.replace(' h1, h2, h3, .applyfont', {
    hover: true,
    fontFamily: 'Vera'
});
Cufon.replace(' .big-footer h3', {
    textShadow: '1px 1px #ffffff',
    fontFamily: 'Vera'
});
Cufon.replace(' .applyfont, .sidebar-left h3, .sidebar-right h3', {
    textShadow: '1px 1px #ffffff',
    fontFamily: 'Vera'
});
