$(function(){

	$(".txtsize a").click(function(){
		var a = $(this).attr("rel");
		$("body").css("font-size",a);
	});
	
	$("#clubgallery .img").cycle({
		 fx: 'scrollHorz',
		timeout:0,
		next:'.next',
		prev:'.back',
		cleartypeNoBg: true,
		speed:		   500
	});
	
	$("#clubgallery .img ul a").fancybox({
		'titleShow'		: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'centerOnScroll' : true
	});
	
	
	$("#pop1").fancybox({
		'titleShow'		: false,
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'centerOnScroll'	:  false,
		'showNavArrows': false,
		'overlayShow': false,
		'autoScale'			:	false,
		'type'				: 'iframe',
		'width'				: 550,
		'height'			: 280
	});
	
	$("#pop2").fancybox({
		'titleShow'		: false,
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'centerOnScroll'	:  false,
		'showNavArrows': false,
		'overlayShow': false,
		'autoScale'			:	false,
		'type'				: 'iframe',
		'width'				: 570,
		'height'			: 335
	});

	$("#pop3").fancybox({
		'titleShow'		: false,
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'centerOnScroll'	:  false,
		'showNavArrows': false,
		'overlayShow': false,
		'autoScale'			:	false,
		'type'				: 'iframe',
		'width'				: 560,
		'height'			: 335
	});
	
	$("#pop4").fancybox({
		'titleShow'		: false,
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'centerOnScroll'	:  false,
		'showNavArrows': false,
		'overlayShow': false,
		'autoScale'			:	false,
		'type'				: 'iframe',
		'width'				: 570,
		'height'			: 430
	});
	
	var chkhomepop = $("#showpop").attr("rel");
	if(chkhomepop == 1){
		$("#showpop").fancybox({
			'titleShow'		: false,
			'transitionIn'		: 'elastic',
			'transitionOut'		: 'elastic',
			'centerOnScroll'	:  false,
			'showNavArrows': false,
			'overlayShow': false,
			'onComplete' : function(){
				$("#fancybox-img").click(function(){
					window.location='news.php?type=2&text=15';
				});
			},
			'autoScale'			:	false
		});
		$("#showpop").trigger('click');
	}
	
	
	//$('.hometext .hidetxt:first-child').animate({"left": "0px"}, 400, "swing");
	/*$(".thumbhome li a").click(function(){
		$(".thumbhome li a").removeClass("on");
		$(this).addClass("on");
		var im = $(this).attr("rel");
		$(".hidetxt").css('left','150%').hide();
		$(im).show().animate({"left": "0px"}, 500, "swing");
	}); 
	*/
	 //var afix = $(".hometext div:first-child").height();
	 //$(".hometext").css("height",'758px');
    
    	  /* $('.allhome').cycle({ 
    		   fx: 'scrollHorz', 
    	       speed:  'slow', 
    	       pager:  '.thumbnav',
    	       timeout: 0,
    	       after: onAfter,
    	       pagerAnchorBuilder: function(idx, slide) { 
    	    	   return '.thumbnav li:eq(' + idx + ')';
    	       }
    	   });*/
    
   function onAfter(curr, next, opts, fwd) {
		   var $ht = $(this).height();
		   //set the container's height to that of the current slide
		   $(this).parent().animate({height: $ht});	   

   }
	
	
	
	$(".viewplan a").fancybox({
		'titleShow'		: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'centerOnScroll' : true
	});
	
	$(".mainbanner a.pop, .conceptlogo").fancybox({
		'titleShow'		: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'centerOnScroll' : false,
		'autoScale'		:	false
	});
	
	$(".mapview a").fancybox({
		'titleShow'		: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'centerOnScroll' : false,
		'autoScale'		:	false
	});
	
	$("#nav .m2").click(function(){
		$(this).find("ul").slideToggle();
	});

	var player = $f("player", "flash/player/flowplayer-3.2.2.swf");
	$(".playhome").click(function() {
		
		var ch = $(this).attr("rel");
		if(ch=='link'){
			$.fancybox({
				//'padding'		: 0,
				'autoScale'		: false,
				'transitionIn'	: 'none',
				'transitionOut'	: 'none',
				'width'		: 970,
				'height'		: 500,
				'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
				'type'			: 'swf',
				'swf'			: {
				   	 'wmode'		: 'transparent',
					'allowfullscreen'	: 'false'
				}
			});

			
		}else{
			
			$(".playhome").fancybox({
				'titlePosition'		: 'inside',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'centerOnScroll'	:  true,
				'autoScale'			: false,
				'onStart': function(){
					player.load();
				},
				'onClosed': function(){
					player.unload();
				}
			});
		}

		return false;
	});
	
	
	$(".slide").cycle({
		 fx: 'fade',
			timeout:6000
		});
});




