$(document).ready(function(){
        
	$(".mainSectorPage .sectorBoxMenu ul li").click(function(){
	   window.location = $(this).find("a.more").attr("href");
  });                
  
	$(".mainSectorPage .sectorBoxMenu ul li").hover(
    function () {
       $(this).find("a.more").css('text-decoration', 'underline');
    }, 
    function () {
       $(this).find("a.more").css('text-decoration', 'none');
    }
  );

  //cookie for font size     
  var cookieName = 'luxmed_font_size';
  var cookieOptions = { path: '/', expires: 30 };    
  
  var fontSize = $.cookie(cookieName);
  if(fontSize){$("body").css("font-size",fontSize);};
  
  //set small font 
  $(".topBreadcrumbs .fontSize a.small").click(function () {   
    $("body").css("font-size","11px");                    
    $.cookie(cookieName, "11px", cookieOptions);
    return false;
  });
  
  //set medium font 
  $(".topBreadcrumbs .fontSize a.medium").click(function () {   
    $("body").css("font-size","13px");             
    $.cookie(cookieName, "13px", cookieOptions);
    return false;
  }); 

  //set big font              
  $(".topBreadcrumbs .fontSize a.big").click(function () {   
    $("body").css("font-size","15px");            
    $.cookie(cookieName, "15px", cookieOptions);
    return false;
  });   
    
    
  // show and hide search input value
  $("input[name='phrase']").focus(function (){ 
    if($("input[name='phrase']").val()=="Szukaj..."){
      $("input[name='phrase']").val("");
    }
  });
  
  $("input[name='phrase']").blur(function (){
    if($("input[name='phrase']").val()==""){
      $("input[name='phrase']").val("Szukaj...");
    }
  });   
      
  // show and hide newsletter input value
  $("input[name='email']").focus(function (){ 
    if($("input[name='email']").val()=="Adres e-mail..."){
      $("input[name='email']").val("");
    }
  });
  
  $("input[name='email']").blur(function (){
    if($("input[name='email']").val()==""){
      $("input[name='email']").val("Adres e-mail...");
    }
  });                     
                                   
                                   
  // change hr to div
  $(".content hr").after('<div class="hrSeparator"></div>').remove();
  
  $(".faqList ul li .open").hide();     
                    
  // open and close faq
  $(".faqList ul li .close a").click(function () {                       
    $(this).parents('div.close').fadeOut('slow' ,function(){
      $(this).next('div.open').fadeIn('slow', function(){});
    });
    return false;
  });    
  
  $(".faqList ul li .open a.closeWindow").click(function () {                       
    $(this).parents('div.open').fadeOut('slow' ,function(){
      $(this).prev('div.close').fadeIn('slow', function(){});
    });     
    return false;
  });
          
  // scroll gallery
  $(".scrollBox").jCarouselLite({
    btnNext: ".next",
    btnPrev: ".prev",
    vertical: false,
    circular: false,
    speed: 1000,
    visible: 3
  });
  
  $(".scrollBox a").fancybox({
    overlayColor : "#FFFFFF",
    overlayOpacity : 0.9
  }); 
              
  var bc_first = $(".topBreadcrumbs ul li.first a");
  if (bc_first.html()) {
	$(bc_first).html($(bc_first).html().toUpperCase());
	}	
	
  if($(".searchResultPagination").length>0){
    var spanList = $(".searchResultPagination span");
    var spanWidth = 0;
    spanList.each(function() {
      spanWidth += $(this).outerWidth();
    }); 
              
    var liList = $(".searchResultPagination ul li");
    var liWidth = 0;
    liList.each(function() {
      liWidth += $(this).outerWidth();     
    });   
      
    $(".searchResultPagination .fixAlign").css({'padding-left' : (703-spanWidth-liWidth)/2}); 
  }
  
  // --------------------------------------------------- form transform
	$('form').jqTransform({imgPath:'/img/'});
	
	// ------------ admin add form validate
	$('form.contactForm').validate();     
	
  // --------------------------------------------------- style table
	$('.wysiwyg table').before('<div class="tableTopBkg"></div>');
	$('.wysiwyg table').after('<div class="clearfix"></div><div class="tableBttomBkg"></div>');
	$('.wysiwyg table').wrap('<div class="tableRepeatBkg"></div>'); 
	$('.wysiwyg table').removeAttr('align');
	
	$("#footer ul.subMenu li:last-child")
		.addClass('last');  
	              
	$(".mainPage ul li a, .mainPage ul li h2")
    .mouseover(function(){
  	  $(this).parents('li').find('a.more').css('text-decoration', 'underline');
  	})
    .mouseout(function(){
      $(this).parents('li').find('a.more').css('text-decoration', 'none');
    });
               
});

  var BreuerText = {src: '/pl/public/swf/sifr.swf'};
    
  sIFR.activate(BreuerText);
  
    sIFR.replace(BreuerText, {
      selector: '.phoneContact span span'
      ,wmode: 'transparent'
      ,css: [
        '.sIFR-root { font-weight: bold; color: #003c84; font-size:30px; text-align:left;}' 
      ]
    });  
    
    sIFR.replace(BreuerText, {
      selector: '.phoneContact strong.sub '
      ,wmode: 'transparent'
      ,css: [
        '.sIFR-root { font-weight: normal; color: #2d2d2d; font-size:14px; text-align:center;}' 
      ]
    });  
    
    sIFR.replace(BreuerText, {
      selector: '.phoneContact strong.main, .mainContentPage .grupa_lm_oferta ul li'   
      ,wmode: 'transparent'
      ,css: [
        '.sIFR-root { font-weight: normal; color: #2d2d2d; font-size:24px; text-align:center;}'
        ,'a { text-decoration: none; color:#2d2d2d; text-decoration:underline;}'
        ,'a:link { color: #2d2d2d; text-decoration:none;}'
        ,'a:hover { color: #2d2d2d; text-decoration:underline;}'  
      ]
    });  
    
    sIFR.replace(BreuerText, {
      selector: '.mainContentPage .aboutOfficeText .head h4'
      ,wmode: 'transparent'
      ,css: [
        '.sIFR-root { font-weight: normal; color: #2d2d2d; font-size:22px;}' 
      ]
    });  
    
    sIFR.replace(BreuerText, {
      selector: '.subContentPage ul li.inner span'
      ,wmode: 'transparent'
      ,css: [
        '.sIFR-root { font-weight: normal; color: #2d2d2d; font-size:14px;}'    
        ,'a { text-decoration: none; color:#2d2d2d; text-decoration:underline;}'
        ,'a:link { color: #2d2d2d; text-decoration:none;}'
        ,'a:hover { color: #2d2d2d; text-decoration:underline;}'
      ]
    });   
    
    sIFR.replace(BreuerText, {
      selector: '.subContentPage ul li span'
      ,wmode: 'transparent'
      ,css: [
        '.sIFR-root { font-weight: normal; color: #2d2d2d; font-size:17px;}'    
        ,'a { text-decoration: none; color:#2d2d2d; text-decoration:underline;}'
        ,'a:link { color: #2d2d2d; text-decoration:none;}'
        ,'a:hover { color: #2d2d2d; text-decoration:underline;}'
      ]
    });   
    
    sIFR.replace(BreuerText, {
      selector: '.mainContentPage h2'
      ,wmode: 'transparent'
      ,css: [
        '.sIFR-root { font-weight: normal; color: #2d2d2d; font-size:26px;}'   
      ]
    });     
     
    sIFR.replace(BreuerText, {
      selector: '.mainPage ul li h2'
      ,wmode: 'transparent'
      ,css: [
        '.sIFR-root { font-weight: normal; color: #1d1d1d; font-size:26px;}' 
        ,'a { text-decoration: none; color:#2d2d2d; text-decoration:none;}'
        ,'a:link { color: #2d2d2d; text-decoration:none;}'
        ,'a:hover { color: #2d2d2d; text-decoration:none;}'  
      ]
    });
              
    
    sIFR.replace(BreuerText, {
      selector: '.top .navMenu ul li span'
      ,wmode: 'transparent'
      ,css: [
        '.sIFR-root { font-weight: normal; color: #2d2d2d; font-size:14px;}'    
        ,'a { text-decoration: none; color:#2d2d2d; text-decoration:underline;}'
        ,'a:link { color: #2d2d2d; text-decoration:none;}'
        ,'a:hover { color: #2d2d2d; text-decoration:underline;}'
      ]
    });    
                 
    sIFR.replace(BreuerText, {
      selector: '.content  h3'
      ,wmode: 'transparent'
      ,css: [
        '.sIFR-root { font-weight: normal; color: #1d1d1d; font-size:26px;}'
      ]
    });      
    
    sIFR.replace(BreuerText, {
      selector: '.mainSectorPage .sectorBoxMenu ul li strong'
      ,wmode: 'transparent'
      ,css: [
        '.sIFR-root { font-weight: normal; color: #c65901; font-size:18px;}' 
        ,'a { text-decoration: none; color:#303031; text-decoration:underline;}'
        ,'a:link { color: #303031; text-decoration:none;}'
        ,'a:hover { color: #303031; text-decoration:none;}'
      ]
    });
    
    
