var metas = document.getElementsByTagName('meta');
for (var i = 0; i < metas.length; i++) if (metas[i].getAttribute('name') == 'base') break;
var URL =  metas[i].getAttribute('content');
/********************************************/

$().ready(function(){
//	$('.stars').hover(
//       function(){
//           $(this).find('label').removeClass('checked1 checked2 checked3 checked4 checked5');
//       },
//       function(){
//           checked = $(this).find('input:checked');
//           checked.parent().addClass('checked' + checked.val());
//       }
//    );
		
//	$('.stars label').hover(
//	   function(){
//	       $(this).addClass('hover'+$(this).children().val());
//	   },
//	   function(){
//	       $(this).removeClass('hover'+$(this).children().val());
//	   }
//	);
	
//	  $('.stars input:radio').click(function(){
//		$.ajax({
//		   type: "POST",
//		   url: URL+'modules/ext/ec_catalog/ajax/public.ajax.php',
//		   dataType: "text",
//		   data: "e=get_rating&c="+$(this).val()+"&Id="+$("#IdItem").val(),
//		   success: function(msg){  
//		   		$("#blockqualityLoad").hide();
//		   		$("#blockquality").html(msg).show();
//		   },
//		   error: function(responseObj){},
//		   beforeSend: function(){
//		   		$("#blockqualityLoad").show();
//		   		$("#blockquality").hide();
//		   }
//		 })
//		
////		$('.stars label').removeClass('checked1 checked2 checked3 checked4 checked5');
////	   $(this).blur().parent().addClass('checked' + $(this).val());
//	   
//	});
	

//	$("#alllist_d").scrollTo( 'li:eq(14)', 800 );
	//$.scrollTo("#alllist_d",'150', 800 );
	
	if($("#listitemSel").length != 0){
		$('#listItems').scrollTo("#listitemSel",2000,{over:{top:-15,easing:'elasout'}});
	}
	
//	$("#ADD_BOOKMARKS").load(URL+"classes/lib/lib_bokmarks.php");
	
//	$("#menu").tabs();

// $("div.scrollable").scrollable({vertical:true,size: 3}).mousewheel();   
 
 
	hs.graphicsDir = URL+'img/highslide/graphics/';
	
	hs.align = 'center';
	hs.transitions = ['expand', 'crossfade'];
	hs.outlineType = 'rounded-white';
	hs.fadeInOut = true;
	hs.dimmingOpacity = 0.25;
		
	hs.lang = {
	   loadingText :     'Загружается...',
	   loadingTitle :    'Нажмите для отмены',
	   focusTitle :      'Нажмите чтобы поместить на передний план',
	   fullExpandTitle : 'Развернуть до оригинального размера',
	   fullExpandText :  'Оригинальный размер',
	   creditsText :     '',
	   creditsTitle :    'Перейти на домашнюю страницу Highslide JS',
	   previousText :    'Предыдущее',
	   previousTitle :   'Предыдущее (стрелка влево)',
	   nextText :        'Следующее',
	   nextTitle :       'Следующее (стрелка вправо)',
	   moveTitle :       'Переместить',
	   moveText :        'Переместить',
	   closeText :       'Закрыть',
	   closeTitle :      'Закрыть (esc)',
	   resizeTitle :     'Изменить размер',
	   playText :        'Слайдшоу',
	   playTitle :       'Начать слайдшоу (пробел)',
	   pauseText :       'Пауза',
	   pauseTitle :      'Приостановить слайдшоу (пробел)',
	   number :          'Изображение %1 из %2',
	   restoreTitle :    'Нажмите чтобы закрыть изображение'
	};
	
	// Add the controlbar
	if (hs.addSlideshow){
		hs.addSlideshow({
			//slideshowGroup: 'group1',
			interval: 5000,
			repeat: false,
			useControls: true,
			fixedControls: 'fit',
			overlayOptions: {
				opacity: .75,
				position: 'bottom center',
				hideOnMouseOut: true
		}});
	}
});
/////////////////////////////////////////////////
//var oldSunId = "";

function openSub(id){
//	if(id == oldSunId) return false;
//	$("#"+oldSunId).slideUp();
	$("#"+id).slideToggle();
//	oldSunId = id;
	return false;
}



//////////////////////////////////////////////////

var oldDetId = "";

function displayDetails(id,obj){
	$.ajax({
	   type: "POST",
	   url: URL+'modules/ext/ec_catalog/ajax/public.ajax.php',
	   dataType: "html",
	   data: "e=get_details&Id="+id,
	   success: function(msg){  
	   		$("#det"+id).html(msg);
	   },
	   error: function(responseObj){ 
	   		$("#det"+id).html(responseObj.responseText);
	   },
	   beforeSend: function(){  
	   		$("#det"+id).html('Загрузка');
	   }
	 })
	var pos = $(obj).offset()
	$("#det"+oldDetId).hide();
 	$("#det"+id).css("top", pos.top).show();
	oldDetId = id;
}

function hideDetails(){
	$("#det"+oldDetId).hide();	
	return false;
}

function coreSubscribe(){
	$.ajax({
	   type: "POST",
	   url: URL+'modules/ext/subscribe/ajax/public.ajax.php',
	   dataType: "text",
	   data: "email="+$("#coreSubscribeInput").val(),
	   success: function(msg){  
	   		$("#coreSubscribeResult").html(msg);
	   },
	   error: function(responseObj){ 
	   		$("#coreSubscribeResult").html(responseObj.responseText);
	   },
	   beforeSend: function(){  
	   		$("#coreSubscribeResult").html('Обработка');
	   }
	 })
}
/*
$('.stars').hover(
   function(){
       $(this).find('label').removeClass('checked1 checked2 checked3 checked4 checked5');
   },
   function(){
       checked = $(this).find('input:checked');
       checked.parent().addClass('checked'+checked.val());
   }
);
*/
