var $j = jQuery.noConflict(); 
$j(document).ready(function(){
	//Flow Player Init
	/*if($j('#vidplayer').length) {
		flowplayer("vidplayer", "http://s293587629.onlinehome.us/1005/fifthavenuejewellers/js/jquery/flowplayer.swf");
	}*/
	
	if( $j('#home-slider').length ) {
		$j('#home-slider').bxSlider({
			mode: 'fade',
			auto: true,
			controls: false,
			pager: true,
			speed: 2000,
			pause: 8000
		});
	}
	
	if( $j('.minislide').length ) {
		$j('.minislide').bxSlider({
			mode: 'fade',
			auto: true,
			controls: false,
			pager: false,
			speed: 2000,
			pause: 5000
		});
	}
	
	if( $j('div.expandable p').length ) {
		$j('div.expandable p').expander({
			slicePoint: 400, 
			widow: 2,
			expandEffect: 'show',
			expandText: '[+] readmore',
			userCollapseText: '[-] minimize'
		});
	}
	
	if( $j('#thumbs').length ) {
		var onMouseOutOpacity = 0.67;
		$j('#thumbs ul.thumbs li').opacityrollover({
			mouseOutOpacity:   onMouseOutOpacity,
			mouseOverOpacity:  1.0,
			fadeSpeed:         'fast',
			exemptionSelector: '.selected'
		});
		
		var gallery = $j('#thumbs').galleriffic({
			delay:                     5000, // in milliseconds
			numThumbs:                 10, // The number of thumbnails to show page
			preloadAhead:              40, // Set to -1 to preload all images
			enableTopPager:            false,
			enableBottomPager:         true,
			maxPagesToShow:            7,  // The maximum number of pages to display in either the top or bottom pager
			imageContainerSel:         '#slideshow', // The CSS selector for the element within which the main slideshow image should be rendered
			controlsContainerSel:      '#controls', // The CSS selector for the element within which the slideshow controls should be rendered
			captionContainerSel:       '#caption', // The CSS selector for the element within which the captions should be rendered
			loadingContainerSel:       '#loading', // The CSS selector for the element within which should be shown when an image is loading
			renderSSControls:          true, // Specifies whether the slideshow's Play and Pause links should be rendered
			renderNavControls:         true, // Specifies whether the slideshow's Next and Previous links should be rendered
			playLinkText:              'Play',
			pauseLinkText:             'Pause',
			prevLinkText:              'Previous',
			nextLinkText:              'Next',
			nextPageLinkText:          'Next &rsaquo;',
			prevPageLinkText:          '&lsaquo; Prev',
			enableHistory:             false, // Specifies whether the url's hash and the browser's history cache should update when the current slideshow image changes
			enableKeyboardNavigation:  true, // Specifies whether keyboard navigation is enabled
			autoStart:                 true, // Specifies whether the slideshow should be playing or paused when the page first loads
			syncTransitions:           false, // Specifies whether the out and in transitions occur simultaneously or distinctly
			defaultTransitionDuration: 1000, // If using the default transitions, specifies the duration of the transitions
			onSlideChange:             function(prevIndex, nextIndex) {
				// 'this' refers to the gallery, which is an extension of $('#thumbs')
				this.find('ul.thumbs').children()
					.eq(prevIndex).fadeTo('fast', onMouseOutOpacity).end()
					.eq(nextIndex).fadeTo('fast', 1.0);
			},
			onPageTransitionOut:       function(callback) {
				this.fadeTo('fast', 0.0, callback);
			},
			onPageTransitionIn:        function() {
				this.fadeTo('fast', 1.0);
			}
		});
	}
	
	
	//var info = document.getElementById("info");
	
	if($j('#vidplayer').length) {
		$f("vidplayer", "http://s293587629.onlinehome.us/1005/fifthavenuejewellers/js/jquery/flowplayer.swf");
	}
	
	/*var videopath = "http://s293587629.onlinehome.us/1005/fifthavenuejewellers/";
	var swfplayer = videopath + "js/jquery/flowplayer-3.1.5.swf";
	
	var videoclip='';
	var player='';
	
	$j(".video_link").mouseenter(function(){
		videoclip= $j(this).attr('href');
		$j(this).attr("href","#video_box");
	}).mouseleave( function(){
		$j(this).attr("href",videoclip);
	});
	
	$j(".video_link").fancybox({
		'hideOnContentClick':false,
		'overlayOpacity' :.6,
		'zoomSpeedIn' :400,
		'zoomSpeedOut' :400,
		'easingIn' : 'easeOutBack',
		'easingOut' : 'easeInBack',
		'callbackOnShow' :function(){
			player = $f("fancy_div",swfplayer,{
				play:{opacity:0},
				clip:{
					autoPlay:true,
					autoBuffering:true,
					url:videopath + videoclip+'',
					onStart:function(clip){
						var wrap=$j(this.getParent());
						var clipwidth = clip.metaData.width;
						var clipheight= clip.metaData.height;
						var pos = $j.fn.fancybox.getViewport();
						$j("#fancy_outer").css({width:clipwidth,height:clipheight});
						$j("#fancy_outer").css('left',((clipwidth + 36)> pos[0]?pos[2]:pos[2]+Math.round((pos[0]-clipwidth-36)/2)));
						$j("#fancy_outer").css('top',((clipheight + 50)> pos[1]?pos[3]:pos[3]+Math.round((pos[1]-clipheight-50)/2)));
					},
					onFinish:function(){
						$j('#fancy_close').trigger('click');
					}
				}
			});
			player.load();
			$j('#fancy_close').click(function(){
				$j("#fancy_div_api").remove();
			});
		}
	});*/
	
	//Video Player + Fancybox
	/*var videopath = "http://s293587629.onlinehome.us/1005/fifthavenuejewellers/"
	var swfplayer = videopath + "js/jquery/flowplayer-3.1.5.swf";
	var swfcontent = videopath + "js/jquery/flowplayer.content-3.1.0.swf";
	var swfcaptions = videopath + "js/jquery/flowplayer.captions-3.1.4.swf";
	
	var videoclip;
	var player;
	var vidid;
	var captions;
	var capShow;
	var ccbutShow;
	
	if( $j('.video_link').length ) {
		$j(".video_link").hover(function(){
			vidid = $j(".video_link").index(this);
			videoclip = $j(".video_link").eq(vidid).attr("name");
			if ($j(".video_link").eq(vidid).hasClass('captions')) {
			captions = $j(".video_link").eq(vidid).attr("name")+'.srt';
			capShow = true;
			ccbutShow = { width: 20, height: 15, right: 5, bottom: 32, label: 'SUBS' };
			} else { 
			captions = 'js/jquery/empty.srt';
			capShow = false;
			ccbutShow = null;
			}
		});
		
		$j(".video_link").fancybox({
			'hideOnContentClick':false,
			'overlayOpacity' :.6,
			'zoomSpeedIn'    :400,
			'zoomSpeedOut'   :400,
			'easingIn'		 : 'easeOutBack',
			'easingOut'		 : 'easeInBack',
			
			'callbackOnShow' :function(){
				
				if (videoclip == 'image') {				
					
					$j("#fancy_right, #fancy_left").css({height:$j("#fancy_div").height(), bottom: '0'});
					
					} else {
				
					player = $j("fancy_content",{src: swfplayer, wmode: 'opaque'},{
								
					play:{opacity:0},
				  //key: '#$flowplayerkeycode',

					plugins: {
						
					
					captions: { 
						url: swfcaptions, 					 
						// pointer to a content plugin (see below) 
						captionTarget: 'content',
						showCaptions: capShow,
						button: ccbutShow
					}, 
					/* 
						configure a content plugin so that it  
						looks good for showing subtitles 
					*/ 
					/*content: { 
						url:swfcontent, 
						bottom: 25, 
						height:40, 
						backgroundColor: 'transparent', 
						backgroundGradient: 'none', 
						border: 0, 
						textDecoration: 'outline', 
						style: {  
							body: {  
								fontSize: 16,  
								fontFamily: 'Arial', 
								textAlign: 'center', 
								color: '#ffffff' 
							}  
						}  
					},
					
					controls:  {
					backgroundColor: 'transparent',
					progressColor: 'transparent',
					bufferColor: 'transparent',
					all:false,
									//fullscreen:true,
					scrubber:true,
					volume:true,
					mute:true,
					play:true,
					height:30,
					autoHide: 'always'		

					}

					},
					clip:{
						autoPlay:true,
						autoBuffering:true,
						url:videopath+videoclip+'',
						captionUrl: videopath+captions+'', 
						onStart:function(clip){
							var wrap=jQuery(this.getParent());
							var clipwidth = clip.metaData.width;
							var clipheight= clip.metaData.height;
							var pos = $.fn.fancybox.getViewport();
							$j("#fancy_outer").css({width:clipwidth+20,height:clipheight+20});
							$j("#fancy_outer").css('left', ((clipwidth + 36) > pos[0] ? pos[2] : pos[2] + Math.round((pos[0] - clipwidth	- 36)	/ 2)));
							$j("#fancy_outer").css('top',  ((clipheight + 50) > pos[1] ? pos[3] : pos[3] + Math.round((pos[1] - clipheight - 50)	/ 2)));
							$j("#fancy_right, #fancy_left").css({height:clipheight-60, bottom: '70px'});
							
						},
						onFinish:function(){
							$j('#fancy_close').trigger('click');
						}
					}
				});
				
				
					
				player.load();
				
			}
				
				$j('#fancy_right, #fancy_right_ico').click(function(){
					vidid++;
					videoclip = $j(".video_link").eq(vidid).attr("name");
					if ($j(".video_link").eq(vidid).hasClass('captions')) {
					captions = $j(".video_link").eq(vidid).attr("name")+'.srt';
					capShow = true;
					ccbutShow = { width: 20, height: 15, right: 5, bottom: 32, label: 'CC' };
					} else {
					captions = 'videos/empty.srt';
					capShow = false;
					ccbutShow = null;
					}
				});
				
				$j('#fancy_left, #fancy_left_ico').click(function(){
					vidid--;
					videoclip = $j(".video_link").eq(vidid).attr("name");
					if ($j(".video_link").eq(vidid).hasClass('captions')) {
					captions = $j(".video_link").eq(vidid).attr("name")+'.srt';
					capShow = true;
					ccbutShow = { width: 20, height: 15, right: 5, bottom: 32, label: 'SUBS' };
					} else {
					captions = 'videos/empty.srt';
					capShow = false;
					ccbutShow = null;
					}
				});
			},
			'callbackOnClose':function(){
				$j("#fancy_content_api").remove();
			}
		});
	}*/
	
});
