$(document).ready(function(){

$("a.gallery_link").live('click', function() {
		$(this).next("div.item_gallery").slideToggle();
		$(this).toggleClass("gal_sel")
	  }
	);
	
/*
$(".item_label").live('click', function() {
	$(this).parent().parent().toggleClass("item_sel");
	$(this).parent().parent().siblings("div").removeClass("item_sel");
});
*/
//tip
$(function(){
	$(".tip").tipTip({maxWidth: "250px", edgeOffset: -5, delay:100 });
});
$(".item").live('click', function() {
	$(this).parent().toggleClass("item_sel");
	$(this).parent().siblings("div").removeClass("item_sel");
});


$('.scroll_c').jScrollPane();

//Submenu
/*
$('.tl_a').hover(function () {
    $(this).next("div").stop().addClass('show').animate({ opacity: 1}, 500);
  },
  function () {
    $(this).next("div").stop().addClass('show').animate({ opacity: 0}, 500);
  }
);
*/
     $("a.tl_a").hover(function() { //When trigger is clicked...  
   
         $(this).parent().find("div.sub_menu").slideDown('fast').show(); //Drop down the subnav on click  
		 $(this).addClass("h_active");
         $(this).parent().hover(function() {  
         }, function(){  
             $('a.tl_a').removeClass("h_active");
			 $(this).parent().find("div.sub_menu").slideUp('fast'); //When the mouse hovers out of the subnav, move it back up  
		 });  
         }
);



//Ac http://www.slidesjs.com/
$(function(){
	$('#slides').slides({
		preload: true,
		preloadImage: 'loading.gif',
		effect: 'slide, fade',
		randomize: true,
		play: 5000,
		hoverPause: true,
		crossfade: true,
		slideSpeed: 500			
	});
});

//TOP Menu Accordion
   
     $("a.tl").hover(function() { //When trigger is clicked...  
   
         //Following events are applied to the subnav itself (moving subnav up and down)  
         $(this).parent().find("div.h_podmenu").slideDown(100).show(); //Drop down the subnav on click  
		 $(this).addClass("subhover");
			
         $(this).parent().hover(function() {  
         }, function(){  
             $('a.tl').removeClass("subhover");
			 $(this).parent().find("div.h_podmenu").slideUp(100); 
			
		 });  
   
         //Following events are applied to the trigger (Hover events for the trigger)  
         }
		 
); 

//TOP Menu Accordion
   
     $("a.tl").hover(function() { //When trigger is clicked...  
   
         //Following events are applied to the subnav itself (moving subnav up and down)  
         $(this).parent().find("div.sub").fadeIn(300).show(); //Drop down the subnav on click 
			//$(this).parent().addClass("subhover2");		 
         $(this).parent().hover(function() {  
         }, function(){
			$(this).parent().find("div.sub").fadeOut(300); 
		 });  
         }, function(){
			//$('w_sub').removeClass("subhover2");
		 }
); 
		 

setInterval("show()",1000);

});

function show() {
	$("a.fancybox").fancybox({
		'titlePosition'	: 'over'
	});
	$("a[rel='gal']").fancybox({
		'titlePosition'	: 'over'
	});
}
