$(document).ready(function(){

    // tooltip - dymek
    tooltip();

    // lightbox - colorbox
    $("a[rel='lightbox']").colorbox({transition:"elastic"});
    
    $(".prezentacja_smartfire").colorbox({
        width:"1000px", height:"620px", iframe:true, href:"prezentacja/smartfire.html"
            });
    
    // prezentacja produktów na stronie głównej
    $(".expand").toggle(function(){
        $(this).addClass("prezentacja_on");
        }, function () {
        $(this).removeClass("prezentacja_on");
    });
    
    $(".collapse").hide();
	$('.expand').click(function(){
	    $(".collapse").slideToggle("slow,");
	});
	
    $(".collapse2").hide();
	$('.expand2').click(function(){
	    $(".collapse2").slideToggle("slow,");
	});
    
	// tabs - zakładki
    $("#usual1 ul").idTabs(); 

    // menu górne
    $('ul.sf-menu').superfish({ 
        delay:       0,                          // one second delay on mouseout 
        animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation 
        speed:       0,                          // faster animation speed 
        autoArrows:  true,                       // disable generation of arrow mark-up 
        dropShadows: false                       // disable drop shadows 
    }); 
 
    $(".dropdown img.flag").addClass("flagvisibility");

    $(".dropdown dt a").click(function() {
        $(".dropdown dd ul").toggle();
    });
                
    $(".dropdown dd ul li a").click(function() {
        var text = $(this).html();
        $(".dropdown dt a span").html(text);
        $(".dropdown dd ul").hide();
    });
                
    $(document).bind('click', function(e) {
        var $clicked = $(e.target);
        if (! $clicked.parents().hasClass("dropdown"))
            $(".dropdown dd ul").hide();
    });

});

noweOkienko = null;
function otworz(adres, w, h) {

  if(window.screen){
    aw=screen.availWidth;
    ah=screen.availHeight;
  }else{
    aw=640;
    ah=450;
  }
  if(noweOkienko==null || noweOkienko.closed){
    ustawienia=
     "left=" + (aw-w)/2 + ","
    +"top=" + (ah-h)/2 + ","
    +"screenX=" + (aw-w)/2 + ","
    +"screenY=" + (ah-h)/2 + ","
    +"width=" + w + ","
    +"height=" + h + ","
    +"innerWidth=" + w + ","
    +"innerHeight=" + h + ","
    +"toolbar=no,"
    +"location=no,"
    +"directories=no,"
    +"status=no,"
    +"menubar=no,"
    +"scrollbars=1,"
    +"resizable=no"
    noweOkienko = window.open(adres,'drukuj',ustawienia);
  }
  noweOkienko.document.close();
  noweOkienko.focus();
}

