function showLangMenu(){
	
}function hideLangMenu(){
	
}
$(function(){
	$('.langMenu div').hide(0);		
	$('.langMenu div.selected').show(0);		
	$('.langMenu').hover(function(){
			$('.langMenu div').show(500);
		}, function(){
			$('.langMenu div').not('.langMenu div.selected').hide(500);
		});		
		
	$('.siteMenu .sMenu').hide(0);		
	//$('.siteMenu .sMenu').mouseleave(function(){$(this).hide(500)});		
	/* $('.siteMenu .item.open').mouseleave(function(){
			$('.siteMenu .item.open .sMenu').hide(500);
			$('.siteMenu .item.open').addClass('closed');
			$('.siteMenu .item.open').removeClass('open');
		}); */		
	$('.siteMenu .item').addClass('closed');
	$('.siteMenu .item').hover(function(){
			if($(this).hasClass('closed')){
				$('.siteMenu .item.open').not(this).addClass('close');
				$('.siteMenu .item.opening').not(this).addClass('close');
				$('.siteMenu .item.opening').not(this).removeClass('opening');
				//$('.siteMenu .item').not(this).addClass('close');
				$(this).removeClass('closed');
				$(this).addClass('opening');
				$('.siteMenu .item.close .sMenu').hide(500, function(){
						$('.siteMenu .item.close').addClass('closed');
						$('.siteMenu .item.close').removeClass('close');
					});
				$('.siteMenu .item.opening .sMenu').show(500, function(){
						$('.siteMenu .item.opening').addClass('open');
						$('.siteMenu .item.opening').removeClass('opening');
						$('.siteMenu .item.open').mouseleave(function(){
								$('.siteMenu .item.open .sMenu').hide(500);
								$('.siteMenu .item.open').addClass('closed');
								$('.siteMenu .item.open').removeClass('open');
							});	
					});
	// 			alert('test');
				//$(this)('.sMenu').show(500);
//				$(this).parentNode.mouseleave(function(){$(this)}).hide(500);
			}
			
		});		
	
});
var initPageDone = false;
var home_news_act = false;
var timeoutShowNext = null;
$(document).ready(function(){
	if(initPageDone)return;
	initPageDone=true;
	$("#home_newslist").append('<div id="home_news_pagination"></div>')
	$("#home_newslist").css({'position':'relative'});
	$("#home_news_pagination").css({'position':'absolute', 'bottom':0, 'right':0, 'z-index':2});
	$("#home_newslist .news").each(function(index){
		if($(this).parent().height()<$(this).height()){
			$(this).parent().css({'height' : $(this).height()+"px" });
		}
		$(this).fadeOut(0).hide();
		$("#home_news_pagination").append('<a href="javascript:void(0);" id="home_news_pagination_'+index+'" onclick="newsShow('+index+');">'+(index+1)+'</a>');
	});
	$("#home_newslist .news:first-child").show();
	$("#home_news_pagination_0").addClass("selected");
	if($("#home_newslist .news").length>0){
		home_news_act = 0;
		timeoutShowNext = setTimeout("newsShowNext()", 8000);
		
	}
	
	
	$("#index_page_topslider").hide();
	topSliderHTML = $("#index_page_topslider").html();
	if(topSliderHTML!= null && topSliderHTML!=''){
		$("#index_page_topslider").html('<div class="wrapper"></div>');
		// $("#index_page_topslider").html('');
		$("#index_page_topslider").show();
		$("#index_page_list "+topSliderHTML).each(function (index){
		
			link = $("a", this).first().attr("href");
			sliderItemHTML = '';
			sliderItemHTML += '<div id="topsliderItem_'+index+'" class="topsliderItem">';
			
			
			sliderItemHTML += '<a href="'+link+'" id="topsliderItemImgLink_'+index+'">';
			sliderItemHTML += '</a>';
			
			sliderItemHTML += '<a href="'+link+'">';
			sliderItemHTML += $("h3 a", this).first().html();;
			sliderItemHTML += '</a>';
			
			
			sliderItemHTML += '</div>';
			$("#index_page_topslider .wrapper").append(sliderItemHTML);
			// $("#index_page_topslider").append(sliderItemHTML);
			
			imgObj = $("img", this).first().clone().appendTo('#topsliderItemImgLink_'+index);
			
			if($("#index_page_topslider").height() < $('#topsliderItem_'+index).height()){
				$("#index_page_topslider").css({'height':$('#topsliderItem_'+index).height()+"px"});
			}
			//$("#index_page_topslider .wrapper").css({'width':$('#topsliderItem_'+index).height()+"px"});
			
		});
		
	}
	

	//create scroller for each element with "horizontal_scroller" class...
	if($('#index_page_topslider').length>0)
	$('#index_page_topslider').SetScroller({	
		velocity: 	 70,
		direction: 	 'horizontal',
		startfrom: 	 'right',
		loop:		 'infinite',
		movetype: 	 'linear',
		onmouseover: 'pause',
		onmouseout:  'play',
		onstartup: 	 'play',
		cursor: 	 'pointer'
	});
	
	/* $(".prodIndex .ui-tabs-panel .item").each(function(index){
		if($(this).outerHeight(true)>intval($(this).parent().css("line-height"))){
			$(this).parent().css({"line-height": $(this).outerHeight(true)});
		}
	}); */
		
});

function newsShowNext(){
	home_news_act++;
	if(home_news_act>=$("#home_newslist .news").length){
		home_news_act=0;
	}
	newsShow();
}
function newsShow(){
	if(newsShow.arguments.length>0)
		home_news_act=newsShow.arguments[0];
	if(timeoutShowNext!=null){
		clearTimeout(timeoutShowNext);
		timeoutShowNext = null;
	}
	$("#home_newslist .news:visible").fadeOut("slow", function(){
		$("#home_news_pagination a.selected").removeClass("selected");
		$("#home_newslist .news").each(function(index){
			if(index == home_news_act){
				$("#home_news_pagination_"+home_news_act).addClass("selected");
				$(this).show().fadeIn("slow", function(){
					timeoutShowNext = setTimeout("newsShowNext()", 8000);
				});
			}
		});
	
	});
	
}
/* 
function repeat(str, n) {
  return new Array( n + 1 ).join( str );
}
(function ($) {
	$.fn.myPlugin = function () {
		return this.each(function () {
		  // plugin code
			var $wrapper = $('> div', this).css('overflow', 'hidden'),
			$slider = $wrapper.find('> ul'),
			$items = $slider.find('> li'),
			$single = $items.filter(':first'),

			// outerWidth: width + padding (doesn't include margin)
			singleWidth = $single.outerWidth(), 

			// note: doesn't include padding or border
			visible = Math.ceil($wrapper.innerWidth() / singleWidth), 
			currentPage = 1,
			pages = Math.ceil($items.length / visible);   
			
			
			if (($items.length % visible) != 0) {
				$slider.append(repeat('<li class="empty" />', visible - ($items.length % visible)));
				$items = $slider.find('> li');
			}
			
			$items.filter(':first').before($items.slice(-visible).clone().addClass('cloned'));
			$items.filter(':last').after($items.slice(0, visible).clone().addClass('cloned'));
			$items = $slider.find('> li'); // reselect
			
			$items.slice(-visible);
			
			
			$wrapper.scrollLeft(singleWidth * visible);
		};
	};
})(jQuery); */
