// JavaScript Document


jQuery(function(){
	jQuery(".ulMenu > li").not("[@class='active']")
	.mouseover(function(){
		jQuery(this).stop().animate({backgroundPosition:"95px 0px",opacity:"50%"}, {duration:400})
		jQuery(this).addClass("active");
		
	})
	.mouseout(function(){
		jQuery(this).stop().animate({backgroundPosition:"0px 0px",opacity:"100%"}, {duration:400})
		jQuery(this).removeClass("active");
	})
	
	
	// news ticker
	var delayTime=5000;
	var duration=1000;
	var liHeight=20;	// px
	var liCount=jQuery(".news ul li").size();
	var liMaxTop="-"+(liHeight*(liCount-1))+"px";
	
	function newsScroller()
	{
		jQuery(".news ul").animate({marginTop:"-=20px"},
			   duration,
				 function(){
					 if(jQuery(this).css("marginTop")==liMaxTop) jQuery(this).animate({marginTop:"0px"},duration).animate({marginTop:"-=0px"},delayTime);	
					 newsScroller();
				} 
				).animate({marginTop:"-=0px"},delayTime);
	
	}
	newsScroller();
	// expand form 
	jQuery("#expandForm").click(function()
	{
			
			if (jQuery(this).attr("class")=="expandForm")
			{			
				jQuery(this).html("Hide Form").removeClass().addClass("collapseForm");
				jQuery(this).parent().stop().animate({height:"590px"}, {duration:400})
			}
			else
			{			
				jQuery(this).html("Click here now").removeClass().addClass("expandForm");; 
				jQuery(this).parent().stop().animate({height:"290px"}, {duration:400})
			}
	});
	
	// accordion
	
	// add bullets
	jQuery(".accordion > li").each(function(i)
	{
		jQuery(this).find("a").prepend("<span class='bullet'></span>");
	});
	
	
	// click
	jQuery('.accordion').accordion({
			event: 'click',
			autoHeight:true,
			selectedClass:"active",
			animated:'bounceslide',
			autoheight: false
		});
		
		
 
 	
	// onclick show information
	jQuery(".products li").click(function()
	{
		jQuery(".products_description").fadeOut().html(jQuery(this).find(".content").html()).fadeIn();
		jQuery("#products_image").fadeOut().attr("src",jQuery(this).find(".content").attr("title")).fadeIn();
	});
	
	
	
	
	// script for carousel
	jQuery(".products").scrollable(
	{
			size:3, 
			speed:800,
			interval:5000,
			loop:true,
			
			onBeforeSeek: function() { 
				this.getItems().fadeTo(300, 0.5);         
			}, 
			onSeek: function() { 
				this.getItems().fadeTo(300, 1);  
			}
	});
	
	

});
