function start(){	
	
};

function startF(){	
	setTimeout(function () {
		$('#menu > li.nav1').css({marginTop:-500}).stop().delay(100).animate({marginTop:0},1200,'easeOutBack');
		$('#menu > li.nav2').css({marginTop:500}).stop().delay(500).animate({marginTop:0},1200,'easeOutBack');
		$('#menu > li.nav3').css({marginTop:-500}).stop().delay(300).animate({marginTop:0},1200,'easeOutBack');
		$('#menu > li.nav4').css({marginTop:500}).stop().delay(300).animate({marginTop:0},1200,'easeOutBack');
		$('#menu > li.nav5').css({marginTop:-500}).stop().delay(500).animate({marginTop:0},1200,'easeOutBack');
		$('#menu > li.nav6').css({marginTop:500}).stop().delay(100).animate({marginTop:0},1200,'easeOutBack');

		$('.splash').css({opacity:0}).stop().delay(1000).animate({opacity:1},1200,'swing');

		$('.social_wrapper').css({opacity:0}).stop().delay(100).animate({opacity:1},800,'swing');

		$('.logo').css({marginTop:-1000}).stop().delay(600).animate({marginTop:0},1200,'easeOutExpo');
	}, 200);
};

function showSplash(){
	setTimeout(function () {
		$('#menu > li.nav1').stop().delay(0).animate({marginTop:0},400,'swing').delay(0).animate({marginLeft:0},800,'easeOutExpo');
		$('#menu > li.nav2').stop().delay(0).animate({marginTop:0},400,'swing').delay(0).animate({marginLeft:0},800,'easeOutExpo');
		$('#menu > li.nav3').stop().delay(0).animate({marginTop:0},400,'swing').delay(0).animate({marginLeft:0},800,'easeOutExpo');
		$('#menu > li.nav4').stop().delay(0).animate({marginTop:0},400,'swing').delay(0).animate({marginLeft:0},800,'easeOutExpo');
		$('#menu > li.nav5').stop().delay(0).animate({marginTop:0},400,'swing').delay(0).animate({marginLeft:0},800,'easeOutExpo');
		$('#menu > li.nav6').stop().delay(0).animate({marginTop:0},400,'swing').delay(0).animate({marginLeft:0},800,'easeOutExpo');

		$('.splash').css({display:'block'}).stop().delay(500).animate({opacity:1},800,'easeOutExpo');
	}, 700);	
};
function hideSplash(){ 	
	$('#menu > li.nav1').stop().delay(0).animate({marginLeft:-171},400,'swing').delay(0).animate({marginTop:-34},800,'easeOutExpo');
	$('#menu > li.nav2').stop().delay(0).animate({marginLeft:-10},400,'swing').delay(0).animate({marginTop:-467},800,'easeOutExpo');
	$('#menu > li.nav3').stop().delay(0).animate({marginLeft:-80},400,'swing').delay(0).animate({marginTop:-34},800,'easeOutExpo');
	$('#menu > li.nav4').stop().delay(0).animate({marginLeft:81},400,'swing').delay(0).animate({marginTop:-467},800,'easeOutExpo');
	$('#menu > li.nav5').stop().delay(0).animate({marginLeft:12},400,'swing').delay(0).animate({marginTop:-34},800,'easeOutExpo');
	$('#menu > li.nav6').stop().delay(0).animate({marginLeft:173},400,'swing').delay(0).animate({marginTop:-467},800,'easeOutExpo');

	$('.splash').stop().animate({opacity:0},800,'easeOutExpo', function(){ $(this).css({display:'none'}); });


};
function hideSplashQ(){	
	$('#menu > li.nav1').css({marginLeft:-171, marginTop:-34});
	$('#menu > li.nav2').css({marginLeft:-10, marginTop:-467});
	$('#menu > li.nav3').css({marginLeft:-80, marginTop:-34});
	$('#menu > li.nav4').css({marginLeft:81, marginTop:-467});
	$('#menu > li.nav5').css({marginLeft:12, marginTop:-34});
	$('#menu > li.nav6').css({marginLeft:173, marginTop:-467});

	$('.splash').css({opacity:0, display:'none'});

	
};

///////////////////

