';
},
prepare:function(to,ci){
to.append(Captions.compile(ci));
var b=to.find('.bottom');
b.find('a#original').click(function(){
window.open(ci.link,'Original','width=840,height=600,scrollbars=yes,resizable=yes,menubar=no,toolbar=no,directories=no,status=no,copyhistory=no');});
if(typeof ci.meta!=UNDEF && Captions.meta) b.find('.caption>.meta').show();
if(typeof ci.map!=UNDEF){
var l=b.find('.caption>.map');
if(Captions.map) l.show();
Map.show(ci.map, l);
}
if(typeof ci.shop!=UNDEF){
var l=b.find('.caption>.shop');
l.empty();
if(Captions.shop) l.show();
Shop.show(ci, l);
}
if(!Captions.on){
to.css({opacity:0}).show();
b.css({bottom:-b.outerHeight()});
to.hide().css({opacity:1});
}
b.find('.caption>.menu a').each(function(){
var rel=$(this).attr('rel');
Hints.add($(this));
if(typeof Captions[rel]!=UNDEF && Captions[rel]) $(this).addClass('active');
}).click(function(){
var rel=$(this).attr('rel');
if(rel){
b.find('.'+rel).slideToggle(200);
if(typeof Captions[rel]!=UNDEF){
$(this).toggleClass('active');
Captions[rel]=!Captions[rel];
Cookie.put('_ts_'+rel,Captions[rel]);
}
return false;
}
});
}
};
var Map = {
map:null,
zoom:null,
type:null,
blueIcon:null,
init:function(){
if(typeof map==UNDEF) return;
Map.zoom=map.zoom;
switch(map.type){
case 'Satellite':Map.type=G_SATELLITE_MAP;break;
case 'Hybrid':Map.type=G_HYBRID_MAP;break;
case 'Terrain':Map.type=G_PHYSICAL_MAP;break;
}
blueIcon=new GIcon(G_DEFAULT_ICON);
blueIcon.image="http://maps.google.com/intl/en_us/mapfiles/ms/micons/blue-dot.png";
blueIcon.iconSize=new GSize(32,32);
},
show:function(coords,l){
Map.hide();
if(GBrowserIsCompatible()){
var ll=new GLatLng(coords.lat,coords.lon);
var marker,options;
var mw=l.width()||($('#images .swap .caption').width())||($('#thumbs').width()-30), mh=l.height()||240;
Map.map=new GMap2(l[0],{size:new GSize(mw,mh)});
Map.map.setCenter(ll,Map.zoom);
Map.map.setMapType(Map.type);
if(map.all)
for(var i in images){
if(images[i].map && i!=Imgs.curr){
options={title:images[i].thmcapt.stripHTML().trim(),icon:blueIcon};
marker=new GMarker(new GLatLng(images[i].map.lat,images[i].map.lon),options);
marker.num=i;
GEvent.addListener(marker,'click',function(){
Map.saveConfig();
Imgs.go(parseInt(this.num));
});
Map.map.addOverlay(marker);
}
}
marker=new GMarker(new GLatLng(coords.lat,coords.lon),{zIndexProcess:function(){ return 9999; }});
Map.map.addOverlay(marker);
Map.map.setUIToDefault();
}
},
hide:function(){
if(Map.map){
Map.saveConfig();
GUnload();
Map.map=null;
}
},
saveConfig:function(){
Map.zoom=Map.map.getZoom();
Map.type=Map.map.getCurrentMapType();
}
};
var Shop = {
div:null,
getOptions:function(o){
var s="";
var o=o.split('::');
for(var i in o){
d=o[i].split('=');
s+='';
}
return s;
},
show:function(ci,l){
this.div=l;
l.append('');
l.append('');
l.append('');
var l1=l.find('#shopSelect>option').eq(0);
var p=l1.val().split('+');
l.find('#shopName').val(l1.text());
l.find('#shopAmount').val(p[0]).focus(function(){$(this).blur();return false;});
if(p.length>0) l.find('#shopShipping').val(p[1]);
l.find('#shopSelect').change(function(){
var l=$(this).parent('form');
var p=$(this).val().split('+');
l.find('#shopAmount').val(p[0]);
if(p.length>0) l.find('#shopShipping').val(p[1]);
l.find('#shopName').val($(this).find('option:selected').text());
});
l.find('#shopAdd,#shopView').click(function(){
window.open('','ShoppingCart','width=840,height=600,scrollbars=yes,resizable=yes,menubar=no,toolbar=no,directories=no,status=no,copyhistory=no');});
}
};
var Hints = {
init:function(){
$('a.showhint,div.showhint,ul.showhint>li').each(function() {Hints.add($(this));});
},
add:function(to,txt){
if(typeof txt=='undefined') {
txt=to.attr('title');
to.removeAttr('title');
}
if(txt.length){
to.data('hint',txt.cleanupHTML()).hover(function(){
$('body').append('
'+to.data('hint')+'
');
var h=$('#hint');
var o=to.offset();
var t=(o.top>$(window).height()/3)?(o.top-10-h.outerHeight()):(o.top+to.outerHeight()+10);
var l=Math.round(o.left+(to.outerWidth()-h.outerWidth())/2);
if((t+h.outerHeight())>$(window).height())
t=Math.max(o.top-10-h.outerHeight(),0);
if((l+h.outerWidth())>$(window).width())
l=Math.max($(window).width()-h.outerWidth(),0);
h.css({left:l,top:t}).fadeIn();
},function(){$('#hint').remove()});
}
}
};
var Alert = {
show:function(text,buttons){
$('#modal').remove();
$('body').append('
'+text+'
');
var b=$('#modal .buttons');
for(var i in buttons){
var a=$(''+buttons[i].t+'').appendTo(b);
if(typeof buttons[i].h !== UNDEF) a[0].handler=buttons[i].h;
}
b.find('a').click(function(){
if(this.handler) this.handler.call();
Alert.close();
return false;
}).eq(0).addClass('active');
$('#modal').fadeIn(250);
},
prev:function(){
var b=$('#modal .buttons a');
var s=$('#modal .buttons a.active');
var n=(b.index(s)-1);
if(n===-1) n=b.length-1;
b.each(function(i){$(this).toggleClass('active',i===n)});
},
next:function(){
var b=$('#modal .buttons a');
var s=$('#modal .buttons a.active');
var n=(b.index(s)+1)%b.length;
b.each(function(i){$(this).toggleClass('active',i===n)});
},
close:function(){
$('#modal').fadeOut(250,function(){$(this).remove();});
},
select:function(){
var s=$('#modal .buttons a.active')[0];
if(s.handler) s.handler.call();
Alert.close();
}
};
var Help = {
init:function(){
$('.showhelp').click(function(){$(Imgs.on?'#helpimage':'#helpsplash').show();$('#help').fadeIn(500);});
$('#help .close a').click(function(){Help.hide();});
$('#help h2>a').click(function(){$('#helpimage,#helpsplash').toggle();return false;});
},
showImage:function(){
$('#helpimage').show();$('#help').fadeIn(500);
},
showSplash:function(){
$('#helpsplash').show();$('#help').fadeIn(500);
},
hide:function(){
if($('#help').is(':visible'))
$('#help').fadeOut(500,function(){$('#helpimage,#helpsplash').hide();});
}
};
var Audio = {
init:function(){
if(typeof audio!=UNDEF && audio.files.length>0) {
var src=resPath+'/mp3play.swf?files='+unescape(encodeURIComponent(audio.files))+'&auto='+audio.auto+'&loop='+audio.loop;
if($.browser.msie)
$('body').append('');
else
$('body').append('');
}
}
};
var Video = {
flvPlayer:null,
add:function(to,ci){
var mtype=new Array(".avi.mp3", ".qt.mov.mpg.mpeg.mpe.aiff", ".wmv.wma.asf", ".swf", ".flv.mp4.divx.xvid" );
var i;
var ext=ci.link.substr(ci.link.lastIndexOf('.')).toLowerCase();
for(i=0; i');
var div=to.find('.player');
Video.center(div);
if(i!=4) Imgs.stop();
switch(i){
case 1:
div.addClass('qtplayer').append('');
break;
case 2:
div.addClass('wmplayer').append('');
break;
case 3:
div.addClass('swfplayer').append('');
break;
case 4:
$('#flvplayer').remove();
Imgs.suspendLoop();
div.addClass('flvplayer').attr('id','flvplayer');
var so=new SWFObject(resPath+'/player.swf','player',video.width,video.height+24,'9',$('#images').css('background-color').rgb2hex());
if(so){
so.addParam('allowfullscreen','true');
so.addParam('wmode','opaque');
so.addParam('allowscriptaccess','always');
var cb=$('body').css('background-color').rgb2hex();
var cf=$('body').css('color').rgb2hex();
so.addParam('flashvars','file=../'+relPath+ci.link+'&autostart='+video.auto+'&playerready=Video.ready&backcolor='+cb+'&screencolor='+cb+'&frontcolor='+cf+'&lightcolor='+cf);
so.write('flvplayer');
}
break;
default:
div.addClass('otherplayer').append('');
}
},
ready:function(obj){
Video.flvPlayer=document.getElementById(obj['id']);
Video.flvPlayer.addModelListener('STATE','Video.stateHandler');
},
stateHandler:function(obj){
if(obj.newstate=='COMPLETED'){
Imgs.resumeLoop();
}
},
center:function(div){
var ww=Imgs.div.width(), wh=Imgs.div.height();
if(ww==0||wh==0) {ww=$(window).width();wh=$(window).height();}
div.css({left:Math.round((ww-video.width)/2),top:Math.round((wh-video.height)/2)});
}
};
var History = {
setUrl:function(n){
if(Imgs.on&&(typeof n==='number')){
if(numberLinks){
window.location.hash=n+1;
}else{
var f=images[n].file.lastIndexOf('/');
window.location.hash=(f>0)?images[n].file.substr(f+1):images[n].file;
}
}else
window.location.hash='';
if(typeof _ja_W!=UNDEF && _ja_W.ReloadBar)
_ja_W.ReloadBar();
},
init:function(){
var n,p=window.location.href.split('\#');
if(p.length>1){
if(n=parseInt(p[1]))
return Math.minMax(0,n-1,Imgs.max-1);
else
return Imgs.find(p[1]);
}
return -1;
}
};
var Keyboard = {
init:function(){
$(document).keydown(Keyboard.handler);
},
handler:function(e){
if(typeof _jaWidgetFocus!=UNDEF&&_jaWidgetFocus || document.activeElement.nodeName=='INPUT') return true;
var k=e?e.keyCode:window.event.keyCode; //alert(k);
if($('#modal').length){
switch(k){
case 13: case 10: Alert.select(); break;
case 39: Alert.next(); break;
case 37: Alert.prev(); break;
case 27: Alert.close(); break;
default: return true;
}
}else if(Imgs.on){
switch(k) {
case 38: Ctrl.goUp(); break;
case 39: Ctrl.hide(); Imgs.next(); break;
case 37: Ctrl.hide(); Imgs.prev(); break;
case 106: case 179: if(Imgs.to) Imgs.stop(); else Imgs.start(250); break;
case 109: Captions.toggle(); Ctrl.setInfoBtn(); Thumbs.toggle(); Ctrl.setThumbsBtn(); break
case 107: Imgs.toggleFit(); Ctrl.setFitBtn(); break;
case 112: Help.showImage(); break;
case 27: Help.hide(); break;
default: return true;
}
}else{
switch(k) {
case 38: Ctrl.goParent(); break;
case 106: case 179: Splash.startShow(); break;
case 112: Help.showSplash(); break;
case 27: Help.hide(); break;
default: return true;
}
}
return false;
}
};
$(document).ready(function(){
Imgs.max=images.length;
Hints.init();
Help.init();
Splash.div=$(C.SPSH);
Splash.div=$(C.SPSH);
Splash.hed=$(C.HEAD);
Splash.gal=$(C.GALS);
Splash.gac=$(C.GALC);
Splash.ftr=$(C.FOOT);
Splash.thm=$(C.THMS);
Thumbs.div=$(C.THMB);
Thumbs.bck=$(C.BACK);
Thumbs.thm=$(C.THMC);
Thumbs.thc=$(C.THMBC);
Ctrl.div=$(C.CTRL);
Imgs.div=$(C.IMGS);
if(Splash.div.length){
Splash.init();
Share.init();
$(window).resize(Splash.adjust);
}
if(images.length){
if(typeof map!=UNDEF) Map.init();
Navi.init();
Ctrl.init();
Captions.init();
Thumbs.init();
Imgs.init();
}
Audio.init();
Keyboard.init();
$('#likeFacebook').append('');
$('#tweetTwitter').append('');
$(document).unload(function(){Map.hide();});
if($.browser.msie && $.browser.version<7){
FixPng.init();
if(level==0) setTimeout(function(){Alert.show('