// JavaScript Document
var site = function() {
	this.navLi = $('#nav-top li').children('ul').hide().end();
	this.init();
};

site.prototype = {
 	
 	init : function() {
 		this.setMenu();
 	},
 	
 	// Enables the slidedown menu, and adds support for IE6
 	
 	setMenu : function() {
 	
 	$.each(this.navLi, function() {
 		if ( $(this).children('ul')[0] ) {
 			$(this).append('<span class="hasChildren" />');
 		}
 	});
 	
 		this.navLi.hover(function() {
 			// mouseover
			$(this).find('> ul').stop(true, true).slideDown('slow', 'easeOutBounce');
 		}, function() {
 			// mouseout
 			$(this).find('> ul').stop(true, true).hide(); 		
		});
 		
 	}
 
}


new site();


/*--------------------------*/
var offerCnt=0;
var offerMax=0;
var autoOffer = true;
function nextOffer(){
  
  if(!autoOffer)return false;
  
  offerCnt++;
  if(offerCnt >= offerMax)
    offerCnt=0;
  $('#offer ul li').eq(offerCnt).click();
  window.setTimeout(nextOffer, 5000)
}

$(document).ready(function(){
	$('a.lightBox').lightBox();
    
	
	 var itext =$('#itext');
			itext.focus(function () {
         itext.val('')
    });
    
	/*reklam strona głowna*/
	var width=695;
    var i=0;
    $('#content div .badanie ').each(function(){
        
        $(this).css('left', i*width+'px');
		$(this).addClass('badanie' +(i +1))
        i++;
        
    });
    $('#offer ul li').hover(function(){
      if(!$(this).hasClass('active') )
      $(this).addClass('hover');
    }, function(){
      $(this).removeClass('hover');
    });
    
    
    $('#faq li > div').hide();
    $('#faq li > strong').click(function(){
      $(this).parent().find('div').toggle('slow');
      
    });
    //$('#faq li:first > div').show();
    
    
    
    
    
    $('#offer ul#menus li').click(function(e){
        if(e.pageX != undefined)
          autoOffer=false;
        $(this).parent().find('.active').removeClass('active');
        $(this).removeClass('hover');
        $(this).addClass('active');
        
        
        var m = $('#content .all .'+$(this).attr('id')).css('left');
        m = parseInt(m);
        
        $('#content .all').animate({
           marginLeft: '-'+m+'px'
        });
       
    });
    
    offerCnt = i;
    offerMax = $('#offer ul li').size();
    $('#badanie3').click();
    
    window.setTimeout(nextOffer, 5000)
    
		var zapLeft = $("#zapytanie-ofertowe a")
		
		
				zapLeft.addClass("thickbox");
				zapLeft.attr("href", "/f_orm/form-left.php?keepThis=true&TB_iframe=true&height=500&width=600")
			
		
		
		
		/*zapytanie ofertowe
			<a href="ajaxOverFlow.htm?keepThis=true&TB_iframe=true&height=300&width=500" title="add a caption to title attribute / or leave blank" class="thickbox">Example 2</a>

		*/
		var zapTemp = $('.zapytanie-ofertowe');
		var zapTempCont = zapTemp.text();
		var zapParent = zapTemp.parent();
		var urls = window.location;
		
		var zapNewHtml = '<div id="zapytanie-ofertowe-div"><a class="thickbox" title="'+zapTempCont +'" href="/f_orm/form.php?temat='+zapTempCont+'&urlss='+urls+'&keepThis=true&TB_iframe=true&height=500&width=600"><img src="/gfxs/zapytaj_o_produkt.jpg" /></a><div>' ;
		
		zapTemp.replaceWith(zapNewHtml) ;
		tb_init('a.thickbox');
    
});


					var flashvars = {}
					var params ={wmode: "transparent"}
					swfobject.embedSWF("/gfxs/flash/subskrypcja.swf", "newsletter-flash", "214", "110", "9.0.0", "",flashvars,params);
					
					
				
					var flashvars1 = {idfl:url}
					var params1 ={wmode: "transparent"}
					swfobject.embedSWF("/gfxs/flash/top-domtechniczny.swf", "flash-top-inner", "960", "215", "9.0.0", "",flashvars1,params1);

