﻿jQuery(document).ready(function($) {
	var notify = "";
	switch (window.location.hostname) {
		case "www.bosuutapnhancuoi.com":
			notify = "- Tất cả giá Nhẫn cưới là giá cho một đôi.<br>";
			break;
		default:
			break;
	}
	$.jGrowl.defaults.position = 'top-right';
	$.jGrowl(notify + "- Click vào ảnh lớn để xem ảnh kế tiếp.<br>- Click ảnh nhỏ, sử dụng các phím di chuyển để xem ảnh.", { header: 'Chú ý', life: 10000, width: '200px' });

	// We only want these styles applied when javascript is enabled
	//		$('div.navigation').css({ 'width': '700px', 'float': 'left' });
	var width = $(".thumbs li").size() * 130 + 'px';
	//alert(width);
	//$('.thumbs').css({ 'width': width });
	$('div.content').css('display', 'block');
	$('div.navigation').css({ 'height': '460px' });
	if ($.browser.msie && $.browser.version.substr(0, 1) < 7) {
		$("span.image-caption").css({ 'top': '150', 'position': 'fixed' });
	}
	$('.thumbs').css('display', 'block');

	// Initially set opacity on thumbs and add
	// additional styling for hover effect on thumbs
	var onMouseOutOpacity = 0.67;
	$('#thumbs ul.thumbs li').opacityrollover({
		mouseOutOpacity: onMouseOutOpacity,
		mouseOverOpacity: 1.0,
		fadeSpeed: 'fast',
		exemptionSelector: '.selected'
	});

	// Initialize Advanced Galleriffic Gallery
	var gallery = $('#thumbs').galleriffic({
		delay: 2500,
		numThumbs: 9,
		preloadAhead: 9,
		enableTopPager: false,
		enableBottomPager: true,
		maxPagesToShow: 10,
		imageContainerSel: '#slideshow',
		controlsContainerSel: '#controls',
		captionContainerSel: '#caption',
		loadingContainerSel: '#loading',
		renderSSControls: false,
		renderNavControls: false,
		playLinkText: 'Play Slideshow',
		pauseLinkText: 'Pause Slideshow',
		prevLinkText: '&lsaquo; Previous Photo',
		nextLinkText: 'Next Photo &rsaquo;',
		nextPageLinkText: '&rsaquo;&rsaquo;',
		prevPageLinkText: '&lsaquo;&lsaquo;',
		enableHistory: false,
		autoStart: false,
		syncTransitions: true,
		defaultTransitionDuration: 900,
		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);
		}
	});
});
