fl=0;
$(document).ready(function() {
	////// sound control	
	$("#jquery_jplayer").jPlayer({
		ready: function () {
			$(this).jPlayer("setMedia", {
				mp3:"music.mp3"
			});
			//$(this).jPlayer("play");
		},
		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"
	});	
		
	/// follow us
	$('.follow').find('img').css({opacity:0.3})
	
	$('.follow img').hover(function(){
		$(this).stop().animate({opacity:1},400)							 
	}, function(){
		$(this).stop().animate({opacity:0.3},400)	
	})
	
	
	//////  menu
	$('.top2').css({opacity:0.3})
	
	$('#menu > li').find('> a > span').css({top:-55})
	
	$('#menu > li').hover(function(){
		$(this).find('> a > span').stop().animate({top:0},400,'easeOutQuint');	

	}, function(){		
		$(this).find('> a  > span').stop().animate({top:-55},400,'swing', function(){$(this).css({top:-55})}   );
		
	})
	
	////// submenu
	$('ul#menu').superfish({
      delay:       600,
      animation:   {opacity:'show'},
      speed:       600,
      autoArrows:  false,
      dropShadows: false
    });
	
	//// sub menu
	$('.submenu > ul > li').find('> a > span').css({opacity:0})
	
	$('.submenu > ul > li').hover(function(){
		$(this).find('> a > span').stop().animate({opacity:1},400)							 
	}, function(){		
		$(this).find('> a > span').stop().animate({opacity:0},400)		
	})

	//////////// circles
	$("#circles li").hover(function() {
			
		    $(this).find("a").stop().animate({ marginTop: "-30px" }, 400, 'easeInOutBack');
			$(this).find('> a > span').stop().animate({opacity:0},400, 'easeOutCubic')
		    
		},function(){

		    $(this).find("a").stop().animate({ marginTop: "0px" }, 400, 'easeOutBack' );
			$(this).find('> a > span').stop().animate({opacity:1},400, 'easeOutCubic')
		   
	});
	
	//////// read more
	$('.button1 span').css({opacity:'0'})
	
	$('.button1').hover(function(){
		$(this).find('span').stop().animate({opacity:'1'})							 
	}, function(){
		$(this).find('span').stop().animate({opacity:'0'})							 
	})
	
		///////// gallery
	
	$('.photo1').find('span').css({opacity:0})
	
	$('.photo1 > a').hover(function(){
		$(this).find('span').stop().animate({opacity:0.5},400)								
	}, function(){
		$(this).find('span').stop().animate({opacity:0},400)								
	})
	
	
	
	
	
	
	
	
	
	
	

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




$(window).load(function() {	
						
						
	
	
	
	// scroll
	$('.scroll').cScroll({
		duration:700,
		step:100,
		trackCl:'track',
		shuttleCl:'shuttle',
		upButtonCl:'_up-butt',
		downButtonCl:'_down-butt'
	})	
	
	
	
	//content switch
	var content=$('#content'),
		nav=$('.menu');
	nav.navs({
		useHash:true
	})	
	nav.navs(function(n, _){
		content.cont_sw(n);		

				
		
		
	})
	content.cont_sw({
		showFu:function(){
			var _=this		
			
			
			//$('.splash').stop().animate({left:1500},800,'easeInBack', function(){$(this).css({display:'none'})})
			
			$.when(_.li).then(function(){	
				_.next.css({display:'block', left:-1500}).stop().animate({left:0},800, 'easeOutBack', function(){	});	
			});
		},
		hideFu:function(){
			
			
			var _=this
			_.li.stop().animate({left:1500},800, 'easeInBack', function(){
				_.li.css({display:'none'})
			})
		},
		preFu:function(){
			var _=this
			_.li.css({position:'absolute', display:'none'});
		}
	})
	nav.navs(0);
	
	//////////////////////////
	
	var h_cont=785;
	function centre() {
		var h=$(document).height();
		if (h>h_cont) {
			m_top=~~(h-h_cont)/2;
		} else {
			m_top=0;
		}
		$('.main1').stop().animate({paddingTop:m_top})
	}
	centre();
	$(window).resize(centre);
	
	
	
	
	
	
	
}) /// load
