/*
  SimpleJsMin From YouYee OpenSource 
  2008 - 2009
*/

(function(){var galleries=window.galleries=[];var loader=new YEE.net.URLLoader(),GET_GALLERY_URL='./amfphp/services/static/gallery.json',noStaticData=false,timeout;loader.onComplete=function(re){galleries=eval(re);generateList(galleries);};loader.onError=function(){if(!noStaticData){GET_GALLERY_URL='./amfphp/json.php?YouYeeViewPoint.getGalleriesData';loader.load(GET_GALLERY_URL,'get');}
noStaticData=true;};var mainContainer=$('main_container');function generateList(dp){clearTimeout(timeout);YEE.controls.StageModal.hideLoadingTips();if(mainContainer){for(var i=0,len=dp.length;i<len;++i){generatePhotoList(dp[i],mainContainer,i);}
return true;}
return false;}
function generatePhotoList(dataProvider,container,index){var span=document.createElement('span');span.className='gallery_title';span.innerHTML=[dataProvider.name,' (',dataProvider.photos.length,')'].join('');var ul=document.createElement('ul');ul.className='photo_list';var photos=dataProvider.photos;for(var i=0,len=photos.length;i<len;++i){photos[i].date=dataProvider.date;generatePhotoItem(photos[i],ul,index,i);}
container.appendChild(span);container.appendChild(ul);}
var descTips=new YEE.controls.Tips('no description');descTips.TWEEN_TIME=0.8;function generatePhotoItem(dp,list,gIndex,pIndex){var li=document.createElement('li');li.className='photo_item';var d=document.createElement('div');d.className='photo_viewer';d.innerHTML=['<a href="javascript:;" onclick="return false;"><div style="background:url(./amfphp/services/images/thumb/',dp.url,') center no-repeat"></div></a>'].join('');var a=d.getElementsByTagName('a')[0];var p=document.createElement('p');p.className='photo_title';p.innerHTML=['<a href="javascript:;" onclick="return false;">',dp.caption,'</a>'].join('');var a2=p.getElementsByTagName('a')[0];var p2=document.createElement('p');p2.className='photo_date';p2.innerHTML=dp.date;li.appendChild(d);li.appendChild(p);li.appendChild(p2);list.appendChild(li);var f=function(evt){showImage(gIndex,pIndex);};YEE.Event.addEventListener(a,YEE.Event.CLICK,f);YEE.Event.addEventListener(a2,YEE.Event.CLICK,f);YEE.Event.addEventListener(a.firstChild,YEE.Event.MOUSE_OVER,function(evt){if(dp.desc){var msg=dp.desc;if(msg.length>20){msg=String(msg).slice(0,19)+'...';}
descTips.setText(msg);descTips.setPositionByElement(li);descTips.show(ua.ie?100:80);}});YEE.Event.addEventListener(a.firstChild,YEE.Event.MOUSE_OUT,function(evt){descTips.hide();});}
function showImage(galleryIndex,photoIndex){if(YEE.controls&&YEE.controls.ImagePreviewer){var photos=[];for(var i=0,len=galleries[galleryIndex].photos.length;i<len;++i){photos[i]={caption:galleries[galleryIndex].photos[i].caption,url:'./amfphp/services/images/'+galleries[galleryIndex].photos[i].url};}
YEE.controls.ImagePreviewer.setViewIndex(photoIndex,photos);}}
YEE.controls.StageModal.showLoadingTips();timeout=setTimeout(function(){YEE.controls.StageModal.hideLoadingTips();},10000)
loader.load(GET_GALLERY_URL,'get');})();