function mainmenu(){
$(" #nav ul ").css({display: "none"}); // Opera Fix
$(" #nav>li").hover(function(){
		$(this).find('ul:first').css({visibility: "visible",display: "none"}).fadeIn('fast');
		$(this) .addClass( 'on');
		},function(){
		$(this).find('ul:first').css({visibility: "hidden"});
		$(this) .removeClass( 'on');
		});
}

 
 
 $(document).ready(function(){					
	mainmenu();
});


/*slide in enquiry panel*/


$(document).ready(function() {
	
	// Expand Panel
	$("#open").click(function(){
		$(".enquiry").slideDown("slow");	
	});	
	
	// Collapse Panel
	$("#close").click(function(){
		$(".enquiry").slideUp("slow");	
	});	
	
	$(".cancel").click(function(){
		$(".enquiry").slideUp("slow");	
		$("#toggle a").toggle();
	});		
	
	// Switch buttons from "Log In | Register" to "Close Panel" on click
	$("#toggle a").click(function () {
		$("#toggle a").toggle();
	});		
		
});


/*hover image fade in and fade out  */
$(document).ready(function () {

     $('.section').hover(
            function() {
				$(this).addClass("selected");
    			$(this).find('span').fadeIn('1000');
        },
     
        function() {
			$(this).removeClass("selected");
     		$(this).find('span').fadeOut('1000');            
    })
 
});


/*gallery ajax call*/
$(document).ready(function(){
		
	var content = $("#p_gallery");
	var contentbg = $(".bg");
    var sections = $('.view_product');
	var loading = $('.loading')
		content.hide();
		contentbg.hide();
		loading.hide();
		
	
	sections.click(function(){
	
	var idendity = $(this).attr('id');
   		content.hide();
		contentbg.hide();
		showLoading();
		content.load("gallery.php?id="+idendity+"", hideLoading);
	});

	//show loading bar
	function showLoading(){
		$(".loading")
			.css({visibility:"visible"})
			.css({opacity:"1"})
			.css({display:"block"})
		;
	}
	//hide loading bar
	function hideLoading(){
		loading.fadeTo(1000, 0);
		content.show();
		contentbg.show();
		
	};
	
	
	

});





