var hs;
$(function() {
  $('#ask_quest').toggle(
		function(event) {
			$('#frm_quest').show(); 
			ScrollToElement($('#frm_quest'))
		},
		function(event) {$('#frm_quest').hide();}
  );
  
 	$("#mycarousel").jcarousel({
    scroll: 3
  });
	$('#mycarousel LI:first').css('border-bottom','solid 5px red').css('padding-bottom','3px');
	$('.jcarousel-clip LI').hover(
		function(event) {$(this).css('background','#eee')},
		function(event) {$(this).css('background','#fff')}
	)
	$('.jcarousel-clip IMG').each(
		function(event) {
			var h = $(this).height();
			if (h > 0) {$(this).css('margin-top',Math.max(Math.floor((60 - h)/2), 0)+'px');} 
		}
	)
  
  if($.browser.msie){
  	$('#mycarousel').width('1000');
		if ($("#picture").width() > 180) {$("#picture").width(180)};
		if ($(".jcarousel-list-horizontal IMG").height() > 60) {$("#picture").width(180)};
		$(".jcarousel-list-horizontal IMG").each(
			function(event) {
				if ($(this).height()>60) {$(this).height(60);}
			}
		)
  }
})

//-- ÑÌÅÍÀ ÊÀÐÒÈÍÊÈ Â ÊÀÐÒÎ×ÊÅ ÒÎÂÀÐÀ ------------------------
function Chahge_Picture(img,src,href) {
	$('#mycarousel LI').css('border-bottom','solid 3px #c9c9c9').css('padding-bottom','5px');
	$(img).parents('LI').css('border-bottom','solid 5px red').css('padding-bottom','3px');
	
	$('#picture').attr('src','products_pictures/' + src);
  
	if (href) {
		$('#picture').parents('A').attr('href','products_pictures/' + href).addClass('highslide')
								 .click(function () {
						    	 return hs.expand(this);
						  	 });
	} else {
		$('#picture').parents('A').removeAttr('href').removeClass('highslide').unbind('click');
	};
}
//-- ÏÐÎÊÐÓ×ÈÂÀÍÈÅ ÑÊÐÎËËÅÐÀ ×ÓÒÜ ÂÛØÅ ÇÀÄÀÍÍÎÃÎ ÝËÅÌÅÍÒÀ -----------------------
function ScrollToElement(el) {
	el_top = $(el).offset().top - 100; 
	$('html').animate({scrollTop: el_top}, 10);
}
//-- ÏÎÄÊËÞ×ÅÍÈÅ highslide ÄËß ÁËÎÊÀ Ñ ÌÅÄÈÀ ------------------------
function HSMediaInit() {
  _HSOpen();
  $('.hs_media').click(function () {
    return hs.htmlExpand(this, { anchor: 'right' });
  });
}
//-- ÏÎÄÊËÞ×ÅÍÈÅ highslide ------------------------
function HSInit() {
  _HSOpen();
  $('.highslide').click(function () {
    return hs.expand(this);
  });
}
//-- ÎÁÚßÂËÅÍÈÅ highslide------------------------
function _HSOpen() {
  hs.graphicsDir = '/promsoft/lib/highslide/graphics/';
  hs.transitions = ['expand', 'crossfade'];
  hs.outlineType = 'rounded-white';
  hs.fadeInOut = true;
}
//--------------------------


