$(document).ready(function() {
	
	// V2
	var leftboxjhm = $("#leftboxjhm").html();
	
	// find #leftboxjhm
	if(leftboxjhm != null){
		var count = 0;
		
		// show #leftboxjhm
		$("#leftboxjhm").css({'display':'inline'});
		$("#leftbox").css({'display':'none'});
		
		$("#jhm").fancybox({
			'autoScale'     	: false,
			'scrolling'			: 'no',
			'overlayOpacity'	: 0.9,
			'overlayColor'		: '#000',
			'padding'			: 10,
			'transitionIn'		: 'fade',
			'transitionOut'		: 'fade',
			'speedIn'			: 500, 
			'speedOut' 			: 500, 

			onComplete	:	function() {
				count++;
				//alert('Completed! count:'+count);
				if(count == 1){
					//alert(' >>> count:'+count);
					$('#slider').nivoSlider({
							effect:'fade',
							slices:1,
							animSpeed:500,
							pauseTime:5000,
							directionNav:true, //Next & Prev
							directionNavHide:true, //Only show on hover
							controlNav:false, //1,2,3...
							pauseOnHover:true, //Stop animation while hovering
							manualAdvance:false, //Force manual transitions
							beforeChange: function(){},
							afterChange: function(){}
						});

				}
				else{
					$('#slider').data('nivo:vars').stop = false;
				}
			},
			onClosed	:	function() {
	            //alert('Closed!');
			}

		});
		
	}
	
	
});