$(document).ready(function() {
	////// sound control	
	$("#jquery_jplayer").jPlayer({
		ready: function () {
			$(this).jPlayer("setMedia", {
				mp3:"music.mp3"
			});
			//$(this).jPlayer("play");
			var click = document.ontouchstart === undefined ? 'click' : 'touchstart';
          	var kickoff = function () {
            $("#jquery_jplayer").jPlayer("play");
            document.documentElement.removeEventListener(click, kickoff, true);
         	};
          	document.documentElement.addEventListener(click, kickoff, true);
		},
		
		repeat: function(event) { // Override the default jPlayer repeat event handler				
				$(this).bind($.jPlayer.event.ended + ".jPlayer.jPlayerRepeat", function() {
					$(this).jPlayer("play");
				});			
		},
		swfPath: "js",
		cssSelectorAncestor: "#jp_container",
		supplied: "mp3",
		wmode: "window"
	});

	////// submenu
	$('ul#menu').superfish({
      delay:       600,
      animation:   {height:'show'},
      speed:       600,
      autoArrows:  false,
      dropShadows: false
    });	

    $(".scrollGall").jCarouselLite({
        btnNext: ".nextGall",
        btnPrev: ".prevGall",
        easing: "easeOutBack",
		auto:1500,
        speed: 1000,
        visible: 4,
		mouseWheel: true
    });

    /////// scrollGall
	$(".scrollGall a").find(".txt1").css({marginTop:0, opacity:1});
	$(".scrollGall a").find(".txt2").css({marginTop:0, opacity:1});
	$(".scrollGall a").hover(function() {
		$(this).find(".txt1").stop().animate({marginTop:0, opacity:1 }, 400, 'easeOutExpo');
		$(this).find(".txt2").stop().animate({marginTop:0, opacity:1 }, 400, 'easeOutExpo');
		$(this).find("img").stop().animate({opacity:0.5 }, 400, 'easeOutExpo');
	},function(){
	    $(this).find(".txt1").stop().animate({marginTop:0, opacity:1 }, 400, 'easeOutExpo');
		$(this).find(".txt2").stop().animate({marginTop:0, opacity:1 }, 400, 'easeOutExpo');
		$(this).find("img").stop().animate({opacity:1 }, 400, 'easeOutExpo');
	});

	
	

	
	
	
	

	
	
	
	
	
	
	
	// for lightbox
	$("a[rel^='prettyPhoto']").prettyPhoto({animation_speed:'normal',theme:'dark',social_tools:false,allow_resize: true,default_width: 500,default_height: 344});
	
	
		
 });  ////////




$(window).load(function() {
						
	
						
	// scroll
	$('.scroll-pane').jScrollPane({
		showArrows: true,
		verticalGutter: 15,
		verticalDragMinHeight: 83,
		verticalDragMaxHeight: 83
	});	
	
	
	
	//content switch	
	$('#content>ul>li').eq(0).css({'visibility':'hidden'});	
	var content = $('#content');	
	content.tabs({
        show:1,
        preFu:function(_){
    	   _.li.css({display:'none',left:2000});		   
		   //$('#content').css({height:0});
        },
        actFu:function(_){
			var Delay=600; // default
        	if( (_.pren == undefined) ){ // on reload
        		Delay=0;
        	}
        	if( (_.pren == 0) ){ // on click
        		Delay=600;
        	}
        	//console.log(_.pren, Delay);
			if(_.curr){
				_.curr.css({display:'block', left:2000}).stop().delay(Delay).animate({left:0},800, 'easeOutBack');	                
			}   
			if(_.prev){
				_.prev.stop().animate({left:-2000},800, 'easeInBack', function(){ _.prev.css({display:'none'}); });
			}
            		
			//console.log(_.pren, _.n);
			if ( (_.pren == undefined) && (_.n <= 0) ){                
                startF();
                //console.log("startF");
            }			
            if ( (_.n == 0) && (_.pren >= 0) ){
                showSplash();
                //console.log("showSplash");
            }
            if ((_.pren == 0) && (_.n>0)){
                hideSplash();
                //console.log("hideSplash");  
            }
			if ( (_.pren == undefined) && (_.n >= 1) ){
                _.pren = -1;
                hideSplashQ();
                //console.log("hideSplashQ");
            }
            //console.log("///////////////////////////");
  		}
    });
	//content switch navs
	var nav = $('.menu');	
    nav.navs({
		useHash:true,
        defHash: '#!/page_SPLASH',
        hoverIn:function(li){ 			
			$('> a .ic',li).stop().animate({opacity:0},400, 'easeOutCubic');
			$('.c1',li).stop().animate({opacity:0.4, marginTop:0},400, 'easeOutExpo');
			$('.txt1',li).stop().animate({opacity:1, marginTop:0},400, 'easeOutExpo');
			$('.txt2',li).stop().animate({opacity:1, marginTop:0},400, 'easeOutExpo');
			//$('.txt2',li).stop().animate({top:0},400, 'easeInOutExpo');
        },
        hoverOut:function(li){	
		    if (!li.hasClass('with_ul') || !li.hasClass('sfHover')) {
		    	$('> a .ic',li).stop().animate({opacity:1},400, 'easeOutCubic');
				$('.c1',li).stop().animate({opacity:1, marginTop:0},400, 'easeOutExpo');
				$('.txt1',li).stop().animate({opacity:1, marginTop:0},400, 'easeOutExpo');
				$('.txt2',li).stop().animate({opacity:1, marginTop:0},400, 'easeOutExpo');
			};
        }
    })    
    .navs(function(n){	
   	    content.tabs(n);
   	});	
	//////////////////////////
	

	
	
}); /// load

////////////////

$(window).load(function() {	
	setTimeout(function () {					
  		$('.spinner').fadeOut();
		$('body').css({overflow:'inherit'});
		start();
	}, 200);	
	var qwe = setTimeout(function () {$("#jquery_jplayer").jPlayer("play");}, 2000);	
	
});