function mainmenu(){
//	$("ul.topnav").css({display: "none"}); // Opera Fix
	$("ul.topnav li").hover(function(){
		//$(this).find('ul:first').css({visibility: "visible",display: "none"}).show();
		$(this).find('ul:first').show();
	},function(){
		//$(this).find('ul:first').css({visibility: "hidden"}).slideUp();
		$(this).find('ul:first').hide();	
	});
}

$(document).ready(function(){
	mainmenu();
	$("a.grouped_elements").fancybox();
	$('a[rel*=facebox]').facebox();
	
	/* send form
	----------------------------------*/
	$("#sendContactfrm").live("click",function(b)
	{
		b.preventDefault();

		var send = true;
		
		if(send==true)
		{
			$.post("/send_contact_form.php", $("#subForm").serialize(),
				function(data){

				}, 
			"json");

			setTimeout(function() {
				$("#subForm").submit();
			}, 2000);

		}
	});
	
	$('a[class~="deseable"]').live("click",function(b){
		b.preventDefault();
	});
	
	jQuery('#mycarousel').jcarousel({scroll: 4,});
	
	/* gallery product */
	
	$(".jcarousel-item").live("click",function(b)
	{
		b.preventDefault();
		var new_img = $(this).children().attr('src');
		$('#imgGallery .container #IMG_SRC').attr('src',new_img);
	});
	
	$("#toggle_description").live("click",function(b)
	{
		b.preventDefault();
		$('#description').slideToggle('slow', function() {
			// Animation complete.
		});
	});
	
	$(".jcarousel-item").mouseover(function(){
		var elem = $(this).children();
		elem.addClass('opacity-60');
	}).mouseout(function(){
		var elem = $(this).children();
		elem.removeClass('opacity-60');
	});
	
	$(document).bind('facebox', function() {
		var height = $(window).height();
		$('#facebox .container-popup').css('max-height', height + 'px');
		$('#facebox').css('top', ($(window).scrollTop()+10) + 'px');
	});
	
});
