﻿
jQuery(document).ready(function() {
//	jQuery("#bottombar .banner_item").last().addClass('last_item');
	jQuery("#tabs").tabs();
//	jQuery('a.lightbox').lightBox(); // Select all links that contains lightbox in the attribute rel
//	jQuery('a[rel^=lightbox]').lightBox();
	jQuery("div#newsScroll ul").cycle({
			fx: 'scrollDown'
		});

//	dla Selgros
if (jQuery('#popupBaner').length > 0 ) {
		jQuery('<div id="modalOverlay"></div><div id="modalWindow"></div>').insertAfter('#main_wrapper');
		jQuery('#modalWindow').append(jQuery('#popupBaner').html());
	}
	
	
	jQuery("#modalOverlay").css({
		display: 'block',
		height: jQuery(document).height(),
		width: jQuery(document).width()
	});
	var leftPosition = (jQuery(document).width() / 2) - (jQuery("#modalWindow").width() / 2);
	jQuery("#modalWindow").css({
		display: 'block',
		left: leftPosition
	});
	jQuery("area").click(function() {
		jQuery("#modalOverlay").css({display: 'none'});
		jQuery("#modalWindow").css({display: 'none'});
	});	
	
	if (jQuery('#PanelTestMode').length > 0 ) {
			jQuery('#menu_top').css({top: '193px'});
			jQuery('#right_banner').css({top: '196px'});
	}
// koniec dla Selgrosa

// dla "Panów Trzech"
//alert('aaa: ' + jQuery('.aboutPageText').height());

if ((jQuery('.panowTrzech').length > 0) && (jQuery('#content_inner').length > 0) && (jQuery('#content_inner').height() >= 570)) {
	jQuery('#content_inner').css({height: '570px'});
	jQuery('#content_inner').css({overflow: 'hidden'});
	jQuery("#content_inner").jScrollPane({
		showArrows: true
	}); 
	
}

// koniec dla "Panów Trzech"
								
								
								
								
/* ******************************************************** */
	jQuery('#wymiary, #uwagi, #laczenia, #scieralnosc, #struktura, #regulamin').dialog({ autoOpen: false, modal: true, width: 760, minWidth: 760, maxHeight: 550, height: 550, resizable: false });
	jQuery('img.wymiary').click(function(){
		jQuery('#wymiary').dialog('open');
	});
	jQuery('img.uwagi').click(function(){
		jQuery('#uwagi').dialog('open');
	});
	jQuery('img.laczenia').click(function(){
		jQuery('#laczenia').dialog('open');
	});
	jQuery('img.scieralnosc').click(function(){
		jQuery('#scieralnosc').dialog('open');
	});
	jQuery('img.struktura').click(function(){
		jQuery('#struktura').dialog('open');
	});
	jQuery('a.regulamin').click(function(){
		jQuery('#regulamin').dialog('open');
	});
	
	
	
	
	jQuery('body').append("<span id='tooltip'></span>"); //for custom tooltip behavior
	// tootlip behavior 
	var tootlipText;
	var imgRef;
	jQuery(".desc_ico img").hover( function(){
		tootlipText = jQuery(this).attr('title');
		jQuery(this).attr('title', '');
		jQuery("#tooltip").text(tootlipText);
		jQuery("#tooltip").css("display","block");  
		jQuery(this).mousemove(function(e){
			jQuery("#tooltip").css("left",(e.pageX + 20) + "px");
			jQuery("#tooltip").css("top",(e.pageY + 20) + "px");  
			
		});
	},
	function(){
		jQuery(this).attr('title', jQuery('body #tooltip').text());
		jQuery("#tooltip").css("display","none");  
		jQuery('body #tooltip').text('');
	});
	
	jQuery(".desc_txt").hover( function(){
		imgRef = jQuery(this).find('img');
		jQuery("#tooltip").append('<img src="'+imgRef.attr('src') + '" /> <br />' + imgRef.attr('title'));
		jQuery("#tooltip").css("display","block");  
		jQuery(this).mousemove(function(e){
			jQuery("#tooltip").css("left",(e.pageX + 20) + "px");
			jQuery("#tooltip").css("top",(e.pageY + 20) + "px");  
			
		});
	},
	function(){
		jQuery("#tooltip").css("display","none");  
		jQuery('body #tooltip').text('');
	});
	
	if (jQuery('#slideshow').length > 0 ) {
	jQuery('#slideshow').cycle({
		fx: 'fade',
		timeout:  4000,
		pager: '#navi',
		cleartypeNoBg: true
	});
	}
	
	if (jQuery('.slideshow').length > 0 ) {
		jQuery('.slideshow').cycle({
			fx: 'fade',
			cleartypeNoBg: true
		});
	}
	
	if (jQuery('#slideshow1').length > 0 ) {
	jQuery('#slideshow1').cycle({
		fx: 'fade',
		timeout:  7000,
		cleartypeNoBg: true
	});
	}
	if (jQuery('#slideshow2').length > 0 ) {
	jQuery('#slideshow2').cycle({
		fx: 'fade',
		timeout:  5000,
		cleartypeNoBg: true
	});
	}
	if (jQuery('#slideshow3').length > 0 ) {
	jQuery('#slideshow3').cycle({
		fx: 'fade',
		timeout:  8000,
		cleartypeNoBg: true
	});
	
	}
	
	/*
	//if(jQuery(".desc_img_topmet").length >0){
	jQuery(".desc_img_topmet").hover( function(){
		imgRef = jQuery(this).find('span img');
		imgPos = jQuery(this).find('a img');
		jQuery("#tooltip").append('<img src="'+imgRef.attr('src') + '" /> <br />' + imgRef.attr('title'));
		jQuery("#tooltip").css("display","block");  
		jQuery("#tooltip").css("left",(imgPos.offset().left + 155) + "px");
		jQuery("#tooltip").css("top",(imgPos.position().top + 10) + "px");  

	}
	)
		//}
	
	jQuery(".desc_img").hover( function(){
		imgRef = jQuery(this).find('span img');
		imgPos = jQuery(this).find('a img');
		jQuery("#tooltip").append('<img src="'+imgRef.attr('src') + '" /> <br />' + imgRef.attr('title'));
		jQuery("#tooltip").css("display","block");  
		jQuery("#tooltip").css("left",(imgPos.offset().left + 155) + "px");
		jQuery("#tooltip").css("top",(imgPos.position().top + 10) + "px");  

	},
	function(){
		jQuery("#tooltip").css("display","none");  
		jQuery('body #tooltip').text('');
	});
	*/
/* ******************************************************** */
});


