//news scorrevoli
$(function() {   
$(".newsticker-jcarousellite").jCarouselLite({   
      vertical: true,
      hoverPause:true,
      visible: 2,
      auto:500,
      speed:2300  
    });   
});
//close video
$(document).ready(function(){
	$("#closeVideo").click(function(){
		$("#video").hide();
	})
	$("#openVideo").click(function(){
		$("#video").show();
	})
})
//and more in displayTab
$(document).ready(function(){
	$("#wrapMoreImg").parent().click(function(){
		if($("#wrapMoreImg").attr("src")!=="images/more_close.gif")
		{
			$("#wrapMoreImg").attr("src","images/more_close.gif");
			$("#wrap").css("height", "auto");
		}else{
			$("#wrapMoreImg").attr("src","images/more_open.gif");
			$("#wrap").css("height", "40px");
		}
	})
})

//turn images in dislplayTab 
$(document).ready(function(){
	if($("#pro").length>0)
	{
		var curImgNum=0;
		var maxImgNum=proimg.length;
		if(maxImgNum<=1)
		{
			return false;
		}
		$("#turnright").click(function(){
			curImgNum++;
			if(curImgNum>=maxImgNum)
			{
				curImgNum=0;
			}
			$("#pro").attr("src","uploadfile/"+proimg[curImgNum]);
		})
		$("#turnleft").click(function(){
			curImgNum--;
			if(curImgNum<0)
			{
				curImgNum=maxImgNum-1;
			}
			$("#pro").attr("src","uploadfile/"+proimg[curImgNum]);
		})
	}
})

//box leftmenu in home
$(document).ready(function(){
	$("#prodotti dt.title-menu").click(function(){
		$(this).parent().parent().children().children("dt.title-menu").removeClass("title-menu2").nextAll().hide();
//		$(this).addClass("title-menu2");
		$(this).nextAll().show();
		$("img[arrow=blue]").attr( 'src', 'images/right_blue.gif');
		$(this).children("img[arrow=blue]").attr('src','images/down_blue.gif');
	})
	$("#prodotti dt[open]").nextAll().show();//当前类别状态
})

//box abbigliamento in home
$(document).ready(function(){
				$(".TabbedPanelsTabGroup").children().click(function(){
					$(".TabbedPanelsContent").hide().eq($(this).parent().children().attr( "class", "TabbedPanelsTab").length-$(this).nextAll().length-1).show();
					$(this).attr( "class", "TabbedPanelsTabSelected")
				})
				//To switch directions up/down and left/right just place a "-" in front of the top/left attribute
				//Vertical Sliding
				$('.boxgrid.slidedown').hover(function(){
					$(".cover", this).stop().animate({top:'-260px'},{queue:false,duration:300});
				}, function() {
					$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:300});
				});
				//Horizontal Sliding
				$('.boxgrid.slideright').hover(function(){
					$(".cover", this).stop().animate({left:'325px'},{queue:false,duration:300});
				}, function() {
					$(".cover", this).stop().animate({left:'0px'},{queue:false,duration:300});
				});
				//Diagnal Sliding
				$('.boxgrid.thecombo').hover(function(){
					$(".cover", this).stop().animate({top:'260px', left:'325px'},{queue:false,duration:300});
				}, function() {
					$(".cover", this).stop().animate({top:'0px', left:'0px'},{queue:false,duration:300});
				});
				//Partial Sliding (Only show some of background)
				$('.boxgrid.peek').hover(function(){
					$(".cover", this).stop().animate({top:'90px'},{queue:false,duration:160});
				}, function() {
					$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:160});
				});
				//Full Caption Sliding (Hidden to Visible)
				$('.boxgrid.captionfull').hover(function(){
					$(".cover", this).stop().animate({top:'160px'},{queue:false,duration:160});
				}, function() {
					$(".cover", this).stop().animate({top:'260px'},{queue:false,duration:160});
				});
				//Caption Sliding (Partially Hidden to Visible)
				$('.boxgrid.caption').hover(function(){
					$(".cover", this).stop().animate({top:'160px'},{queue:false,duration:160});
				}, function() {
					$(".cover", this).stop().animate({top:'220px'},{queue:false,duration:160});
				});
			});



