﻿function theRotator() {
	//Set the opacity of all images to 0
	$('div.rotator ul li').css({opacity: 0.0});
	
	//Get the first image and display it (gets set to full opacity)
	$('div.rotator ul li:first').css({opacity: 1.0});
		
	//Call the rotator function to run the slideshow, 6000 = change to next image after 6 seconds
	
	setInterval('rotate()',8000);
	
}akcja = 1;
function rozwin_stopke(){	if(akcja == 1){		var x1p = $(".special_block").get(0).clientHeight;//gorne		var x1k = $(".special_block").get(0).scrollHeight;//gorne		var zwieszkamO  =   x1k-x1p;		var licznik     =   0					Ident = window.setInterval(function() {													if(zwieszkamO>licznik){								$('.special_block').get(0).style.height     =   ($('.special_block').get(0).clientHeight + 5)+'px';								$('#special_block').get(0).style.height   =   ($('#special_block').get(0).clientHeight - 15)+'px';								licznik+=5							}else{									window.clearInterval(Ident);							}					}, 40);		akcja = 2;		$('#seo_more').get(0).innerHTML = 'zwiń';			}else{			wysokosc=$('#special_block').get(0).clientHeight-155;                licznik =0;                Ident = window.setInterval(function() {                        if(wysokosc>licznik){                            $('#special_block').get(0).style.height     =   ($('#special_block').get(0).clientHeight - 25)+'px';                            $('.special_block').get(0).style.height   =   ($('.special_block').get(0).clientHeight - 5)+'px';                            licznik+=5                        }else{                                window.clearInterval(Ident);                                                        }                }, 40);                akcja=1;				$('#seo_more').get(0).innerHTML = 'rozwiń';	}			}
function rotate() {	
	//Get the first image
	var current = ($('div.rotator ul li.show')?  $('div.rotator ul li.show') : $('div.rotator ul li:first'));

    if ( current.length == 0 ) current = $('div.rotator ul li:first');

	//Get next image, when it reaches the end, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div.rotator ul li:first') :current.next()) : $('div.rotator ul li:first'));
	
	//Un-comment the 3 lines below to get the images in random order
	
	//var sibs = current.siblings();
    //var rndNum = Math.floor(Math.random() * sibs.length );
    //var next = $( sibs[ rndNum ] );
			

	//Set the fade in effect for the next image, the show class has higher z-index
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1500);

	//Hide the current image
	current.animate({opacity: 0.0}, 1500)
	.removeClass('show');
	
};


jQuery(document).ready(function() { 

	theRotator();
	$('div.rotator').fadeIn(1500);
    $('div.rotator ul li').fadeIn(1500); // tweek for IE
	
	jQuery('form input, form textarea').focus(
	function(){
	jQuery(this).css('border-color','#000000');
	}
	)
	jQuery('form input, form textarea').blur(
	 function(){
	jQuery(this).css('border-color','#143362');
	}
	)
  	
	jQuery('.shailan-dropdown-menu ul li:first-child a').css('margin-left', '0px');
	jQuery('.shailan-dropdown-menu ul li:last-child a').css('margin-right', '0px');
	jQuery('.shailan-dropdown-menu ul li:last-child').css('background-image', 'none');
	
	
	
	jQuery('a[rel="_blank"]').each(function(){
               jQuery(this).attr('target', '_blank');
          });
		  
		  jQuery('.gallery-item').each(function(index){
			var mix=index+1;
              if(mix%4==0){
			  jQuery(this).css('margin-right','0px');
			  }
          });
		  
	jQuery('.shailan-dropdown-menu a').removeAttr('title');	  
	
	jQuery('table.c9 td').hover(
	function(){
	jQuery(this).parent().children('td').addClass('hover');
	},
	function(){
	jQuery(this).parent().children('td').removeClass('hover');
	}
	);
	

});


