/* -------------------------------------------------------------------------- */
/** 
 *    @fileoverview
 *       Feature Box Viewer
 *
 *    @version 1.0.20100719
 *    @requires jquery.js
 *    @requires jcarousellite.js
 *    @requires cwj.js
 *    @requires cwj.rollover.js
 *    @requires cwj.scroller.js
 */
/* -------------------------------------------------------------------------- */
(function($) {

$(function(){
if($("div#toppage_main_content").size()){
initGalleryFeature();
galleryViewPict();
}
})

// nyroModal - LightBox in Catalogue
function setPopupProductSummary() {
$.nyroModalSettings({
 minWidth: 580
,minHeight: 1000
,css: {
 wrapper:{left:'340px'}
,loading:{left:'340px', border:'none'}
} 
});
}
// IE6(not in use - just in case)
function setPopupProductSummaryIE6(){
$.nyroModalSettings({
showBackground: function (elts, settings, callback) {
elts.bg.css({opacity:0.75});
callback();
},
hideBackground: function (elts, settings, callback) {
elts.bg.hide();
callback();
}
});
}

// jCarouselLite + jquery.easing1.3 - Featured Gallery
function initGalleryFeature() {
var $wrapper = $(".taikobo_featured");
var $ul = $wrapper.find("ul");
var $lis = $ul.find("li");
var $newLis = $lis.clone(true);
var i = $newLis.size();
$ul.empty().append($newLis);
$wrapper.jCarouselLite({
 btnNext: ".bt_scroll_forward a"
,btnPrev: ".bt_scroll_backward a"
,circular: true
,cloneEvent: true
,visible: 4
,scroll: 1
//,scroll: 4
,speed: 700
,easing: "easeOutQuart"
//,easing: "easeOutBack"
});
$('#pic-1').css("display","block");
}

//
function galleryViewPict(){
$('.clr > li >a').each(function(){
$(this).click(function(){
var $href   = (this.href).split('#')[1] || '';
console.log($href);
$('#pictView > div.pictView-pane').each(function(){
$(this).css("display","none")
});
$('#pictView > div.pictView-pane2').each(function(){
$(this).css("display","none")
});
//$('#'+$href).css("display","block");
$('#'+$href).fadeIn('slow');
});
});
}

// Cluetip - indexmap
function setCluetipIndexmap() {
$.cluetip.setup({
 insertionType: 'insertAfter'
,insertionElement: '#main_contents #indexmap_body'
});

$('a.maplink').cluetip({
 width: '182px'
,positionBy: 'mouse'
,topOffset: -90
,leftOffset: -90
,local: true
,hideLocal: true
,dropShadow: false
,showTitle: false
,tracking: true 
,cluetipClass: 'indexmap'
,fx: {open: 'fadeIn', openSpeed: 'normal'}
 });
}

// localScroll - scrolling from image map to local anchor
function initLocalScrollIndexmap() {
$("#product_indexmap_index #main_contents #list_maplink").localScroll({speed: 700, easing: "easeOutExpo"});
}

// localScroll - scrolling from image map to local anchor
function initLocalScrollIndexfile() {
$("#main_contents").localScroll({speed: 980, easing: "easeInOutExpo"});
}


})(jQuery);