//box slide in home
$(document).ready(function() {
    var curPage = 1;
    var maxPage = 5;
    var width = 914;
    var height = 328;
    $('ul.scrollbtns li a').click(function(){
        curPage = parseInt($(this).text());
        LoadNewBanner();
        return false;
    });
    $('#leadFeature .scrollLeft').click(function(){
        curPage -= 1;
        LoadNewBanner();
        return false;
    });
    $('#leadFeature .scrollRight').click(function(){
        curPage += 1;
        LoadNewBanner();
        return false;
    });
    function LoadNewBanner(){
     var oldPage = curPage;
     if(curPage < 1) {
        curPage = maxPage;
     } 
     else if(curPage > maxPage) {
        curPage = 1;
     }
     var speed = parseInt(Math.abs(curPage - oldPage) * 5000);
     speed += '';
     $('#leadFeature .frame .hold').animate({marginTop: -((curPage - 1) * height) + "px"}, speed, function() {
        for(var x=1; x<=maxPage; x++){
           $('#leadFeature ul.scrollbtns .a' + x).attr('class','a' + x);
        }
        $('#leadFeature ul.scrollbtns .a' + curPage).attr('class','a' + curPage + ' on');
        $('#leadFeature ul.scrollbtns .a' + curPage).attr('class','a' + curPage + ' on');
     });
    }
//	setInterval("$('#leadFeature .scrollRight').click()",5000);//自动翻页
//	function autoScroll()
//	{
//		alert("ss");
//        curPage += 1;
//        LoadNewBanner();
//		var t=setTimeout("autoScroll()",1000);
//	}
//	autoScroll();
//	function text(obj)
//	{
//		alert(obj);
//		setTimeout("test('"+ obj +"')",1000);
//	}
//	text(2);
});




/*********************
//* jQuery Multi Level CSS Menu #2- By Dynamic Drive: http://www.dynamicdrive.com/
//* Last update: Nov 7th, 08': Limit # of queued animations to minmize animation stuttering
//* Menu avaiable at DD CSS Library: http://www.dynamicdrive.com/style/
*********************/

//Specify full URL to down and right arrow images (23 is padding-right to add to top level LIs with drop downs):
var arrowimages={down:['downarrowclass', 'images/down.gif', 23], right:['rightarrowclass', 'images/right.gif']}

var jqueryslidemenu={

animateduration: {over: 20, out: 200}, //duration of slide in/ out animation, in milliseconds

buildmenu:function(menuid, arrowsvar){
	jQuery(document).ready(function($){
		var $mainmenu=$("#"+menuid+">ul")
		var $headers=$mainmenu.find("ul").parent()
		$headers.each(function(i){
			var $curobj=$(this)
			var $subul=$(this).find('ul:eq(0)')
			this._dimensions={w:this.offsetWidth, h:this.offsetHeight, subulw:$subul.outerWidth(), subulh:$subul.outerHeight()}
			this.istopheader=$curobj.parents("ul").length==1? true : false
			$subul.css({top:this.istopheader? this._dimensions.h+"px" : 0})
			$curobj.children("a:eq(0)").css(this.istopheader? {paddingRight: arrowsvar.down[2]} : {}).append(
				'<img src="'+ (this.istopheader? arrowsvar.down[1] : arrowsvar.right[1])
				+'" class="' + (this.istopheader? arrowsvar.down[0] : arrowsvar.right[0])
				+ '" style="border:0;" />'
			)
			$curobj.hover(
				function(e){
					var $targetul=$(this).children("ul:eq(0)")
					this._offsets={left:$(this).offset().left, top:$(this).offset().top}
					var menuleft=this.istopheader? 0 : this._dimensions.w
					menuleft=(this._offsets.left+menuleft+this._dimensions.subulw>$(window).width())? (this.istopheader? -this._dimensions.subulw+this._dimensions.w : -this._dimensions.w) : menuleft
					if ($targetul.queue().length<=1) //if 1 or less queued animations
						$targetul.css({left:menuleft+"px", width:this._dimensions.subulw+'px'}).slideDown(jqueryslidemenu.animateduration.over)
				},
				function(e){
					var $targetul=$(this).children("ul:eq(0)")
					$targetul.slideUp(jqueryslidemenu.animateduration.out)
				}
			) //end hover
		}) //end $headers.each()
		$mainmenu.find("ul").css({display:'none', visibility:'visible'})
	}) //end document.ready
}
}

//build menu with ID="myslidemenu" on page:
jqueryslidemenu.buildmenu("myslidemenu", arrowimages)





//animazione in evidenza
/*	window.onload = function()
	{
		var el = document.getElementById("chat");
		
		if (el)
			el.style.display = "block";
	}

*/


