$(document).ready(function(){
//form styleing
if($('.styled').length){
	$('form').jqTransform();}
//flieupload
if($('.filetoupload').length)
	$('.filetoupload').customFileInput();


if ($('.slider').length){
	var slider = $('.slider').bxSlider({
			mode:'fade',
			pause: 5000, 
			autoHover: true,
			auto:true,
			autoStart: true,
			pager:true,
			controls:false
		});

	var sl_w=$('.sliderbox').width();
	var bx_w=$('.bx-pager').width();
	var bx_margin=Math.floor((sl_w-bx_w)/2);
	$('.bx-pager').css('margin-left',bx_margin+'px');
}

if ($('.slider-small').length){
	var slider_small = $('.slider-small').bxSlider({
			mode:'fade',
			pause: 5000, 
			autoHover: true,
			auto:true,
			autoStart: true,
			controls:false
		});
}


if($('.item-detail').length){
	$('.item-detail').hide();
	var txt='';
	$('.read-more').click(function(){
		if ($(this).hasClass('detailsopened')){
			$(this).parent().find('.item-detail').hide();
			$(this).html(txt).removeClass('detailsopened');
		}
		else{
			txt=$(this).html();
			$(this).parent().find('.item-detail').show();
			$(this).addClass('detailsopened').html('Close');
		}
		return false;
	})
}

//top menu drop-down
	$('.menu .nav li').hover(
		function(){
			var li=$(this);
			li.children('ul').stop(true,true).slideDown(100,function(){
				li.children('a:first').addClass('opened');
			});
		},
		function(){
			var li=$(this);
			$(this).find('ul').fadeOut(10,function(){
				li.find('a:first').removeClass('opened');
			});
	})

$('.frmitem .jqTransformSelectWrapper').css('width','54px');


});
