﻿var a;
	$(document).ready(function(){
		
		//loading
		$("#loading").fadeOut(1500, function(){$('.pub').show('slow');});
		
		// Slideshow :
		initslide();
		
		//nav
	
		$("#nav ul li").each(function(){
				$(this).click(function(){
					$("#nav li.selected").removeClass("selected");
					$("#nav .submenu:visible").toggle("slide", { direction: "up" }, 800);
					var idDiv = $(this).children('a:eq(0)').attr('href');
					if(idDiv.indexOf("#")!=-1){
						$(idDiv).toggle("slide", { direction: "up" }, 800);
						$(this).addClass('selected');					
					return false;
					}
				});
			});
			$('#nav .submenu').each(function(){
				$(this).mouseout(function(){
				var obj=this;
					a = setTimeout(function()
					{
						$(obj).toggle("slide", { direction: "up" }, 800);
						$("#nav li.selected").removeClass("selected");
					}, 2000);		
				});
				$(this).mouseover(function(){
						clearTimeout(a);
				});
			});
		
		//Scroll
		$('#scrollchro').jcarousel({
			// Configuration goes here
		    vertical : true,
		    //wrap : 'circular',
		    scroll: 3
		   // easing: 'BounceEaseOut',
		   //animation: 1000
		});
		
		//tabs
		$('#tabs > ul').tabs({ fx: { opacity: 'toggle' } }).tabs('rotate', 8000);
		
		// Bannering :
		//$(".pub").show();//pub();
		
	});
