$(document).ready(function(){
  var root_url = 'http://vesnanaruzhka.com.ua/';
  
  $('#on_top').hover(function(){
    $(this).attr("src",root_url+"img/on_top_2.jpg");
  }, function(){
    $(this).attr("src",root_url+"img/on_top_1.jpg");
  });
  
  $('.block_link').hover(function(){
    $(this).css({'background-color':'#353535'});
  }, function(){
    $(this).css({'background-color':'#222222'});
  });

  if (!$('#news').html() && !$('#gall').html()){
    var t = 5000;
    $('.slideshow').cycle({
  		fx:      'scrollLeft', 
      speed:    1000, 
      timeout:  t
  	});

  	var i=1;
    var t = setInterval(function() {
      $("#bord_text").fadeOut("slow", function() {$(this).html($("#bord_text_"+i).html())});
      $("#bord_text").fadeIn("slow");
    	i++;
      if (i==8) i=1;
    }, t);
    
  	var w = screen.width;
    switch(w){
      case 1024:{
        $('#bord_text').css({'margin':'300px 0 0 75%'});
        break;
      }
      case 1280:{
        $('#bord_text').css({'margin':'300px 0 0 67%'});
        break;
      }
      case 1680:{
        $('#bord_text').css({'margin':'300px 0 0 63%'});
        break;
      }
      case 1920:{
        $('#bord_text').css({'margin':'300px 0 0 62%'});
        $('#hot').css({'width':'18%'});
        break;
      }
    }
  }
  
// Galary photo zoom
	if ($('a.customGal').length)
  $('a.customGal').zoomimage({
  	controlsTrigger: 'mouseover',
  	className: 'custom',
  	shadow: 40,
  	controls: false,
  	opacity: 1,
  	beforeZoomIn: function(boxID) {
  		$('#' + boxID)
  			.find('img')
  			.css('opacity', 0)
  			.animate(
  				{'opacity':1},
  				{ duration: 500, queue: false }
  			);
  	},
  	beforeZoomOut: function(boxID) {
  		$('#' + boxID)
  			.find('img')
  			.css('opacity', 1)
  			.animate(
  				{'opacity':0},
  				{ duration: 500, queue: false }
  			);
  	}
  });
/*
  if ($('#news').height() > $('content').height()){
    $('#middle').css('height',$('#news').height());
  } else {
    $('#middle').css('height',$('#content').height()+20);
  }

  my_url = window.location;
  my_url = my_url.toString();
  if (my_url.indexOf("news") != -1){
    $('#news').css('display','none');
    $('#content').css('width','99%');
  }

  IE='\v'=='v';
  if (IE){
    DD_belatedPNG.fix('*');
  }

  $('.items').hover(function(){
    jQuery(this).css('border-bottom', 'solid 2px #FF7F50');
  }, function(){
    jQuery(this).css('border', 'none');
  });
  
  $('.revers').hover(function(){
    url = jQuery(this).attr('src');
    file = jQuery.url.setUrl(url).attr("file");
    spot = file.indexOf('.');
    name = file.substring(0,spot);
    jQuery(this).attr('src', '/img/gallery/'+name+'r.jpg');
  }, function(){
    url = jQuery(this).attr('src');
    file = jQuery.url.setUrl(url).attr("file");
    spot = file.indexOf('.');
    name = file.substring(0,spot-1);
    jQuery(this).attr('src', '/img/gallery/'+name+'.jpg');
  });*/
}); 
