
hs.graphicsDir = '/usr/system/plugins/highslide-html/graphics/';
/*hs.showCredits = false;
hs.dimmingOpacity = 0.7;
hs.align = 'center';
hs.captionEval = 'this.a.title';
var lang="ru";

hs.registerOverlay({
	html: '<div class="close-simple-white" onclick="return hs.close(this)" title="Закрыть"></div>',
	position: 'top right',
	useOnHtml: true,
	fade: 2 // fading the semi-transparent overlay looks bad in IE
});
*/

hs.showCredits = false;
hs.outlineType = null;
hs.dimmingOpacity = 0.75;
hs.fadeInOut = true;
hs.align = 'center';
hs.captionEval = 'this.a.title';
hs.registerOverlay({
	html: '<div class="closebutton" onclick="return hs.close(this)" title="Close"></div>',
	position: 'top right',
	useOnHtml: true,
	fade: 2 // fading the semi-transparent overlay looks bad in IE
});



// Add the slideshow controller
hs.addSlideshow({
	slideshowGroup: 'group1',
	interval: 5000,
	repeat: false,
	useControls: true,
	fixedControls: 'fit',
	overlayOptions: {
		className: 'large-dark',
		opacity: '0.75',
		position: 'bottom center',
		offsetX: '0',
		offsetY: '-10',
		hideOnMouseOut: true
	}
});

// Add the slideshow controller
hs.addSlideshow({
	slideshowGroup: 'group2',
	interval: 5000,
	repeat: false,
	useControls: false,
	fixedControls: 'fit',
	overlayOptions: {
		className: 'large-dark',
		opacity: '0.75',
		position: 'bottom center',
		offsetX: '0',
		offsetY: '-10',
		hideOnMouseOut: true
	}
});

// gallery config object
var config1 = {
	slideshowGroup: 'group1',
	transitions: ['expand', 'crossfade']
};

hs.slideshowGroup='group1';
hs.transitions=['expand', 'crossfade'];


var top_menu_anim_duration=250;
var sl_speed=500;
var sl_timeout=5000;
var sl_speed_fout=300;

$(document).ready(function() {
   if ($("#slide").length) 
   {
      $(".cycle a").addClass('highslide');
      $(".cycle").each(function () {
         var n=parseInt($(this).parent().attr('id').substring(1));
         var st=0;
         if (n==2) st=0;
         if (n==3) st=$(this).find("a").length-1;
         if (n==1) st=1;
         $(this).cycle({
          fx:     'scrollHorz', 
          speed:   sl_speed,
          timeout: sl_timeout,
          startingSlide: st,
          selector: '',
          //continuous: true,
          fit: false,
          next: ".sr",
          prev: ".sl",
          after: function () {
          },
          before: function (currSlideElement, nextSlideElement, options, forwardFlag) {
             var img=$(nextSlideElement).find("img");
             var sp=$("#s"+n).find(".go_site").find("span");
             if (!sp.html()) 
             {
               sp.html(img.attr('title'));
               sp.parent().attr('href', img.attr('href'));
               sp.parent().attr('target', '_blank');
               return;
             }
             sp.fadeOut(sl_speed_fout, function () {
                sp.html(img.attr('title'));
                sp.parent().attr('href', img.attr('href'));
                //alert(sp.parent().parent().html());
                sp.fadeIn(sl_speed_fout, function () {
                   if ($.browser.msie) this.style.removeAttribute('filter');
                }); 
             });
             //alert($("#s"+n).find(".go_site").html());
          }
         });
      });
   }
   
   $("#mh ul li").hover(function () {
      $(this).find("i").animate({
         height: 86
      }, {
         duration: top_menu_anim_duration,
         queue: false
      });
   },
   function () {
      if ($(this).hasClass('act')) return;
      $(this).find("i").animate({
         height: 10
      }, {
         duration: top_menu_anim_duration,
         queue: false
      });
   })
});


// contacts

$(document).ready(function () {
   $("a.highslide").click(function() {
      return hs.expand(this, {slideshowGroup: 'group2'});
   });
   $("input[type=button]").each(function () {
      if ($(this).attr('href')) {
        $(this).click(function () {
           window.location.href=$(this).attr('href');
        });
      }
   });
   if ($.validationEngine) {
      $(".valForm").validationEngine({
         ajaxSubmit: true,
         ajaxSubmitFile: $(".valForm").attr('action')
      });
   }
});
