﻿$(function(){
    $(".tooltip").hide();
    $(".meerInfo").click(function(){
    $(".tooltip").hide();
        $i = $(".tooltip").eq($(this).parent().parent().find(".meerInfo").index(this));
        $off = $(this).offset();
       
        $i      .show()
                .css({left : $off.left - $i.innerWidth() + 27,
                      top   : $off.top + 15
                      });
    },
    function(){
        $(".tooltip").eq($(this).parent().parent().find(".meerInfo").index(this)).hide();
    });
    
    // Dropdowns hoogte
    $(".dropPageList").each(function(){
        if($(this).height() > 300)
        {
            $(this).height(300).css({'overflow' : "auto"});
            
        }
    });
    
    /*
        Als een afbeelding te groot is voor het productoverzicht.
        Dan de afbeelding schalen
    */
    $(".prodImg img").load(function(){
        var maxHeight = 167;
        if($(this).height() > maxHeight)
        {
            $(this).attr("height", maxHeight);
        }
    });
});

function openDialog()
{
    $("#popupscherm").dialog({
            bgiframe: true, 
            width:402, 
            modal: true, 
            draggable: false,
            resizable: false , 
            title:'', 
            open:function(type,data){$(this).parent().appendTo("form")}
            });
    // Streep weghalen vanwege de min-height
    $(".ui-dialog-content").css("min-height", "0");
    $(".ui-dialog-content").css("overflow", "hidden");
   
    // IE8 horizontal scroll fix als er een verticale scroll bar zit
    $(".ui-widget-overlay").css("width", "100%");
    
    
}

function closeDialog()
  { 
    var dlg = $("#popupscherm");
        dlg.dialog("destroy");
        $(".ui-dialog").hide();
    $(".ui-widget-overlay").hide();
    dlg.dialog();   
    dlg.dialog("destroy");
   }
   
   

function dialogAfterPostback()
{
    openDialog();
}

function makeExtrasLoader()
{
//    $(".extrasLoader")
//        .height($("#popupscherm").innerHeight())
//        .show();
//    $(".extrasLoader div")
//        .css({opacity: 0.8})
//        .height($("#popupscherm").innerHeight());
    
}
$(function(){
    $(".extrasLoader").hide();
});
