


function toggleDefaultValue(selector, val){
  $(selector).focus(function(e){
    if($(this).val() == val){
      $(this).data('defaultValue', val);
      $(this).val("");
    }
  });
  $(selector).blur(function(e){
    if($(this).val() == ""){
      $(this).val($(this).data('defaultValue'));
      e.preventDefault();
    }
  });
}  


$(document).ready(function(){
  
  $('a[rel*=external]').click(function(e) {
    window.open(this.href);
    return false;
  });
  
  /*
  $(".city_rank li").hover(
    function () {
      $(this).css({"backgroundColor":"#684674", "color":"#ffffff"});
    },
    function () {
      $(this).css({"backgroundColor":"#EAEAEA", "color":"#444446"});
    }
  );
  */
  
  $("#top- ul li").hover(
    function () {
      $(this).css({"backgroundColor":"#755181"});
    },
    function () {
      $(this).css({"backgroundColor":"#684674"});
    }
  );
  
  $("#top- ul li.active").hover(
    function () {
      $(this).css({"backgroundColor":"#755181"});
    },
    function () {
      $(this).css({"backgroundColor":"#755181"});
    }
  );

  $(".phone_app_info").hover(
    function () {
      $(this).css({'background-position' : '-247px 5px'});
    },
    function () {
      $(this).css({'background-position' : '0 5px'});
    }
  );
  
  
  
  if($("#ContestUserHashesEmail").length > 0)  
  {
    // toggleDefaultValue("#ContestUserHashesEmail", 'twój@email.com');
  }  
    
    
  if($("#ContestUserHashesSubmit").length > 0)  
  {
    $("#ContestUserHashesSubmit").click(function(){
//      var emailVal = $.trim($('#ContestUserHashesEmail').val());
//      if( emailVal == 'twój@email.com')
//      {
//        return false;
//      }
    });
  }  

  if($(".ad-gallery").length > 0)
  {
    //$('.gallery-container').css('display', 'none');
   // $('.gallery-container')[0].css('display', 'block');
    var galleries = $('.ad-gallery').adGallery({
      loader_image: '/pl/img/ad_gallery/loader.gif',
      width: 650, // Width of the image, set to false and it will read the CSS width
      height: 450, // Height of the image, set to false and it will read the CSS height
      thumb_opacity: 0.7, // Opacity that the thumbs fades to/from, (1 removes fade effect)
                          // Note that this effect combined with other effects might be resource intensive
                          // and make animations lag
      start_at_index: 0, // Which image should be displayed at first? 0 is the first image
      //description_wrapper: $('#descriptions'), // Either false or a jQuery object, if you want the image descriptions
                                               // to be placed somewhere else than on top of the image
      ad_info: false
    });
    
    $('.gallery-container').css('display', 'none');
    $($('.gallery-container')[0]).css('display','block');
    // Set image description
    // some_img.data('ad-desc', 'This is my description!');

    // Change effect on the fly
    // galleries[0].settings.effect = 'fade';  

    $('.city').click(function(event){
      //event.preventDefault();
      $('.gallery-container').css('display', 'none');
      if($(this).hasClass('gdansk'))
      {
        $('#gallery-gdansk').css('display','block');
      }  
      if($(this).hasClass('wroclaw'))
      {
        $('#gallery-wroclaw').css('display','block');
      }
      if($(this).hasClass('nowy-sacz'))
      {
        $('#gallery-nowy-sacz').css('display','block');
      }
      if($(this).hasClass('zamosc'))
      {
        $('#gallery-zamosc').css('display','block');
      }
      if($(this).hasClass('lublin'))
      {
        $('#gallery-lublin').css('display','block');
      }
      if($(this).hasClass('zielona-gora'))
      {
        $('#gallery-zielona-gora').css('display','block');
      }

      //window.location=window.location+'#gallery-anchor';
    });
    
  }
 
});    
    
  
    
    
