var _$_comments=null;
var _$_comment_page_size=20;
var _$_comment_max_len=1000;
function openFlashPlayer(isEdit,albumId){
var url=jstData.blogUrl+"/prevAlbumPlayer.do?isEdit=";
if(isEdit){
url+="1";
}else{
url+="0";
}
if(url.substring(0,7)!="http://"){
url="http://"+url;
}
if(albumId){
url+='&albumId='+albumId;
}
window.open(url,'_blank','height=480, width=480, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no');
return false;
}
function onBigImageReady(photoSmallId,photoBigId){
photoSmall=document.getElementById(photoSmallId);
photoBig=document.getElementById(photoBigId);
if(!!photoSmall){
photoSmall.style.display="none";
}
if(!!photoBig){
photoBig.style.display="";
}
}
function copyToClipboard(txt){
if(window.clipboardData){
window.clipboardData.clearData();
window.clipboardData.setData('Text',txt);
dwrlog('已成功复制本相册网址','ok');
}else if(navigator.userAgent.indexOf('Opera')!=-1){
window.location=txt;
}else if(window.netscape){
try{
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
}catch(e){
alert('您的firefox安全限制限制您进行剪贴板操作，请打开"about:config"将"signed.applets.codebase_principal_support"设置为"true"之后重试。');
return false;
}
var clip=Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
if(!clip){
return;
}
var trans=Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
if(!trans){
return;
}
trans.addDataFlavor('text/unicode');
var str=new Object();
var len=new Object();
var str=Components.classes['@mozilla.org/supports-string;1'].createInstance(Components.interfaces.nsISupportsString);
var copytext=txt;
str.data=copytext;
trans.setTransferData('text/unicode',str,copytext.length*2);
var clipid=Components.interfaces.nsIClipboard;
if(!clip){
return false;
}
clip.setData(trans,null,clipid.kGlobalClipboard);
dwrlog('已成功复制本相册网址','ok');
}
}
function beforeMoveToPage(){
simpleScrollTo();
}
function downloadToMobile(photo163,closeAllPopWindow163){
closeAllPopWindow163();
if(photo163){
var downloadUrl='http://mmspro.163.com/MMSPlugin?sc=xiangce&fromid=17&imgURL=';
var imgUrl=encodeURIComponent(photo163.url);
downloadUrl+=imgUrl;
window.open(downloadUrl,"_blank","resizable=no,scrollbars=no,status=yes");
}
}
var _$_template_album;
var _$_template_photo;
var _$_template_photo_large;
var _$_template_album_comment;
var _$_template_photo_all;
var _$_template_album_info;
var _$_template_recent_comment;
var _$_album_count_per_page=4;
var _$_photo_count_per_page=8;
var _$_photo_count_per_page_large=4;
var _$_selected_album_idx=-1;
var _$_cur_album_page=0;
var _$_photo_list_mode='small';
var _$_cur_display_type='inAlbum';
var _$_data_page_manager;
var _$_js_simple_page_layer=new NetEase.SimplePageLayer();
var _$_comment_window;
var curAlbum;
var lastSelPhotoId=-1;
var _$_page_layer=new NetEase.PageLayer();
var _$_photo_fav_page_size=24;
var _$_album_fav_page_size=12;
var _$_photo_fav_list=[];
var _$_album_fav_list=[];
var _$_template_photo_fav=null;
var _$_template_album_fav=null;
var _$_photo_fav_CachePage=null;
var _$_album_fav_CachePage=null;
var _$_fav_operate_id;
var _$_fav_owner_user_id;
var _$_server_name;
var _$_template_newalbum_fav=null;
var _$_template_newphoto_fav=null;
var _$_left_side_contents_types=['user','fav'];
var _$_navigator_items=['_$_prev_photo_all','_$_prev_favorite','_$_edit_photo_all','_$_edit_favorite'];
function toggleDisplay(param,noMove){
for(var i=0;i<_$_left_side_contents_types.length;++i){
var type=_$_left_side_contents_types[i];
var div=$('_$_'+type+'_photos');
if(div&&type==param){
div.style.display='block';
}else if(div){
div.style.display='none';
}
}
if(!noMove){
beforeMoveToPage();
}
}
function loadFavorite(){
hideTotal();
_$_selected_album_idx=-1;
if(!_$_template_photo_fav){
_$_template_photo_fav=TrimPath.parseTemplate(jst_photo_fav);
}
if(!_$_template_album_fav){
_$_template_album_fav=TrimPath.parseTemplate(jst_album_fav);
}
if(!_$_template_newalbum_fav){
_$_template_newalbum_fav=TrimPath.parseTemplate(jst_newalbum_fav);
}
if(!_$_template_newphoto_fav){
_$_template_newphoto_fav=TrimPath.parseTemplate(jst_newphoto_fav);
}
_$_photo_fav_CachePage=new NetEase.CachePage({loadParam:{id:favoId},
loadFunc:loadFavPhoto,
presentFunc:showFavPhoto,
pageSize:_$_photo_fav_page_size,
markID:'mark_photo',
styleDir:style,
delIterator:remIt});
_$_photo_fav_CachePage.nextPage();
_$_album_fav_CachePage=new NetEase.CachePage({loadFunc:loadFavAlbum,
presentFunc:showFavAlbum,
pageSize:_$_album_fav_page_size,
markID:'mark_album',
styleDir:style,
delIterator:remIt});
_$_album_fav_CachePage.nextPage();
}
function loadFavPhoto(param,callBack){
Photo.getPhoInFavo(param.id,param.offset,param.limit,callBack);
}
function loadFavAlbum(param,callBack){
Album.getAlbInFavo(param.offset,param.limit,callBack);
}
function loadFavPhotoFrom163(photoId,albumId,apUserName,apUserId){
g_album_controller.getPhotoFav(hostName,apUserName,albumId,parseInt(photoId),function(item){
if(!item.id){
item.id=photoId;
item.url="0";
}
item.userName=apUserName;
item.userId=apUserId;
if(item.au==4&&apUserId!=UD.visitorId){
NewPhoto.isFriend(apUserId,function(isFriend){
if(!isFriend){
item.url="0";
}
$('_$_fav_photo_'+photoId).innerHTML=_$_template_newphoto_fav.process(Object.extend(jstData,{photo:item,prefix:g_urlPrefix,style:style,isEdit:(viewType=="edit")?true:false}));
});
}else{
$('_$_fav_photo_'+photoId).innerHTML=_$_template_newphoto_fav.process(Object.extend(jstData,{photo:item,prefix:g_urlPrefix,style:style,isEdit:(viewType=="edit")?true:false}));
}
});
}
function showFavPhoto(photos){
if(photos.length>0){
$('photoFavo').innerHTML=_$_template_photo_fav.process(Object.extend(jstData,{photoList:photos,prefix:g_urlPrefix,style:style,isEdit:(viewType=="edit")?true:false}));
}else{
var msg='暂无相片收藏';
if(viewType=="edit"){
msg+='，你可以先去浏览其他人的精彩相片';
}
$('photoFavo').innerHTML=msg;
}
}
function loadFavAlbumFrom163(albumId,apUserName,apUserId){
g_album_controller.getAlbum(apUserName,parseInt(albumId),function(item){
if(!item.id){
Album.removeAlbFavo(albumId,apUserId);
Element.remove($('_$_fav_album_'+albumId).parentNode);
}else{
item.userName=apUserName;
item.userId=apUserId;
if(item.au==4&&apUserId!=UD.visitorId){
NewAlbum.isFriend(apUserId,function(isFriend){
if(!isFriend){
item.coverPhUrl="0";
}
$('_$_fav_album_'+albumId).innerHTML=_$_template_newalbum_fav.process(Object.extend(jstData,{album:item,style:style,isEdit:(viewType=="edit")?true:false}))
});
}else{
$('_$_fav_album_'+albumId).innerHTML=_$_template_newalbum_fav.process(Object.extend(jstData,{album:item,style:style,isEdit:(viewType=="edit")?true:false}))
}
}
});
}
function showFavAlbum(albums){
if(albums.length>0){
$('albumFavo').innerHTML=_$_template_album_fav.process(Object.extend(jstData,{albumData:albums,style:style,isEdit:(viewType=="edit")?true:false}));
}else{
var msg='暂无相册收藏';
if(viewType=="edit"){
msg+='，你可以先去浏览其他人的精彩相册';
}
$('albumFavo').innerHTML=msg;
}
}
function remIt(a,b){
return(a==b.id)||(a==-b.id);
}
function doPwd(){
$('form_password').action+=('&pwd='+$('password').value);
$('form_password').submit();
}
function closePwd(){
_$_page_layer.removeLayer('inputPassword');
return false;
}
function removePho(){
Photo.removePhoFavo([_$_fav_operate_id],favoId,_$_fav_owner_user_id,removePhCBK);
return false;
}
function removePhCBK(success){
if(!success){
dwrlog('服务器操作失败 请重试','error');
return false;
}
dwrlog('已取消对该相片的收藏','ok');
_$_photo_fav_CachePage.removeOne(_$_fav_operate_id);
hide_rm_but();
}
function removeAlb(){
Album.removeAlbFavo(_$_fav_operate_id,_$_fav_owner_user_id,removeAlbCBK);
return false;
}
function removeAlbCBK(success){
if(!success){
dwrlog('服务器操作失败 请重试','error');
return false;
}
dwrlog('已取消对该相册的收藏','ok');
_$_album_fav_CachePage.removeOne(_$_fav_operate_id);
hide_rm_but();
}
function cover_rm_but(resourceId,type,userId){
var lfOffset;
var div;
_$_fav_operate_id=resourceId;
_$_fav_owner_user_id=userId;
if(type=='photo'){
if($(resourceId)){
lfOffset=Position.cumulativeOffset($(resourceId));
div=$('_$_del_pho');
}
}else{
var elem=$(resourceId);
if(elem){
lfOffset=Position.cumulativeOffset(elem);
div=$('_$_del_alb');
}
}
if(div){
div.style.left=lfOffset[0]+'px';
div.style.top=lfOffset[1]+'px';
div.style.display="block";
}
}
function hide_rm_but(){
if($('_$_del_alb')){
$('_$_del_alb').style.display='none';
}
if($('_$_del_pho')){
$('_$_del_pho').style.display='none';
}
return false;
}
function show_rm_alb_but(){
if($('_$_del_alb')){
$('_$_del_alb').style.display='block';
}
}
function show_rm_pho_but(){
if($('_$_del_pho')){
$('_$_del_pho').style.display='block';
}
}
function selectAlbumById(id){
for(var i=0;i<g_albumList.length;++i){
if(id==g_albumList[i].id){
return g_albumList[i];
}
}
return null;
}
function selectALbumIdxById(id){
if(id=='allPhoto'){
_$_cur_display_type='allPhoto';
}else{
for(var i=0;i<g_albumList.length;++i){
if(id==g_albumList[i].id){
_$_cur_display_type='inAlbum';
return i;
}
}
}
return-1;
}
function findAlbumToOperate(albumId){
if(!albumId){
if(_$_selected_album_idx>=0){
return g_albumList[_$_selected_album_idx];
}else{
return null;
}
}else{
return selectAlbumById(albumId);
}
}
function toggleAlbumCommentTab(show){
if($('_$_album_comment_tab')){
if(show){
$('_$_album_comment_tab').style.display='';
}else{
$('_$_album_comment_tab').style.display='none';
}
}
}
function showTotal(){
if($('_$_total_bottom')){
$('_$_total_bottom').className='g_t_center';
}
}
function hideTotal(){
if($('_$_total_bottom')){
$('_$_total_bottom').className='g_p_none';
}
}
function BlindUpDownAlbumList(){
if($('_$_album_list')&&$('_$_album_list').style.display=='none'){
Effect.BlindDown('_$_album_list',{duration:0.2,userCallBack:function(){}});
}else{
Effect.BlindUp('_$_album_list',{duration:0.2,userCallBack:function(){}});
}
return false;
}
function showAllPhotos(){
_$_selected_album_idx=-1;
if(_$_cur_display_type!="allPhoto"){
_$_cur_display_type='allPhoto';
displayAllPhoto();
}
return false;
}
function showSelfPhotos(){
_$_selected_album_idx=-1;
if(_$_cur_display_type!="selfPhoto"){
_$_cur_display_type='selfPhoto';
displaySelfCapPhoto();
}
return false;
}
function findFirstAlbumToDisplay(){
if(_$_selected_album_idx==-1){
for(var i=0;i<g_albumList.length;++i){
var album=g_albumList[i];
if(UD.visitorRank==10000){
if(album.photoCount>0){
_$_selected_album_idx=i;
break;
}
}else{
if(album.hasPassword!=0){
continue;
}else{
if(parseInt(UD.visitorRank)>=100){
if(album.friendPhotoCount-album.pwdFriendPhotoCount>0){
_$_selected_album_idx=i;
break;
}
}else if(parseInt(UD.visitorRank)>=-100){
if(album.guestPhotoCount-album.pwdGuestPhotoCount>0){
_$_selected_album_idx=i;
break;
}
}
}
}
}
}
if(_$_selected_album_idx>=0){
_$_cur_album_page=Math.floor(_$_selected_album_idx/_$_album_count_per_page);
}else{
_$_cur_album_page=0;
}
}
function display(){
toggleDisplay('user',true);
var hash=location.hash;
if(hash=='#allPhoto'){
_$_cur_display_type='allPhoto';
}
if(g_albumList.length>0&&_$_cur_display_type=='inAlbum'){
_$_cur_display_type='inAlbum';
findFirstAlbumToDisplay();
if(_$_selected_album_idx<0){
_$_selected_album_idx=0;
}
var album=g_albumList[_$_selected_album_idx];
Element.addClassName('wrapper_'+album.id,"g_htc_item_selected");
displayInAlbum();
}else{
_$_cur_display_type='allPhoto';
Element.addClassName('_$_show_all_photo',"g_htc_item_selected");
displayAllPhoto();
}
}
function displayInAlbum(){
var album=g_albumList[_$_selected_album_idx];
showAlbumListByPage(_$_cur_album_page);
initSelectAlbum('wrapper_'+album.id);
Element.addClassName('wrapper_'+album.id,"g_htc_item_selected");
toggleAlbumCommentTab(true);
}
function showAlbumListByPage(idx){
_$_cur_album_page=idx;
var isLastPage=true;
var endIdx=(idx+1)*_$_album_count_per_page;
var cur_album_array=g_albumList.slice(idx*_$_album_count_per_page,endIdx);
if(endIdx<g_albumList.length){
isLastPage=false;
}
$('_$_album_list').innerHTML=_$_template_album.process(Object.extend(jstData,{pageIdx:idx,isLastPage:isLastPage,album:cur_album_array,selected_idx:_$_selected_album_idx,viewType:viewType}));
var album=g_albumList[_$_selected_album_idx];
if(album&&_$_cur_display_type=='inAlbum'){
var elem=$('wrapper_'+album.id);
if(elem){
Element.addClassName(elem.parentNode,"selitm c07 g_t_bold");
window.$$_last_select=elem.parentNode;
}
}
}
function showTip(elementId){
if(elementId=='_$_previous_albums'||
elementId=='_$_next_albums'){
if($(elementId)){
$(elementId).style.backgroundColor='#DDDDDD';
$(elementId+'_tip').style.visibility='visible';
}
}
}
function hideTip(elementId){
if(elementId=='_$_previous_albums'||
elementId=='_$_next_albums'){
if($(elementId)){
$(elementId).style.backgroundColor='transparent';
$(elementId+'_tip').style.visibility='hidden';
}
}
}
function equalAlbumId(elementId,albumId){
return(elementId=='wrapper_'+albumId);
}
function isUnassortedAlbum(albumId){
return albumId=="-1";
}
function isSelfCapAlbum(albumId){
return albumId=="-2";
}
function initSelectAlbum(elementId){
hideTotal();
var p=getActualPage();
try{
for(var i=0;i<g_albumList.length;++i){
if(equalAlbumId(elementId,g_albumList[i].id)){
_$_selected_album_idx=i;
_$_data_page_manager=null;
hideComment();
var album=g_albumList[_$_selected_album_idx];
refreshAlbumInfo(album);
if(p){
showPhotoListInAlbum(album,p);
}else{
showPhotoListInAlbum(album,1);
}
refreshAlbumCommentTab(album);
if(!isUnassortedAlbum(album.id)){
showHideComment('_$_comment_area');
Album.updateAlbumAccessCount(album.id,{callback:function(ac){
var elem=$('_$_album_ac_count');
if(elem){
elem.innerHTML='浏览('+ac+')';
}
}});
}
break;
}
}
}catch(e){
return false;
}
return false;
}
function selectAlbum(elementId){
try{
hideTotal();
if(_$_cur_display_type!='inAlbum'){
_$_cur_display_type='inAlbum';
}
toggleDisplay('user');
for(var i=0;i<g_albumList.length;++i){
if(equalAlbumId(elementId,g_albumList[i].id)){
_$_selected_album_idx=i;
_$_data_page_manager=null;
hideComment();
var album=g_albumList[_$_selected_album_idx];
refreshAlbumInfo(album);
showPhotoListInAlbum(album,1);
refreshAlbumCommentTab(album);
if(!isUnassortedAlbum(album.id)){
showHideComment('_$_comment_area');
Album.updateAlbumAccessCount(album.id,{callback:function(ac){
var elem=$('_$_album_ac_count');
if(elem){
elem.innerHTML='浏览('+ac+')';
}
}});
}
break;
}
}
}catch(e){
return false;
}
return false;
}
function refreshAlbumInfo(album){
curAlbum=album;
if($('_$_album_info')){
$('_$_album_info').innerHTML=_$_template_album_info.process({album:album,viewMode:_$_photo_list_mode,mode:'album',visitorRank:jstData.visitorRank});
}
if(album.tag==null){
album.tag="";
}
var tagList=album.tag.split(",");
var isEdit=false;
if(viewType=='edit')
isEdit=true;
new NetEase.AlbumTag('_$$_album_tag',album.id,'albumTag',album.createTime,albumAddTagFunc,albumUpdateTagFunc,tagList,isEdit,2,
{dataStream:g_albumList,itemIdx:'tag'});
closeAllWindow();
regPlaceEditAlbums();
}
function albumAddTagFunc(resouceId,tags,tagAdd,numJoinTagRc,innerType,createTime,callBackFunc){
AlbumMisc.addOrDelTag(resouceId,innerType,tags,tagAdd,"",numJoinTagRc,-100,curAlbum.hasPassword?0:1,createTime,{
callback:callBackFunc,
errorHandler:function(errorString,ex){
filterWarning(ex,false);;
}
});
}
function albumUpdateTagFunc(resourceId,tags,tagDel,innerType,createTime,callBackFunc){
AlbumMisc.addOrDelTag(resourceId,innerType,tags,"",tagDel,0,-100,curAlbum.hasPassword?0:1,createTime,callBackFunc);
}
function getActualPage(){
var matches=window.location.href.match(/#p(\d+)$/);
if(matches==null){
return null;
}
var page=parseInt(matches[1],10);
if(page==0){
return null;
}
return page;
}
function getPageSize(){
return(_$_photo_list_mode=='small')?_$_photo_count_per_page:_$_photo_count_per_page_large;
}
function moveToPage(toPage){
if(_$_data_page_manager){
if(toPage<1)return;
if(toPage!=1&&toPage>_$_data_page_manager.getLastPage()){
moveToPage(1);
return;
}
_$_data_page_manager.moveToPage(toPage);
if(toPage!=_$_data_page_manager.getCurPage()){
_$_data_page_manager.curPageNum=toPage;
}
var p=getActualPage();
if(!p){
if(window.location.href.charAt(window.location.href.length-1)!='#'){
window.location.href+='#p'+toPage;
}else{
window.location.href+='p'+toPage;
}
}else if(p!=toPage){
var pp='#p'+toPage
window.location.href=window.location.href.replace(/#p(\d+)$/,pp);
}
_$_data_page_manager.refreshMark();
showHidePageMark();
}
}
function showPhotoListInAlbum(album,toPage){
var pageSize=getPageSize();
if(!_$_data_page_manager){
if(album.photoCount!=0){
if(album.photoList){
getPhotosInAlbumCallBack(album.photoList,toPage);
}else{
Photo.getPhotosInAlbum(album.id,album.seqType,0,pageSize,
{
callback:function(returndata){
getPhotosInAlbumCallBack(returndata,toPage);
},
errorHandler:function(errorString,ex){}
}
)
}
}
else{
getPhotosInAlbumCallBack([],1);
}
}else{
moveToPage(_$_data_page_manager.getCurPage());
}
}
function showHidePageMark(){
if(_$_data_page_manager.getLastPage()<=1){
$('_$_page_mark_top').innerHTML='<br />';
$('_$_page_mark_bottom').innerHTML='<br />';
}
}
function hidePageMark(){
$('_$_page_mark_top').innerHTML='<br />';
$('_$_page_mark_bottom').innerHTML='<br />';
}
function getPhotosInAlbumCallBack(photoList,toPage){
var album=g_albumList[_$_selected_album_idx];
album.photoList=photoList;
var pageSize=getPageSize();
var markArea=[
{markId:'_$_page_mark_bottom',totalId:'_$_total_bottom'},
{markId:'_$_page_mark_top',totalId:'_$_total_top'}
];
var apCount=album.photoCount;
if(viewType=='prev'){
apCount=calculateAlbumPhotoCountWithRank(album);
}
_$_data_page_manager=new NetEase.DataPage(photoList,{resourceID:album.id,
pageSize:pageSize,moreDataFunc:getMorePhotosInAlbum,afterCallBack:showPhotoList,
totalLength:apCount,objName:'_$_data_page_manager',
dofirst:closeAllWindow,markArea:markArea,markLength:11,hiddenMark:false,newPageMark:true});
moveToPage(toPage);
}
function getMorePhotosInAlbum(albumId,offset,limit,callback){
var album=g_albumList[_$_selected_album_idx];
Photo.getPhotosInAlbum(albumId,album.seqType,offset,limit,callback);
}
function calculateAlbumPhotoCountWithRank(album){
var count=album.photoCount;
if(album.checkPassword==1){
if(album.hasPassword==0){
if(jstData.visitorRank>=100){
count=album.friendPhotoCount-album.pwdFriendPhotoCount;
}else if(jstData.visitorRank<=0){
count=album.guestPhotoCount-album.pwdGuestPhotoCount;
}
}else{
if(jstData.visitorRank>=100){
count=album.friendPhotoCount;
}else if(jstData.visitorRank<=0){
count=album.guestPhotoCount;
}
}
}else if(album.hasPassword==0){
if(jstData.visitorRank>=100){
count=album.friendPhotoCount-album.pwdFriendPhotoCount;
}else if(jstData.visitorRank<=0){
count=album.guestPhotoCount-album.pwdGuestPhotoCount;
}
}else{
if(jstData.visitorRank>=100){
count=album.friendPhotoCount;
}
else if(jstData.visitorRank<=0){
count=album.guestPhotoCount;
}
}
return count;
}
function showPhotoList(photoStream,start,end){
var album=g_albumList[_$_selected_album_idx];
var div=$('_$_photo_list_content');
var photoToShow=photoStream.slice(start,end+1);
for(var i=start;i<end+1;++i){
photoStream[i].index=i;
}
var apCount=album.photoCount;
if(viewType=='prev'){
apCount=calculateAlbumPhotoCountWithRank(album);
}
if(_$_photo_list_mode=='small'){
div.innerHTML=_$_template_photo.process(Object.extend(jstData,{photo:photoToShow,photoCount:apCount,type:_$_cur_display_type,album:album,mode:'small'}));
}else{
div.innerHTML=_$_template_photo_large.process(Object.extend(jstData,{photo:photoToShow,photoCount:apCount,type:_$_cur_display_type,album:album,mode:'large'}));
}
if(apCount>0){
regPlaceEditPhotos(photoToShow);
}
if($('_$_album_prev_password')){
$('_$_album_prev_password').focus();
$('_$_album_prev_password').focus();
}
}
function switchViewType(mode){
if(g_albumList.length>0){
if(_$_photo_list_mode!=mode){
_$_photo_list_mode=mode;
var album=g_albumList[_$_selected_album_idx];
refreshAlbumInfo(album);
if(!_$_data_page_manager){
showPhotoListInAlbum(album,1);
}else{
if(mode=='large'){
var toPage=(_$_data_page_manager.getCurPage()-1)*2+1;
}else{
var toPage=Math.floor((_$_data_page_manager.getCurPage()-1)/2)+1;
}
_$_data_page_manager=null;
showPhotoListInAlbum(album,toPage);
}
}
}
return false;
}
function switchViewTypeAllPhotos(mode){
if(_$_photo_list_mode!=mode){
_$_photo_list_mode=mode;
if(!_$_data_page_manager){
displayAllPhoto();
}else{
if(mode=='large'){
var toPage=(_$_data_page_manager.getCurPage()-1)*2+1;
}else{
var toPage=Math.floor((_$_data_page_manager.getCurPage()-1)/2)+1;
}
_$_data_page_manager=null;
displayAllPhotoToPage(toPage);
}
}
}
function showHideComment(id){
var commDiv=$(id);
if(commDiv){
if(commDiv.style.display=='none'){
if(!_$_comments&&g_albumList[_$_selected_album_idx]){
$('_$_comments').innerHTML='正在加载评论...';
$('_$_comment_editor').style.display='none';
loadComment(g_albumList[_$_selected_album_idx]);
}
Effect.BlindDown(id,{duration:0.2,userCallBack:function(){}});
$('_$_open_comment').className='bdl bdr s';
$('_$_album_bottom_bar').className+=' bdb';
}else{
Effect.BlindUp(id,{duration:0.2,userCallBack:function(){}});
$('_$_open_comment').className='bdl bdr';
$('_$_album_bottom_bar').className=$('_$_album_bottom_bar').className.replace(/\sbdb/,'');
}
}
return false;
}
function refreshAlbumCommentTab(album){
if(!album){
return;
}
_$_comments=null;
$('_$_album_comment_tab').innerHTML=_$_template_album_comment.process({album:album,visitorRank:jstData.visitorRank});
toggleAlbumCommentTab(true);
}
function loadComment(album){
AlbumMisc.getAllAPComment(album.id,0,0,_$_comment_page_size,{callback:function(comments){firstLoadComClk(album,comments);}});
return false;
}
function firstLoadComClk(album,comments){
if(comments==null){
dwrlog('服务器操作失败 请重试!')
return false;
}
processComment(comments);
var tmpVisitorNickname=jstData.visitorNickname;
var supportDeleteComment=true;
var allowComment=jstData.comRank;
if(isMigrating()){
supportDeleteComment=false;
allowComment=100000;
}
if(!_$_comments){
var option={
bCanClose:true,bSupportDeleteComment:supportDeleteComment,
bNeedCheckLogin:false,bNeedCheckRight:true,iAllowComment:allowComment,iPageSize:_$_comment_page_size,
iHostId:jstData.hostId,sHostName:jstData.hostName,iVisitorId:jstData.visitorId,sVisitorName:jstData.visitorName,
sVisitorNickname:tmpVisitorNickname,sVisitorAvatar:jstData.visitorAvatar,iVisitorRank:jstData.visitorRank,sVisitorIP:jstData.visitorIP,bShowSpaceUrl:true,
iInputWidth:460,iEditorWidth:0,iEditorHeight:90,fnOpenCommentEffect:null,
fnAddComment:addNewComment,oAddCommentParams:{parentId:album.id},
fnDelComment:delComment,oDelCommentParams:{parentId:album.id},
fnMoreData:getCommentsByPage,
fnAfterAddComment:afterAddComment,oAfterAddCommentParams:{parentId:album.id},
fnAfterDelComment:afterDelComment,oAfterDelCommentParams:{parentId:album.id},fnReportBad:reportBad,
fnCloseComments:closeComments,sObjName:'_$_comments',bDefaultPubClose:false,iEditorMaxLen:_$_comment_max_len,
sUrlPrefix:g_urlPrefix
};
_$_comments=new NetEase.CommentPublishAlbum(comments,album.id,album.commentCount,'_$_comments','_$_comment_editor',option);
if(isMigrating()){
$('_$_comment_editor').style.display='none';
}else{
$('_$_comment_editor').style.display='';
}
}
}
function addNewComment(newComment,params,postAddCommentFunc){
var filterType=0;
var valcodeelem=$("valcode"+params.valcodeid);
var valcode;
if(valcodeelem!=null)
valcode=valcodeelem.value;
else
valcode=-1;
Comm={};
Comm.APId=newComment.parentId;
Comm.type=0;
Comm.content=newComment.content;
Comm.userName=newComment.publisherName;
Comm.publisherNickname=newComment.publisherNickname;
Comm.publisherAvatarUrl=newComment.publisherAvatarUrl;
Comm.squareUrl=params.squareUrl;
Comm.ip=newComment.ip;
Comm.ipName=newComment.ipName;
Comm.replyToUserId=newComment.replyToUserId;
if(!Comm.replyToUserId)Comm.replyToUserId=0;
if(jstData.visitorRank<Const.Rank.Friend){
var match=checkOtherSiteUrl(newComment.content);
if(match){
alert(Local.Message.Blog[0]);
postAddCommentFunc(null);
return false;
}
}
AlbumMisc.addAPComment(Comm,filterType,params.valcodeid,valcode,0,{
callback:function(dataFromServer){
dataFromServer.publisherName=dataFromServer.userName;
dataFromServer.publisherId=dataFromServer.userId;
postAddCommentFunc(dataFromServer);
},
errorHandler:function(errorString,ex){
if(captchaWarning(ex,"$$_comsubmithint"+newComment.parentId)){
postAddCommentFunc(null);
return false;
}
var filterType=filterWarning(ex);
if(filterType==-1){
postAddCommentFunc(null);
return false;
}
postAddCommentFunc(null);
}
});
}
function afterAddComment(comm,param){
var album=g_albumList[_$_selected_album_idx];
if(album.id==param.parentId){
album.commentCount+=1;
$('_$_comment_count').innerHTML='相册评论('+album.commentCount+')';
}
}
function getCommentsByPage(albumId,limit,offset,postPageCommentFunc){
AlbumMisc.getAllAPComment(albumId,0,offset,limit,{
callback:function(dataFromServer){
processComment(dataFromServer);
postPageCommentFunc(dataFromServer);
}
});
}
function processComment(comments){
for(var i=0;i<comments.length;i++){
comments[i].publisherName=comments[i].userName;
comments[i].publisherId=comments[i].userId;
}
}
function hideComment(){
if($('_$_comment_area')){
$('_$_comment_area').style.display='none';
}
}
function closeComments(){
var id='_$_comment_area';
var commDiv=$(id);
if(commDiv){
Effect.BlindUp(id,{duration:0.2,userCallBack:function(){}});
$('_$_open_comment').className='bdl bdr';
if($('_$_album_bottom_bar')){
$('_$_album_bottom_bar').className=$('_$_album_bottom_bar').className.replace(/\sbdb/,'');
}
}
}
function reportBad(report,postReportFunc){
PreUserReportBean.addUserReport(report,postReportFunc);
}
function loadRecentComment(){
var pos=Position.cumulativeOffset($('_$_id_recent_comment'));
_$_comment_window=jsWindowManager.createWindow('_$_recent_comment_window',{
className:'',width:480,height:570,
title:'最新评论',onTop:true});
_$_comment_window.panel.innerHTML='<div align="center">数据加载中...</div>';
_$_comment_window.options.notKeepPos=true;
AlbumMisc.getRecentComments(hostName,10,1,showRecentComment);
_$_comment_window.showWindow();
}
function showRecentComment(comments){
while(comments.length>10){
comments.pop();
}
_$_comment_window.panel.innerHTML=_$_template_recent_comment.process({comments:comments,urlPre:viewType,prefix:g_urlPrefix})
}
function displayAllPhoto(){
displayAllPhotoToPage(1);
}
function displayAllPhotoToPage(toPage){
_$_selected_album_idx=-1;
showAlbumListByPage(_$_cur_album_page);
var markArea=[
{markId:'_$_page_mark_bottom',totalId:'_$_total_bottom'},
{markId:'_$_page_mark_top',totalId:'_$_total_top'}
];
var pageSize=getPageSize();
$('_$_total_bottom').style.display='';
if($('_$_album_info')){
$('_$_album_info').innerHTML=_$_template_album_info.process({album:null,viewMode:_$_photo_list_mode,mode:'allPhoto'});
}
showTotal();
toggleAlbumCommentTab(false);
hideComment();
_$_data_page_manager=new NetEase.DataPage(g_photoList,{resourceID:'',pageSize:pageSize,moreDataFunc:getMorePhotos,
afterCallBack:showPhotos,totalLength:photoCount,dofirst:closeAllWindow,
objName:'_$_data_page_manager',markArea:markArea,newPageMark:true});
moveToPage(toPage);
}
function displaySelfCapPhoto(){
displaySelfCapPhotoToPage(1);
}
function displaySelfCapPhotoToPage(toPage){
_$_selected_album_idx=-1;
showAlbumListByPage(_$_cur_album_page);
var markArea=[
{markId:'_$_page_mark_bottom',totalId:'_$_total_bottom'},
{markId:'_$_page_mark_top',totalId:'_$_total_top'}
];
var pageSize=getPageSize();
$('_$_total_bottom').style.display='';
if($('_$_album_info')){
$('_$_album_info').innerHTML=_$_template_album_info.process({album:null,viewMode:_$_photo_list_mode,mode:'selfPhoto'});
}
showTotal();
toggleAlbumCommentTab(false);
hideComment();
_$_data_page_manager=new NetEase.DataPage([],{resourceID:'',pageSize:pageSize,moreDataFunc:getMoreSelfCapPhotos,
afterCallBack:showPhotos,totalLength:selfCapPhotoCount,dofirst:closeAllWindow,
objName:'_$_data_page_manager',markArea:markArea,newPageMark:true});
moveToPage(toPage);
}
function getMorePhotos(userId,offset,limit,callback){
Photo.getPhotosInUser(offset,limit,callback);
}
function showPhotos(photoList,start,end){
var photoToShow=photoList.slice(start,end+1);
for(var i=start;i<end+1;++i){
photoList[i].index=i;
}
var div=$('_$_photo_list_content');
if(_$_photo_list_mode=='small'){
div.innerHTML=_$_template_photo.process(Object.extend(jstData,{photo:photoToShow,photoCount:photoCount,type:_$_cur_display_type,mode:'small'}));
}else{
div.innerHTML=_$_template_photo_large.process(Object.extend(jstData,{photo:photoToShow,photoCount:photoCount,type:_$_cur_display_type,mode:'large'}));
}
if(photoCount>0){
regPlaceEditPhotos(photoToShow);
}
}
function getMoreSelfCapPhotos(userId,offset,limit,callback){
Photo.getSelfCapPhotos(1,limit,offset,callback);
}
function copyAlbumUrl(){
var albumUrl=jstData.blogUrl+"/prevAlbumsInUser.do?albumId="+g_albumList[_$_selected_album_idx].id;
if(albumUrl.substring(0,7)!="http://"){
albumUrl="http://"+albumUrl;
}
copyToClipboard(albumUrl);
}
function clickSelectPhoto(bSelect,sPhotoId){
if(bSelect){
var wrapDiv=$('wrapper_p_'+sPhotoId);
if(wrapDiv){
if(lastSelPhotoId!=-1){
removeLastSelectedPhoto();
}
Element.addClassName('wrapper_p_'+sPhotoId,'clksel');
lastSelPhotoId=sPhotoId;
}
}else{
removeLastSelectedPhoto();
}
}
function removeLastSelectedPhoto(){
var wrapDiv=$('wrapper_p_'+lastSelPhotoId);
if(wrapDiv!=null){
Element.removeClassName('wrapper_p_'+lastSelPhotoId,'clksel');
lastSelPhotoId=-1;
}
}
function doEvent(el){
if(el.id.indexOf('wrapper_p_')<0){
if(el.id.indexOf('_$_photo_menu')<0&&el.id.indexOf('photo_man')<0&&el.id.indexOf('photo_act')<0){
removeLastSelectedPhoto();
}else{
}
}
}
function attachClickPhotoEvent(){
if(window.attachEvent){
document.attachEvent("onclick",function(e){
var el=event.srcElement;
doEvent(el);
});
}
if(window.addEventListener){
document.addEventListener("click",function(e){
var el=e.target;
doEvent(el);
},false);
}
}
function attachPhotoPopupWindowEvent(popupWindowId){
if($(popupWindowId)){
if(window.attachEvent){
$(popupWindowId).attachEvent("onclick",function(e){
event.cancelBubble=true;
})
}
if(window.addEventListener){
$(popupWindowId).addEventListener("click",function(e){
e.stopPropagation();
},false)
}
}
}
function shareAlbumByEmail(){
var album=g_albumList[_$_selected_album_idx];
if(album){
var albumCover=album.coverPhUrl;
if(albumCover=="0"||albumCover==""){
albumCover=Const.STDomain+"/style/common/album_face.gif";
}
var url=jstData.blogUrl+"/prevAlbumsInUser.do?albumId="+album.id;
if(url.substring(0,7)!='http://'){
url='http://'+url;
}
if(!_$_share_by_email){
_$_share_by_email=new NetEase.ShareByEmail({aId:'_$_share_album',jsWindowManager:jsWindowManager,
visitorName:jstData.visitorName,type:'album',url:url,content:albumCover,title:album.albumName});
}else{
_$_share_by_email.refreshNew({aId:'_$_share_album',type:'album',url:url,content:albumCover,title:album.albumName});
}
}
}
function isMigrating(){
return migStat==2;
}
var unassortedAlbumId="-1";
var selfCapAlbumId="-2";
var jst_del_fav_alb=new String('\
<div id="_$_del_alb" style="display:none;z-index:1000;position:absolute" onmouseover="show_rm_alb_but()">\
<span onclick="return removeAlb()" class="n_ n6 g_c_hand" title="从收藏中移除" alt="从收藏中移除">&nbsp;</span>\
</div>\
');
var jst_del_fav_pho=new String('\
<div id="_$_del_pho" class="g_c_hand" style="display:none;z-index:1000;position:absolute" onmouseover="show_rm_pho_but()">\
 <span onclick="return removePho()" class="n_ n6 g_c_hand" title="从收藏中移除" alt="从收藏中移除">&nbsp;</span>\
</div>\
');
var jst_photo_fav=new String('\
 {for photo in photoList}\
 {if (isNaN(parseInt(photo.id))) || parseInt(photo.id)>0}\
    <div class="g_img_11">\
      {if photo.url!="0"}\
        <a href="http://${photo.userName|parentDomain}${prefix}/prevPhoto.do?photoId=${photo.id}" target="_blank">\
        <img class="g_img_02 bd01" id="${photo.id}" src="${photo.squareUrl}" {if isEdit}onmouseover="cover_rm_but(\'${photo.id}\', \'photo\', \'${photo.userId}\')" onmouseout="hide_rm_but()"{/if} \
           {if photo.description!=null} alt="${photo.description|escape}" title="${photo.description|escape}" {/if} />\
      </a>\
    {else}\
      <img class="g_img_02 bd01" id="${photo.id}" src="http://b.bst.126.net/style/common/pic_private.gif" {if isEdit}onmouseover="cover_rm_but(\'${photo.id}\', \'photo\', \'${photo.userId}\')" onmouseout="hide_rm_but()"{/if}/>\
      {/if}\
    </div>\
   {else}\
    <div class="g_img_11">\
     <div id="_$_fav_photo_${-photo.id}">\
     <img src="http://b.bst.126.net/style/common/pic_load.gif" onload="loadFavPhotoFrom163(\'${-photo.id}\', \'${photo.albumId}\', \'${photo.userName}\', \'${photo.userId}\')">\
   </div></div>\
   {/if}\
 {/for}\
');
var jst_newphoto_fav=new String('\
    {if photo.url!="0"}\
       <a href="http://${photo.userName|parentDomain}${prefix}/prevPhoto.do?photoId=${photo.id}&albumId=${photo.albumId}" target="_blank">\
       <img class="g_img_02 bd01" id="${photo.id}" src="${photo.squareUrl}" {if isEdit}onmouseover="cover_rm_but(\'${photo.id}\', \'photo\', \'${photo.userId}\')" onmouseout="hide_rm_but()"{/if} \
          {if photo.description!=null} alt="${photo.description|escape}" title="${photo.description|escape}" {/if} />\
     </a>\
  {else}\
    <img class="g_img_02 bd01" id="${photo.id}" src="http://b.bst.126.net/style/common/pic_private.gif" {if isEdit}onmouseover="cover_rm_but(\'${photo.id}\', \'photo\', \'${photo.userId}\')" onmouseout="hide_rm_but()"{/if}/>\
    {/if}\
');
var jst_album_fav=new String('\
 {for album in albumData}\
 {if album.id!=null}\
  <div class="g_p_left g_img_01n">\
   {if (isNaN(parseInt(album.id))) || parseInt(album.id)>0}\
    <div class="g_p_relative p_ p29 g_c_hand" onclick="window.open(\'http://${album.userName|parentDomain}\' + \'/prevAlbumsInUser.do?albumId=${album.id}\');return false;">\
     <img id="${album.id}" alt="${album.albumName|escape}" src=\
     {if album.hasPassword==1} \
      "http://b.bst.126.net/style/common/lockalbum.gif" \
     {elseif (album.coverPhUrl =="0" || album.coverPhId=="0" || album.au==2)}\
      "http://b.bst.126.net/style/common/album_face.gif" \
     {else}\
      "${album.coverPhUrl}" \
     {/if}\
      {if isEdit}onmouseover="cover_rm_but(\'${album.id}\', \'album\', \'${album.userId}\')" onmouseout="hide_rm_but()"{/if}>\
    </div>\
    <div class="g_t_hide c07" style="font-size:14px">${album.albumName|escape}</div>\
    <div class="g_t_hide c09">${album.photoCount} 张相片</div>\
   {else}\
    <div id="_$_fav_album_${-album.id}">\
     <img src="http://b.bst.126.net/style/common/p0.gif" onload="loadFavAlbumFrom163(\'${-album.id}\', \'${album.userName}\', \'${album.userId}\')">\
    </div>\
   {/if}\
  </div>\
 {/if}{/for}\
');
var jst_newalbum_fav=new String('\
 {if album.id!=null}\
   <div class="g_p_relative p_ p29 g_c_hand" onclick="window.open(\'http://${album.userName|parentDomain}\' + \'/prevAlbumsInUser.do?albumId=${album.id}\');return false;">\
     <img id="${album.id}" alt="${album.albumName|escape}" src=\
     {if album.hasPassword==1} \
      "http://b.bst.126.net/style/common/album_cover_pwd.gif" \
     {elseif album.au==2}\
      "http://b.bst.126.net/style/common/album_cover_private.gif" \
     {elseif (album.coverPhUrl == null || album.coverPhUrl == "" || album.coverPhUrl =="0" || album.coverPhId=="0")}\
      "http://b.bst.126.net/style/common/album_face.gif" \
     {else}\
      "${album.coverPhUrl}" \
     {/if}\
      {if isEdit}onmouseover="cover_rm_but(\'${album.id}\', \'album\', \'${album.userId}\')" onmouseout="hide_rm_but()"{/if}>\
    </div>\
    <div class="g_t_hide c07" style="font-size:14px">${album.albumName|escape}</div>\
    <div class="g_t_hide c09">${album.photoCount} 张相片</div>\
 {/if}\
');
var jst_photo_slide=new String('\
  <div id="nextprev_slide${albumId}" class="g_pht_player {if !isOpen} g_pht_player_close{/if}">\
   <div class="titlebar">\
    <div id="nextprev_button_stream${albumId}" class="l brd01">\
     <div class="cls selitm" ><span class="n_ f24" title="展开">&nbsp;</span></div>\
     <div class="opn selitm"><span class="n_ f23" title="折叠">&nbsp;</span></div>\
    </div>\
    <div class="c brd01">&nbsp;</div>\
    <div class="r brd01 selitm">\
     <span class="n_ f25" title="打开幻灯片" onclick="openPlayer(\'${albumId}\');return false;">&nbsp;</span>\
     {if migStat!=2 && albumId!=unassortedAlbumId && albumId!=selfCapAlbumId && albumId!="0" && urlPre=="edit"}\
     <span class="n_ f18b" title="从该相册中移除" onclick="rmFromAlbum(\'${albumId}\');return false;">&nbsp;</span>\
     {/if}\
     <div class="g_t_hide c05">\
      <a href="\
        {if albumId=="0"}\
         ${urlPre}AlbumsInUser.do?host=${hostName}#allPhoto">\
        {else}\
         ${urlPre}Album.do?host=${hostName}&albumId=${albumId}">\
        {/if}\
       <span>${albumName}</span>\
      <span class="albumNameText" id="photo_count_${albumId}">(${photoCount})</span></a>\
     </div>\
    </div><div class="g_p_clear g_t_space">&nbsp;</div>\
   </div>\
   <div id="nextprev_table_stream${albumId}" class="body brd01 opn">\
    <div class="previewSlideWrapperDiv">\
     <div id="previewSlideDiv_${albumId}" class="previewSlideDiv"></div>\
    </div>\
    <div class="btnbar">\
     <table style="width:162px;margin-left:12px;"><tr>\
      <td style="text-align:left;"><a style="margin:0px auto;" id="nextprev_thumb_prev_${albumId}"  class="prev c09"  href="#">&lt;上一张</a></td>\
      <td style="text-align:center;"><a style="margin:0px auto;" id="nextprev_thumb_reset_${albumId}" class="reset c09" href="#" title="回到最初位置"  onclick="navToCur(\'${albumId}\');return false;">复位</a></td>\
      <td style="text-align:right;"><a style="margin:0px auto;" id="nextprev_thumb_next_${albumId}"  class="next c09"  href="#">下一张&gt;</a></td>\
     </tr></table>\
    </div>\
   </div>\
  </div>\
');
var jst_note_text=new String('\
 <table class="corcnt" id="notes_text_table" border="0" cellspacing="0" cellpadding="0">\
   <tr><td class="corn"><img src="http://b.bst.126.net/style/common/tc_yellow_tl.gif" /></td><td>&nbsp;</td>\
     <td class="corn"><img src="http://b.bst.126.net/style/common/tc_yellow_tr.gif" /></td></tr>\
   <tr><td></td><td class="cnt">\
    <span class="text_span" id="notes_text_span" style="color:#000;"></span>\
    <div id="notes_text_form"><textarea id="notes_text_area"></textarea></div>\
   </td><td></td></tr>\
   <tr><td class="corn"><img src="http://b.bst.126.net/style/common/tc_yellow_bl.gif" /></td><td>&nbsp;</td>\
     <td class="corn"><img src="http://b.bst.126.net/style/common/tc_yellow_br.gif" /></td></tr>\
 </table>\
 <div class="btn">\
   <div class="nte" id="notes_text_buttons_form">\
    <input id="save_note_button" type="button" class="btncm btnok" value="保存" onclick="$(\'${eId}\').EXT.save_editing();" />\
    <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>\
    <input id="delete_note_button" type="button" class="btncm btncc" value="删除" onclick="$(\'${eId}\').EXT.delete_note();" />\
    <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>\
    <input id="cancel_note_button" type="button" class="btncm btncc" value="取消" onclick="$(\'${eId}\').EXT.cancel_editing();" />\
   </div>\
   <div class="clp" id="clip_buttons_form">\
    <input name="trim_mypic_check" id="trim_mypic_check" type="checkbox" value="" /><label for="trim_mypic_check">设为头像</label>\
    <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>\
    <input name="trim_delete_check" id="trim_delete_check" type="checkbox" value="" /><label for="trim_delete_check">删除原图</label>\
    <br />\
    <input type="button" class="btncm btnok" value="裁剪" onclick="$(\'${eId}\').EXT.save_editing();" />\
    <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>\
    <input id="delete_note_button" type="button" class="btncm btncc" value="取消" onclick="$(\'${eId}\').EXT.cancel_editing();" />\
   </div>\
 </div>\
 <div id=\"temp_div\" style=\"visibility:hidden; width:200px;\"></div>\
');
var jst_note_shadow=new String('\
 <table class="shadow" id="shadow_table" border="0" cellpadding="0" cellspacing="0"><tbody>\
   <tr><td class="scrn tl"><img src="http://b.bst.126.net/style/common/tc_white_shadow_tl.png"></td>\
     <td class="scnt tc" id="shadow_width_controller"><img id="shadow_width_controller_img" src="http://b.bst.126.net/style/common/tc_white_shadow_t.png"></td>\
     <td class="scrn tr"><img src="http://b.bst.126.net/style/common/tc_white_shadow_tr.png" border="0"></td></tr>\
   <tr><td class="ccrn cl" id="shadow_height_controller_l"><img id="shadow_height_controller_l_img" src="http://b.bst.126.net/style/common/tc_white_shadow_l.png"></td>\
     <td></td>\
     <td class="ccrn cr" id="shadow_height_controller_r"><img id="shadow_height_controller_r_img" src="http://b.bst.126.net/style/common/tc_white_shadow_r.png"></td></tr>\
   <tr><td class="scrn bl"><img src="http://b.bst.126.net/style/common/tc_white_shadow_bl.png"></td>\
     <td class="scnt bc"><img src="http://b.bst.126.net/style/common/tc_white_shadow_b.png"></td>\
     <td class="scrn br"><img src="http://b.bst.126.net/style/common/tc_white_shadow_br.png"></td></tr>\
 </tbody></table>\
');
var jst_album_list_v=new String('\
    <div class="mng c05">\
     {if migStat!=2}\
     <span class="a_a c_c g_t_12 g_c_ul" onclick="createNewAlbum();return false;">创建相册</span>\
     <span class="bd1c">|&nbsp;</span>\
     <span class="a_a c_c g_t_12 g_c_ul"><a href="http://${jstData.blogUrl}/album/all/edit/">管理相册</a></span>\
     {/if}\
    </div>\
    {if album.length <= 0}\
     <div class="c07 g_t_14 g_c_vmgin">暂无相册</div>\
    {else}\
     {if pageIdx > 0}\
     <div class="escp"><div id="_$_previous_albums" class="btn brd01 g_htc_selitm" onclick="showAlbumListByPage(${pageIdx - 1})"><span class="n_ f26">&nbsp;</span><span id="_$_previous_albums_tip" class="txt c09">前&nbsp;4&nbsp;个</span></div></div>\
     {/if}\
     <div class="case c06">\
      {for _a in album}\
       {if _a.id!=null}\
    <div class="itm g_htc_hvr g_h_1">\
     <div id="wrapper_${_a.id}" class="g_htc_item" onclick="selectAlbum(\'wrapper_${_a.id}\')">\
      <div class="tag0">\
         {if _a.hasPassword == 1}<span class="n_ f28">&nbsp;</span>{/if}\
         {if 0==1}<span class="n_ f11">&nbsp;</span>{/if}\
      </div>\
      <div class="tag1">\
       <span class="c05 g_t_12 g_c_ul" style="margin-left:5px;font-weight:normal!important" id="play_${_a.id}" title="播放幻灯片" onclick="return openFlashPlayer(true, \'${_a.id}\');">播放</span>\
       {if 0==1}\
       {if _a.id != unassortedAlbumId && _a.id != selfCapAlbumId}\
       <span class="n_ f29 g_c_hand" id="manage_${_a.id}" title="管理此相册" onclick="return showAlbumMenu(\'manage_${_a.id}\', \'${_a.id}\', -60, 15, \'nav\')">&nbsp;</span>\
       {/if}\
       {/if}\
      </div>\
         <div class="p_ p29c a_a c_c" onfocus="this.blur()">\
      {if (_a.coverPhUrl=="0" || _a.coverPhUrl=="" || _a.coverPhUrl == "-100")}\
       <img src="http://b.bst.126.net/style/common/album_face.gif" alt="${_a.albumName}" />\
      {else}\
       <img src="${_a.coverPhUrl}" alt="${_a.albumName}" />\
      {/if}\
      </div>\
      <div class="g_t_hide g_c_mvdn g_t_14">{if _a.id==selfCapAlbumId}<span class="n_ f10 g_t_12">&nbsp;</span>{/if}${_a.albumName.substring(0,6)}(${_a.photoCount})</div>\
     </div>\
    </div>\
    {/if}\
   {/for}\
  </div>\
  {if !isLastPage}\
     <div class="escp"><div id="_$_next_albums" class="btn brd01 g_htc_selitm" onclick="showAlbumListByPage(${pageIdx + 1})"><span class="n_ f27">&nbsp;</span><span id="_$_next_albums_tip" class="txt c09">后&nbsp;4&nbsp;个</span></div></div>\
  {/if}\
 {/if}\
 <div class="underline brd01" style="width:160px;position:relative;left:-2px;">&nbsp;</div>\
');
var jst_album_photo_count_prev=
new String('{if visitorRank > 100}'+
'${_a.photoCount}'+
'{elseif (_a.checkPassword==1)}'+
'{if (_a.hasPassword==0)}'+
'{if (visitorRank>=100)}'+
'${_a.friendPhotoCount-_a.pwdFriendPhotoCount}'+
'{elseif (visitorRank<=0)}'+
'${_a.guestPhotoCount-_a.pwdGuestPhotoCount}'+
'{/if}'+
'{else}'+
'{if (visitorRank>=100)}'+
'${_a.friendPhotoCount}'+
'{elseif (visitorRank<=0)}'+
'${_a.guestPhotoCount}'+
'{/if}'+
'{/if}'+
'{elseif (_a.hasPassword==0)}'+
'{if (visitorRank>=100)}'+
'${_a.friendPhotoCount-_a.pwdFriendPhotoCount}'+
'{elseif (visitorRank<=0)}'+
'${_a.guestPhotoCount-_a.pwdGuestPhotoCount}'+
'{/if}'+
'{else}'+
'{if (visitorRank>=100)}'+
'${_a.friendPhotoCount}'+
'{elseif (visitorRank<=0)}'+
'${_a.guestPhotoCount}'+
'{/if}'+
'{/if}');
var jst_album_list_v_prev=new String('\
 {if album.length <=0}\
  <div class="c07 g_t_14 g_c_vmgin">暂无相册</div>\
 {else}\
  <div class="mng g_c_noul a_a c_c c05" href="http://${jstData.blogUrl}/album/all/"><span style="text-decoration:underline;font-size:12px">更多...</span></div>\
  {if pageIdx > 0}\
     <div class="escp"><div id="_$_previous_albums" class="btn brd01 g_htc_selitm" onclick="showAlbumListByPage(${pageIdx - 1})"><span class="n_ f26">&nbsp;</span><span id="_$_previous_albums_tip" class="txt c09">前&nbsp;4&nbsp;个</span></div></div>\
     {/if}\
   <div class="case">\
     {for _a in album}\
      {if _a.id!=null}\
    <div class="itm bd01 g_htc_hvr g_h_1">\
     <div id="wrapper_${_a.id}" class="g_htc_item" onclick="selectAlbum(\'wrapper_${_a.id}\');return false;">\
      <div class="tag0">\
     {if _a.hasPassword == 1}<span class="n_ f28">&nbsp;</span>{/if}\
     {if 0==1}<span class="n_ f11">&nbsp;</span>{/if}\
      </div>\
      <div class="tag1">\
     <span class="c05 g_t_12 g_c_ul" style="margin-left:5px;font-weight:normal!important" id="play_${_a.id}" title="播放幻灯片" onclick="return openFlashPlayer(true, \'${_a.id}\');">播放</span>\
      </div>\
      <div class="p_ p29c">\
        {if (_a.coverPhId=="-200")}<img src="http://b.bst.126.net/style/common/album_face.gif"\
     {elseif (_a.coverPhId=="-100")}<img src="http://b.bst.126.net/style/common/album_face.gif"\
     {elseif (_a.coverPhId=="0")}<img src="http://b.bst.126.net/style/common/album_face.gif"\
     {else}<img src="${_a.coverPhUrl}"\
     {/if}/></div>\
     <div class="g_c_mvdn g_t_14 g_t_hide">{if _a.id==selfCapAlbumId}<span class="n_ f10 g_t_12">&nbsp;</span>{/if}${_a.albumName.substring(0,6)}('
+jst_album_photo_count_prev+
')</div>\
      </div>\
   </div>\
   {/if}\
  {/for}\
  </div>\
  {if !isLastPage}\
  <div class="escp"><div id="_$_next_albums" class="btn brd01 g_htc_selitm" onclick="showAlbumListByPage(${pageIdx + 1})"><span class="n_ f27">&nbsp;</span><span id="_$_next_albums_tip" class="txt c09">后&nbsp;4&nbsp;个</span></div></div>\
  {/if}\
 {/if}\
 <div class="underline brd01" style="width:160px;position:relative;left:-2px;">&nbsp;</div>\
');
var jst_photo_list_common=new String('\
  {if mode==\'small\'}\
  {if idx % 2 == 0}\
  <tr>\
  {/if}\
  <td style="vertical-align:bottom;overflow-x:hidden;">\
  {/if}\
  <div class="case brd01" id="wrapper_p_${_p.id}" onclick="clickSelectPhoto(true,\'${_p.id}\')">\
   <div class="item g_t_wrap">\
    <div class="g_t_wrap" style="margin-bottom:2px;padding-bottom:2px">\
     <span class="c07" style="font-size:14px;font-weight:bold" id="name_${_p.id}" alt="点击即可编辑" title="点击即可编辑">${_p.photoName|escapeButAmp}</span><span id="_$_pho_edt_ico_${_p.id}" class="g_t_left" style="line-height:20px"></span>\
     </div>\
      <div class="imgwrap"><a href="http://${jstData.blogUrl}/prevPhoto.do?photoId=${_p.id}{if type==\'inAlbum\'}&albumId=${album.id}{/if}" target="_blank">\
      {if mode!=\'small\'}<img src="${_p.smallUrl}" width="${_p.mediumWidth}" height="${_p.mediumHeight}" id="photo_small${_p.id}" />{/if} \
      <img src="${imgurl}" {if mode==\'small\'}width="${_p.smallWidth}" height="${_p.smallHeight}"{else} style="display: none;" onload="onBigImageReady(\'photo_small${_p.id}\', \'photo_big${_p.id}\');" id="photo_big${_p.id}" width="${_p.mediumWidth}" height="${_p.mediumHeight}"{/if} />\
      </a></div>\
   <div class="desc col1 g_t_wrap c07"><span id="desc_${_p.id}" style="font-size:14px;line-height:135%;" title="点击即可编辑" alt="点击即可编辑">{if _p.description!=null && _p.description!=""}{if _p.fs}${_p.description|showBr}{else}${_p.description|escape|showBr}{/if}{else}{if migStat!=2}<i class="c09">点击这里添加相片描述</i>{/if}{/if}</span><span id="_$_pho_desc_edt_ico_${_p.id}" style="line-height:20px"></span></div>\
   <div class="func" id="tool_${_p.id}">\
      <span class="g_p_left">\
       {if 0==1}<a id="photo_act_${_p.id}" class="c06" style="font-size:12px;text-decoration:underline;" href="#" onclick="clickSelectPhoto(true, \'${_p.id}\');setCurPhoto(${_p.index});return openBeautyWindow(\'${hostId}\', \'${hostName}\', \'${hostNickName|js_string}\', \'${hostSex}\');">我爱中国</a><span class="bd1c">&nbsp;|&nbsp;</span>{/if}<a class="c05" style="font-size:12px;text-decoration:underline;" href="http://${jstData.blogUrl}/editPhoto.do?photoId=${_p.id}{if type==\'inAlbum\'}&albumId=${album.id}{/if}" target="_blank">评论(${_p.commentCount})</a><span class="bd1c">&nbsp;|&nbsp;</span><a class="c05" style="font-size:12px;text-decoration:underline;" href="http://${jstData.blogUrl}/editPhoto.do?photoId=${_p.id}{if type==\'inAlbum\'}&albumId=${album.id}{/if}" target="_blank">浏览(${_p.accessCount})</a>\
       <span class="bd1c">&nbsp;|&nbsp;</span><a class="c05" style="font-size:12px;text-decoration:underline;" href="http://yxp.163.com/photo/ep.html" target="_blank">冲印</a>\
       {if 0==1}<span class="bd1c">&nbsp;|&nbsp;</span><a class="c05" style="font-size:12px;text-decoration:underline;" href="http://minisite.163.com/2008/1009/nokia/index.php?type=fromblog&photo=${_p.mediumUrl}" target="_blank">活动</a>{/if}\
       {if mode==\'small\'}\
        <span class="bd1c">|&nbsp;</span>\
       {/if}\
      </span>\
      <div class="{if mode==\'small\'}g_p_left{else}g_p_right{/if} c05 g_c_hand" style="line-height:14px;"\
    {if type == \'inAlbum\'}\
     {if album.id == unassortedAlbumId}\
      onclick="clickSelectPhoto(true, \'&{_p.id}\');return openPhotoMenu(\'inAlbum\', \'photo_man_${_p.id}\', ${_p.index}, true)"\
     {else}\
      onclick="clickSelectPhoto(true, \'&{_p.id}\');return openPhotoMenu(\'inAlbum\', \'photo_man_${_p.id}\', ${_p.index}, false)"\
     {/if}\
    {else}\
     onclick="clickSelectPhoto(true, \'&{_p.id}\');return openPhotoMenu(\'allPhoto\', \'photo_man_${_p.id}\', ${_p.index})"\
    {/if}\
     >{if migStat!=2}{if mode==\'large\'}[&nbsp;{/if}<a id="photo_man_${_p.id}" href="javascript:;" style="font-size:12px;text-decoration:underline;">管理</a><span id="photo_man_ico_${_p.id}" class="n_ n32" >{if mode==\'large\'}]{else}&nbsp;{/if}</span></div>{/if}\
    <span class="{if mode==\'small\'}g_p_left{else}g_p_right{/if}">\
      {if 0==1}<span class="n_ f11">&nbsp;</span>{/if}\
       <span id="_$_friend_access_l_${_p.id}" class="n_ f9" title="博友可见" {if _p.privacy != 100}style="display:none"{/if}>&nbsp;</span>\
       <span id="_$_private_access_l_${_p.id}" class="n_ f8" title="私密相片" {if _p.privacy != 10000}style="display:none"{/if}>&nbsp;</span>\
      </span>\
   </div>\
  </div>\
 </div>\
 {if mode==\'small\'}\
 </td>\
 {if idx % 2 == 1}\
   </tr>\
   {/if}\
   {var idx = idx + 1}\
   {/if}\
');
var jst_photo_list_prev_common=new String('\
 {if mode==\'small\'}\
  {if idx % 2 == 0}\
  <tr>\
  {/if}\
  <td style="vertical-align:bottom;">\
  {/if}\
  <div class="case brd01" id="wrapper_p_${_p.id}">\
   <div class="item g_t_wrap">\
    <div class="title_album c07 g_t_wrap" style="margin-bottom:2px;padding-bottom:2px"><span class="c07" id="name_${_p.id}">${_p.photoName|escapeButAmp}</span>\
    </div>\
      <div class="imgwrap"><a href="http://${jstData.blogUrl}/prevPhoto.do?photoId=${_p.id}{if type==\'inAlbum\'}&albumId=${album.id}{/if}" target="_blank">\
      {if mode!=\'small\'}<img src="${_p.smallUrl}" width="${_p.mediumWidth}" height="${_p.mediumHeight}" id="photo_small${_p.id}" />{/if} \
      <img src="${imgurl}" {if mode==\'small\'}width="${_p.smallWidth}" height="${_p.smallHeight}"{else} style="display: none;" onload="onBigImageReady(\'photo_small${_p.id}\', \'photo_big${_p.id}\');" id="photo_big${_p.id}" width="${_p.mediumWidth}" height="${_p.mediumHeight}"{/if} />\
      </a></div>\
      <div class="desc col1 g_t_wrap c07" id="desc_${_p.id}" style="font-size:14px;line-height:135%;">\
     {if _p.description!=null && _p.description!=""}{if _p.fs}${_p.description|showBr}{else}${_p.description|escape|showBr}{/if}{/if}\
   </div>\
   <div class="func" id="tool_${_p.id}">\
    <span class="g_p_left">\
     <a class="c05" style="font-size:12px;text-decoration:underline;" href="http://${jstData.blogUrl}/prevPhoto.do?photoId=${_p.id}{if type==\'inAlbum\'}&albumId=${album.id}{/if}" target="_blank">评论(${_p.commentCount})</a><span class="bd1c">&nbsp;|&nbsp;</span><a class="c05" style="font-size:12px;text-decoration:underline;" href="http://${jstData.blogUrl}/prevPhoto.do?photoId=${_p.id}{if type==\'inAlbum\'}&albumId=${album.id}{/if}" target="_blank">浏览(${_p.accessCount})</a>\
    </span>\
    <span class="{if mode==\'small\'}g_p_left{else}g_p_right{/if}">\
      {if 0==1}<span class="n_ f11">&nbsp;</span>{/if}\
       <span id="_$_friend_access_l_${_p.id}" class="n_ f9" title="博友可见" {if _p.privacy != 100}style="display:none"{/if}>&nbsp;</span>\
       <span id="_$_private_access_l_${_p.id}" class="n_ f8" title="私密相片" {if _p.privacy != 10000}style="display:none"{/if}>&nbsp;</span>\
      </span>\
   </div>\
  </div>\
 </div>\
 {if mode==\'small\'}\
 </td>\
 {if idx % 2 == 1}\
   </tr>\
   {/if}\
   {var idx = idx + 1}\
   {/if}\
');
var jst_photo_list=new String('\
<div id="_$_photos" class="g_abm_list g_abm_list_c2">\
    {if photoCount==0}\
  <div class="g_c_center g_t_14">\
   {if type == \'inAlbum\'}该相册{/if}现无相片\
   {if migStat!=2}，\
    {if type == \'allPhoto\' || type == \'inAlbum\' && album.id != selfCapAlbumId}\
    <a href="http://${jstData.blogUrl}/editPhotoUpload.do?host=${hostName}{if type == \'inAlbum\' && album.id != unassortedAlbumId}&albumId=${album.id}{/if}" class="g_c_ul c05">请先上传</a>\
    {else}\
    <a href="http://${jstData.blogUrl}/editCamera.do?host=${hostName}" class="g_c_ul c05">立即使用摄像头拍照</a>\
    {/if}\
   {/if}\
  </div>\
 {else}\
  {if mode==\'small\'}\
    <table style="width:100%">\
    {var idx=0}\
  {/if}\
  {for _p in photo}\
       {if _p.id!=null}\
  {var imgurl=_p.smallUrl}\
  '
+jst_photo_list_common+
'{/if}\
    {/for}\
    {if mode==\'small\'}\
    {if idx % 2 != 0}\
     <td style="width:50%;overflow-x:hidden;">&nbsp;</td></tr>\
    {/if}\
   </table>\
   {/if}\
 {/if}\
 <div class="g_p_clear g_t_space">&nbsp;</div>\
</div>\
');
var jst_album_check_password=new String('\
 <div class="g_lay_com g_crd_7" style="position:relative">\
  <div class="g_c_mvdn g_h_25 clr00">\
   本相册已经加密，请输入密码\
  </div>\
  <div class="g_t_center">\
   密&nbsp;&nbsp;码：&nbsp;&nbsp;&nbsp;&nbsp;\
   <input id="_$_album_prev_password" type="password" onkeyup="enterPassword(event,\'${album.id}\')"/>\
   <br/><br/>\
   <input type="button" onclick="checkPassword(\'${album.id}\')" value="确 定"/>\
  </div>\
 </div>\
');
var jst_photo_list_prev=new String('\
<div id="_$_photos" class="g_abm_list g_abm_list_c2">\
    {if photoCount==0}\
  <div class="g_c_center g_t_14">\
   <span>{if type == \'inAlbum\'}该相册{/if}现无相片</span>\
  </div>\
 {else}\
  {if type == \'inAlbum\' && album.hasPassword == 1 && album.checkPassword == 0 && visitorRank<=100}\
  {eval}hidePageMark(){/eval}\
  <div align="center">'
+jst_album_check_password+
'</div>{else}\
  {if mode==\'small\'}\
    <table style="width:100%">\
    {var idx=0}\
  {/if}\
  {for _p in photo}\
        {if _p.id!=null}\
   {var imgurl=_p.smallUrl}'
+jst_photo_list_prev_common+
'{/if}\
     {/for}\
     {if mode==\'small\'}\
     {if idx % 2 != 0}\
     <td style="width:50%">&nbsp;</td></tr>\
     {/if}\
    </table>\
    {/if}\
  {/if}\
 {/if}\
 <div class="g_p_clear g_t_space">&nbsp;</div>\
</div>\
');
var jst_photo_list_large=new String('\
<div id="_$_photos" class="g_abm_list g_abm_list_c1">\
 {if photoCount==0}\
  <div class="g_c_center g_t_14">\
   {if type == \'inAlbum\'}该相册{/if}现无相片\
   {if migStat!=2}，\
    {if type == \'allPhoto\' || type == \'inAlbum\' && album.id != selfCapAlbumId}\
    <a href="http://${jstData.blogUrl}/editPhotoUpload.do?host=${hostName}{if type == \'inAlbum\' && album.id != unassortedAlbumId}&albumId=${album.id}{/if}" class="g_c_ul c05">请先上传</a>\
    {else}\
    <a href="http://${jstData.blogUrl}/editCamera.do?host=${hostName}" class="g_c_ul c05">立即使用摄像头拍照</a>\
    {/if}\
   {/if}\
  </div>\
 {else}\
  {for _p in photo}\
        {if _p.id!=null}\
          {var imgurl=_p.mediumUrl}'
+jst_photo_list_common+
'{/if}\
     {/for}\
    {/if}\
</div>\
');
var jst_photo_list_large_prev=new String('\
<div id="_$_photos" class="g_abm_list g_abm_list_c1">\
    {if photoCount==0}\
  <div class="g_c_center g_t_14">\
   <span>{if type == \'inAlbum\'}该相册{/if}现无相片</span>\
  </div>\
 {else}\
  {if album.hasPassword == 1 && album.checkPassword == 0 && type == \'inAlbum\' && visitorRank<=100}\
  {eval}hidePageMark(){/eval}\
  <div align="center">'
+jst_album_check_password+
'</div>{else}\
  {for _p in photo}\
        {if _p.id!=null}\
   {var imgurl=_p.mediumUrl}'
+jst_photo_list_prev_common+
'{/if}\
     {/for}\
  {/if}\
 {/if}\
 <div class="g_p_clear g_t_space">&nbsp;</div>\
</div>\
');
var jst_album_info=new String('\
 {if mode==\'allPhoto\'}\
  <div class="menu" id="_$_view_mode">\
    <div class="fun {if viewMode!=\'small\'} vmwide{else} vmsmall{/if}" id="_$_album_operator">\
       <span class="c08">查看：</span>\
     <a href="#" {if viewMode==\'small\'}style="cursor:default" class="c07 g_noul"{else}class="c06"{/if} onclick="switchViewTypeAllPhotos(\'small\');return false;">小图</a>&nbsp;&nbsp;\
     <a href="#" {if viewMode==\'large\'}style="cursor:default" class="c07 g_noul"{else}class="c06"{/if} onclick="switchViewTypeAllPhotos(\'large\');return false;">大图</a>\
    </div>\
     </div>\
 {else}\
 {if album.id == selfCapAlbumId}\
  <div class="c08 g_t_12 g_t_left">提示：摄像头拍照保存的相片，可另存到自建相册的同时，自动保存在该“自拍相片”中。</div>\
 {/if}\
 <div class="fun {if viewMode!=\'small\'} vmwide{else} vmsmall{/if}">\
  <span class="c08">查看：</span>\
  <a href="#" {if viewMode==\'small\'}style="cursor:default" class="c07 g_noul"{else}class="c06"{/if} onclick="switchViewType(\'small\');return false;">小图</a>&nbsp;&nbsp;\
  <a href="#" {if viewMode==\'large\'}style="cursor:default" class="c07 g_noul"{else}class="c06"{/if} onclick="switchViewType(\'large\');return false;">大图</a>\
 </div>\
    <div class="titlebar c07"><span style="font-size:24px" id="_$_album_title" {if album.id != unassortedAlbumId && album.id != selfCapAlbumId} title="点击即可编辑" alt="点击即可编辑"{/if}>${album.albumName}</span><span id="_$_alb_edt_ico" class="g_t_left" style="line-height:40px;"></span></div>\
 <div class="fun" id="_$_album_operator">\
  <a class="c05 g_p_none" id="openAddTagbox__$$_album_tag" href="#">[添加标签]</a>\
  <span class="c05 g_c_hand" style="font-size:12px;"><a class="c05" style="font-size:12px;text-decoration:underline;" target="_blank" href="http://pp.blog.163.com/st/upload_from_blog.html#${album.id}" >展示此相册</a></span>\
  {if album.id != unassortedAlbumId && album.id != selfCapAlbumId}\
  <span class="c05 g_c_hand" style="font-size:12px;">|&nbsp;<a class="c05" style="font-size:12px;text-decoration:underline;" target="_blank" href="http://yxp.163.com/photo/ep.html" >冲印此相册</a></span>\
  {if migStat!=2}\
  <span class="c05 g_c_hand" style="font-size:12px;" onclick="return showAlbumMenu(\'_$_open_menu_link\', null, -10, 20, null);">|&nbsp;<a class="c05" style="font-size:12px;text-decoration:underline;" id="_$_open_menu_link" href="javascript:;" >管理此相册</a><span class="n_ n32"></span></span>&nbsp;\
  {/if}\
  {else}\
  {if migStat!=2}\
  <span class="c05 g_c_hand" style="font-size:12px;" onclick="showBatchDialog(\'${album.id}\');return false;"><a class="c05" style="font-size:12px;text-decoration:underline;" id="_$_open_menu_link" href="javascript:;" >批量管理</a></span>&nbsp;\
  {/if}{/if}\
 </div>\
 {if album.id != unassortedAlbumId && album.id != selfCapAlbumId}\
 <div class="desc c07 g_t_wrap"><span id="_$_album_desc" style="line-height:135%" title="点击即可编辑" alt="点击即可编辑">{if album.albumDescription!=null && album.albumDescription!=""}${album.albumDescription|showBr}{else}{if migStat!=2}<i class="c09">点击这里添加相册描述</i>{/if}{/if}</span><span id="_$_alb_desc_edt_ico">&nbsp;</span></div>\
 {/if}\
 <div class="tag g_p_none" id="_$$_album_tag">\
  <span>标签:</span>\
 </div>\
 {/if}\
');
var jst_album_info_prev=new String('\
 {if mode==\'allPhoto\'}\
  <div class="menu" id="_$_view_mode">\
    <div class="fun {if viewMode!=\'small\'} vmwide{else} vmsmall{/if}" id="_$_album_operator">\
     <span class="c08">查看：</span>\
     <a href="#" {if viewMode==\'small\'}style="cursor:default" class="c07 g_noul"{else}class="c06"{/if} onclick="switchViewTypeAllPhotos(\'small\');return false;">小图</a>&nbsp;&nbsp;\
     <a href="#" {if viewMode==\'large\'}style="cursor:default" class="c07 g_noul"{else}class="c06"{/if} onclick="switchViewTypeAllPhotos(\'large\');return false;">大图</a>\
    </div>\
     </div>\
 {else}\
  {if album.id == selfCapAlbumId}\
   <div class="c07 g_t_12 g_t_left">提示：摄像头拍照保存的相片，可另存到自建相册的同时，自动保存在该“自拍相片”中。</div>\
  {/if}\
     <div class="fun {if viewMode!=\'small\'} vmwide{else} vmsmall{/if}">\
      <span class="c08">查看：</span>\
   <a href="#" {if viewMode==\'small\'}style="cursor:default" class="c07 g_noul"{else}class="c06"{/if} onclick="switchViewType(\'small\');return false;">小图</a>&nbsp;&nbsp;\
   <a href="#" {if viewMode==\'large\'}style="cursor:default" class="c07 g_noul"{else}class="c06"{/if} onclick="switchViewType(\'large\');return false;">大图</a>\
     </div>\
     <div class="titlebar c07" id="_$_album_title">${album.albumName}</div>\
    <div class="desc c07 g_t_wrap" id="_$_album_desc" style="line-height:135%">{if album.albumDescription!=null && album.albumDescription!=""}${album.albumDescription|showBr}{/if}</div>\
    <div class="tag g_p_none" id="_$$_album_tag">\
   <span>标签:</span>\
    </div>\
 {/if}\
');
var jst_album_comment=new String('\
 <div>\
  <div  id="_$_album_bottom_bar" class="g_tab_btn00 g_t_12">\
   <div class="bdl">\
    <a href="javascript:;" class="c05 g_c_hand" style="font-size:12px;" onclick="copyAlbumUrl(\'Hello, world!\');return false;">复制此相册地址&nbsp;</a>\
   </div>\
   {if (visitorRank!=10000)}\
   <div class="bdl bdr">\
    <a href="javascript:;" id="_$_share_album" class="c05 g_c_hand" style="font-size:12px;" onclick="shareAlbumByEmail();return false;">发送给朋友&nbsp;</a>\
   </div>\
   {/if}\
   {if ((visitorRank!=10000)&&(visitorRank>=0) && album.id != unassortedAlbumId && album.id != selfCapAlbumId)}\
   <div class="bdl bdr">\
    <a href="javascript:;" class="g_c_hand c05" style="font-size:12px;" id="fav_${album.id}" title="收藏" onclick="return favoSet.addToFavo(\'${album.id}\');">收藏&nbsp;</a>\
   </div>\
   {/if}\
   {if album.id != unassortedAlbumId}\
   <div id="_$_open_comment" class="bdl bdr">\
    <nobr>\
     <a href="javascript:;" class="c05 g_c_hand" style="font-size:12px;" id="_$_comment_count" onclick="showHideComment(\'_$_comment_area\');return false;">相册评论(${album.commentCount})</a>\
    </nobr>\
   </div>\
   <div class="bdl bdr">\
    <nobr>\
     <span class="c07 g_t_12" id="_$_album_ac_count">浏览(${album.accessCount})</span>\
    </nobr>\
   </div>\
   {/if}\
   <div class="bdr">\
    <span class="c09">${NetEase.DateTime.formatDate(album.createTime,"yyyy-MM-dd")}</span>\
   </div><br class="g_p_clear"/>\
  </div>\
 </div>\
');
var jst_album_menu=new String('\
 {var offsetX = -90}\
 {var offsetY = 0}\
 {if subMenuDir == \'left\'}\
  {var offsetX = 90}\
 {/if}\
 <div class="g_lay_com g_crd_0" style="width:100px;" id="_$_album_menu">\
   <div class="menu">\
   {if privacy == -100}<div class="item g_f_hov" onclick="openCircleAlbumWindow(\'${albumId}\',\'${baseEleId}\');return false;" onmouseover="hideAlbumSubMenu()">推送相册</div>{/if}\
   <div class="item g_f_hov" onclick="return openPasswordWindow(\'${albumId}\',\'${baseEleId}\');" onmouseover="hideAlbumSubMenu()">设置密码</div>\
   <div class="item g_f_hov" onmouseover="hideAlbumSubMenu()" onclick="return openConfirmWindow(\'确实要将该相册置顶吗？\', \'pushTop\', \'${albumId}\', \'${baseEleId}\', false);">置顶相册</div>\
   <div class="item g_f_hov" style="border-bottom: 1px solid #DDDDDD" onmouseover="hideAlbumSubMenu()" onclick="return openConfirmWindow(\'确实要删除该相册吗？\', \'deleteAlbum\', \'${albumId}\', \'${baseEleId}\', false);">删除相册</div>\
   <div id="_$_album_batch_operate" class="item g_f_hov" onmouseover="hideAlbumSubMenu()" onclick="showBatchDialog(\'${albumId}\');return false;">批量管理</div>\
   <div id="_$_album_photo_privacy" class="item g_f_hov" onmouseover="showSubMenuItem(\'${albumId}\', \'privacy\', \'_$_album_photo_privacy\', ${offsetX}, ${offsetY})"><span class="r n_ n33">&nbsp;</span>相片权限</div>\
   <div id="_$_album_photo_order" class="item g_f_hov" onmouseover="showSubMenuItem(\'${albumId}\', \'order\', \'_$_album_photo_order\', ${offsetX}, ${offsetY})"><span class="r n_ n33">&nbsp;</span>相片排序</div>\
  </div>\
 </div>\
');
var jst_photo_menu_in_album=new String('\
 <div id="_$_photo_menu" class="g_lay_com g_crd_0" style="width:100px">\
  <div class="menu">\
   <div id="_$_photo_menu_1" class="item g_f_hov" onclick="return openAddToAlbumWindow(${photo.index});">复制到相册</div>\
   <div id="_$_photo_menu_2" class="item g_f_hov" onclick="return openPhotoPrivacyWindow(${photo.index});">修改权限</div>\
   <div id="_$_photo_menu_3" class="item g_f_hov" onclick="setProfileImgPreview(${photo.index});return openPhotoConfirmWindow(\'确实要将该相片设为头像吗？\', \'setProfile\', ${photo.index});">设为头像</div>\
   <div id="_$_photo_menu_4" class="item g_f_hov" onclick="return openPhotoConfirmWindow(\'确实要删除该相片吗？\', \'delPhoto\', ${photo.index});">删&nbsp;&nbsp;&nbsp;&nbsp;除</div>\
   {if !isInDefaultAlbum}\
   <div id="_$_photo_menu_5" class="item g_f_hov" onclick="return openPhotoConfirmWindow(\'确实要将该相片设为相册封面吗？\', \'setAlbumCover\', ${photo.index});">设为封面</div>\
   {/if}\
  </div>\
 </div>\
');
var jst_photo_menu_all_photo=new String('\
 <div id="_$_photo_menu" class="g_lay_com g_crd_0" style="width:100px">\
  <div class="menu">\
   <div id="_$_photo_menu_1" class="item g_f_hov" onclick="return openAddToAlbumWindow(${photo.index});">复制到相册</div>\
   <div id="_$_photo_menu_2" class="item g_f_hov" onclick="return openPhotoPrivacyWindow(${photo.index});">修改权限</div>\
   <div id="_$_photo_menu_3" class="item g_f_hov" onclick="openPhotoConfirmWindow(\'确实要将该相片设为头像吗？\', \'setProfile\', ${photo.index});return false">设为头像</div>\
   <div id="_$_photo_menu_4" class="item g_f_hov" onclick="return openPhotoConfirmWindow(\'确实要将该相片置顶吗？\', \'pushPhoto\', \'${photo.index}\');">置&nbsp;&nbsp;&nbsp;&nbsp;顶</div>\
   <div id="_$_photo_menu_5" class="item g_f_hov" onclick="return openPhotoConfirmWindow(\'确实要删除该相片吗？\', \'delPhoto\', \'${photo.index}\');">删&nbsp;&nbsp;&nbsp;&nbsp;除</div>\
  </div>\
 </div>\
');
var jst_sub_menu=new String('\
 <div id="_$_album_sub_menu">\
  <div class="g_lay_com g_crd_0">\
   <div class="menu">\
    {if subMenuType == \'privacy\'}\
     <div class="item g_f_hov" onclick="return setAlbumPhotoPrivacy(\'${albumId}\', -100)">公开</div>\
     <div class="item g_f_hov" onclick="return setAlbumPhotoPrivacy(\'${albumId}\', 100)">博友可见</div>\
     <div class="item g_f_hov" onclick="return setAlbumPhotoPrivacy(\'${albumId}\', 10000)">私人</div>\
    {elseif subMenuType == \'order\'}\
     <div class="item g_f_hov" onclick="return setAlbumSequence(\'${albumId}\', 1);">按时间降序</div>\
     <div class="item g_f_hov" onclick="return setAlbumSequence(\'${albumId}\', 0);">按时间升序</div>\
    {/if}\
   </div>\
  </div>\
 </div>\
');
var jst_album_circle=new String('\
   {if CirclePushInfo.getPushedCircles().length <= 0 && CirclePushInfo.getUserCircleType1s().length <= 0}\
    <div style="padding: 10px 15px;">\
     <div style="color: red;padding-bottom:10px;">\
      <div class="g_p_left" style="width: 66px;">提示：</div>\
      <div class="g_p_left" style="width: 300px;">你尚未加入任何圈子，请先加入圈子后再进行推送<br /><br /><span class="a_a d_d g_t_14" target="_blank" href="${CircleInfo.baseUrl}">浏览圈子&gt;&gt;</span></div>\
      <div class="clear"></div>\
     </div>\
    </div>\
      <div class="g_t_center g_h_30" style="margin-top:10px;">\
     <input type="button" class="btncm btncc" value="关  闭" onclick="_$_circle_window.closeWindow();" />\
    </div>\
   {else}\
    <div style="padding: 10px 15px;">\
     <div style="color: red;padding-bottom:10px;">\
      <div class="g_p_left" style="width: 66px;">提示：</div>\
      <div class="g_p_left"  style="width: 300px;">相册中的相片（包含私人，博友权限）推到后将在圈子中公开呈现</div>\
      <div class="clear"></div>\
     </div>\
           {for circleType1 in CirclePushInfo.getUserCircleType1s()}\
            <div style="padding-bottom: 10px;">\
             <div class="g_p_left" style="width:66px;color:#666;padding-top:3px;">${circleType1.name}：</div>\
             <div class="g_p_left">\
             {for circle in CirclePushInfo.getCirclesByType1(circleType1.id)}\
              <div class="g_p_left g_t_hide" style="width: 85px;margin-right:15px;">\
              <input type="checkbox" id="_$_circle_${circle.id}" name="_$_circle_push" value="${circle.id}" class="g_p_left g_p_block" style="margin:3px 0 0 3px;*margin:0;">\
              <div class="g_p_block g_t_hide" style="width: 60px;margin-left:20px;padding-top:3px;"><span class="a_a d_d" href="${CirclePushInfo.circleBaseUrl}/${circle.urlName}/" target="_blank">${circle.name}</span></div>\
              </div>\
       {/for}\
       </div>\
       <div class="clear"></div>\
      </div>\
           {/for}\
     {if CirclePushInfo.getPushedCircles().length > 0}<div style="padding-top: 10px;">\
      <div class="g_p_left" style="width:66px;color:#666;">已推送：</div><div class="g_p_left">\
      {for circle in CirclePushInfo.getPushedCircles()}\
       <span class="a_a d_d" href="${CirclePushInfo.circleBaseUrl}/${circle.urlName}/" target="_blank">${circle.name}</span>\
      {/for}\
      </div><div class="clear"></div></div>\
     {/if}\
    </div>\
      <div class="g_t_center g_h_30" style="margin-top:20px;">\
     <input type="button" class="btncm btnok" value="确　定" onclick="addAlbumToCircle(\'${album.id}\');_$_circle_window.closeWindow();" />\
     <span style="margin:0 10px;"><b></b></span>\
     <input type="button" class="btncm btncc" value="取　消" onclick="_$_circle_window.closeWindow();" />\
    </div>\
   {/if}\
');
var jst_album_password=new String('\
    <div style="padding:10px 0px 10px 15px;line-height:150%">\
       <div class="g_t_left g_t_14 g_t_bold clr00" style="padding-bottom:5px">相册密码设置:</div>\
       <span class="close n_ n7" title="关闭" onclick="closePasswordWindow();">&nbsp;</span>\
          <div>\
      {if album.hasPassword != 0}\
      <input id="_$_remove_pwd" type="radio" checked name="change_password" onclick="$(\'pwd_inputs\').style.display=\'none\';">撤销密码</input>\
      <input id="_$_change_pwd" type="radio" name="change_password" onclick="$(\'pwd_inputs\').style.display=\'\';">更改密码</input>\
      <div id="pwd_inputs" style="display:none;">\
      {else}\
      <div>\
      {/if}\
      <div class="g_h_25"><label for="text9">输入密码：</label><input type="password" maxLength="6" class="g_h_ipt" name="text0" id="_$_password" type="text" value="" /></div>\
      <div class="g_h_25" style="padding-top:3px"><label for="text8">确认密码：</label><input type="password" maxLength="6" class="g_h_ipt" name="text0" id="_$_pwd_confirm" type="text" value="" /></div>\
      <p style="padding-top:5px">*&nbsp;密码最多为6位</p><p>*&nbsp;不填写表示不设置密码</p></div>\
     <br class="clear" />\
    </div>\
     <div class="g_t_center g_h_30" style="margin-top:5px;">\
     <input type="button" class="btncm btnok" value="确　定" onclick="\
      {if album.hasPassword == 0}setAlbumPassword(\'${album.id}\', \'_$_password\', \'_$_pwd_confirm\')" />\
      {else}updateAlbumPassword(\'${album.id}\', \'_$_remove_pwd\', \'_$_password\', \'_$_pwd_confirm\')" />\
      {/if}\
     <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>\
     <input type="button" class="btncm btncc" value="取　消" onclick="closePasswordWindow();" />\
    </div>\
    </div>\
');
var jst_op_confirm=new String('\
 <br/>\
 <div id="_$_album_confirm_panel" class="g_t_center" style="padding:0px 0px 10px 0px">\
       <div class="g_t_center g_t_14 g_t_bold clr00">${tipText}</div>\
  <br/>\
  {if confirmOp == \'pushTop\'}\
   <span class="close n_ n7" title="关闭" onclick="closeConfirmWindow()">&nbsp;</span>\
   <input id="_$_confirm_ok" type="button" class="btncm btnok" onclick="pushTop(\'${resourceId}\')" value="确 定"/>&nbsp;&nbsp;&nbsp;&nbsp;\
   <input type="button" class="btncm btncc" onclick="closeConfirmWindow()" value="取 消"/>\
  {elseif confirmOp == \'deleteAlbum\'}\
   <span class="close n_ n7" title="关闭" onclick="closeConfirmWindow()">&nbsp;</span>\
   <input id="_$_confirm_ok" type="button" class="btncm btnok" onclick="deleteAlbum(\'${resourceId}\')" value="确 定"/>&nbsp;&nbsp;&nbsp;&nbsp;\
   <input type="button" class="btncm btncc" onclick="closeConfirmWindow()" value="取 消"/>\
  {elseif confirmOp == \'delPhoto\'}\
   <span class="close n_ n7" title="关闭" onclick="closePhotoConfirmWindow()">&nbsp;</span>\
   <input id="_$_photo_confirm_ok" type="button" class="btncm btnok" onclick="delPhoto(\'${resourceId}\')" value="确 定"/>&nbsp;&nbsp;&nbsp;&nbsp;\
   <input type="button" class="btncm btncc" onclick="closePhotoConfirmWindow()" value="取 消"/>\
  {elseif confirmOp == \'deleteBatch\'}\
   <span class="close n_ n7" title="关闭" onclick="closeConfirmWindow()">&nbsp;</span>\
   <input id="_$_confirm_ok" type="button" class="btncm btnok" onclick="deletePhotosBatch();return false;" value="确 定"/>&nbsp;&nbsp;&nbsp;&nbsp;\
   <input type="button" class="btncm btncc" onclick="closeConfirmWindow()" value="取 消"/>\
  {elseif confirmOp == \'pushPhoto\'}\
   <span class="close n_ n7" title="关闭" onclick="closePhotoConfirmWindow()">&nbsp;</span>\
   <input id="_$_photo_confirm_ok" type="button" class="btncm btnok" onclick="pushPhoto(\'${resourceId}\')" value="确 定"/>&nbsp;&nbsp;&nbsp;&nbsp;\
   <input type="button" class="btncm btncc" onclick="closePhotoConfirmWindow()" value="取 消"/>\
  {elseif confirmOp == \'setProfile\'}\
   <span class="close n_ n7" title="关闭" onclick="closePhotoConfirmWindow()">&nbsp;</span>\
   <input id="_$_photo_confirm_ok" type="button" class="btncm btnok" onclick="setProfile(\'${resourceId}\')" value="确 定"/>&nbsp;&nbsp;&nbsp;&nbsp;\
   <input type="button" class="btncm btncc" onclick="closePhotoConfirmWindow()" value="取 消"/>\
  {elseif confirmOp == \'setAlbumCover\'}\
   <span class="close n_ n7" title="关闭" onclick="closePhotoConfirmWindow()">&nbsp;</span>\
   <input id="_$_photo_confirm_ok" type="button" class="btncm btnok" onclick="setAlbumCover(\'${resourceId}\', \'${resourceId2}\')" value="确 定"/>&nbsp;&nbsp;&nbsp;&nbsp;\
   <input type="button" class="btncm btncc" onclick="closePhotoConfirmWindow()" value="取 消"/>\
  {/if}\
 </div>\
');
var jst_photo_privacy=new String('\
 <div id="photo_privacy_panel">\
  <span class="close n_ n7" title="关闭" onclick="closePhotoPrivacyWindow()">&nbsp;</span>\
   <div style="padding: 10px 0px 10px 10px">\
   <div class="g_t_left g_t_14 g_t_bold clr00">设置该相片的浏览权限:</div>\
   <div class="g_t_center">\
    <br/>\
    <p style="font-size:14px">\
     <input type="radio" name="view_rank" id="_$_public" {if photo.privacy == -100}checked{/if}>公开</input>\
     <input type="radio" name="view_rank" id="_$_friend" {if photo.privacy == 100}checked{/if}>博友</input>\
     <input type="radio" name="view_rank" id="_$_private" {if photo.privacy == 10000}checked{/if}>私人</input>\
     <br/><br/>\
    </p>\
    <input type="button" class="btncm btnok" onclick="savePhotoPrivacy(${photo.index})" value="确 定">&nbsp;&nbsp;&nbsp;&nbsp;\
    <input type="button" class="btncm btncc" onclick="closePhotoPrivacyWindow()" value="取 消"/>\
   </div>\
  </div>\
 </div>\
');
var jst_profile_preview=new String('\
 <p align="left" style="margin-left:10px;margin-bottom:5px">头像预览</p>\
 <div align="center" class="bd01" style="height:140px;margin:5px;">\
  <img style="margin-top:${marginTop}px;" src="${photoSmallUrl}" width="${photoWidth}px" height="${photoHeight}px"></img>\
 </div>\
');
var jst_add_to_album=new String('\
   <span class="close n_ n7" onclick="closeAddToAlbumWindow();" title="关闭">&nbsp;</span>\
  <div class="c07 g_t_left g_t_14 g_t_bold clr00">添加到其他相册：</div>\
        <div class="case" style="margin-top:5px;height:300px;overflow-y:auto;">\
  {if albums.length <= 0}\
   没有相册\
  {/if}\
  {for _a in albums}\
    {if _a.id != unassortedAlbumId && _a.id != selfCapAlbumId}\
    <div class="item g_f_hov">\
     <a class="g_c_noul" href="#" onclick="addPhotoToAlbum(\'${photo.id}\', \'${_a.id}\', [{for photoAlbum in photoAlbums}\'${photoAlbum.id}\',{/for}null]);return false;">\
    {if (_a.coverPhUrl=="0" || _a.coverPhUrl=="")}\
    <img width="30px" height="30px" src="http://b.bst.126.net/style/common/album_face.gif" alt="${_a.albumName}" />\
    {else}\
    <img src="${_a.coverPhUrl}" alt="${_a.albumName}"/>\
    {/if}\
     </a>\
     <span class="a_a c_c" onclick="addPhotoToAlbum(\'${photo.id}\', \'${_a.id}\', [{for photoAlbum in photoAlbums}\'${photoAlbum.id}\',{/for}null]);return false;">${_a.albumName}</span>\
   {for album in photoAlbums}\
    {if album.id == _a.id}\
       <span class="n_ f17" title="">&nbsp;</span><span class="n_ f18" title="从该相册中移除" onclick="return removePhotoFromAlbum(\'${photo.id}\', \'${_a.id}\');">&nbsp;</span>\
    {/if}\
   {/for}\
    </div>\
    {/if}\
  {/for}\
  </div>\
  <div class="g_t_right g_h_25"><span class="a_a" id="_$_new_album_a" onclick="return showNewAlbumMenu(\'_$_new_album_a\', \'${photo.id}\')">创建新相册&nbsp;&gt;&gt;</span></div>\
');
var jst_add_new_album=new String('\
 <div id="_$_new_album_menu" style="width:320px" class="g_lay_com g_crd_20">\
  <table width="300px" style="margin:3px 0px 3px 3px; table-layout:auto;">\
   <tr><td>相册名称：</td>\
    <td><input type="text" id="_$_new_album_name" class="g_htc_focus g_h_ipt" style="width:200px;" maxlength="14" onkeyup="checkNewAlbumInput();"></td>\
   </tr>\
   <tr><td>相册描述：</td>\
    <td><textarea id="_$_new_album_desc" class="g_htc_focus" style="width:202px; height:75px;" onkeyup="textareaLimit(this, 255)"></textarea></td>\
   </tr>\
   <tr class="g_p_none"><td style="vertical-align: top;">相册标签：</td>\
    <td><input type="text" id="_$_new_album_tag" class="g_htc_focus bd01" style="width:200px;" autocomplete="off" onfocus="showUserAllTags(this);">\
     <div style="overflow:hidden;width:200px;word-break:break-all;" id="showUserTagsDiv__$_new_album_tag"></div></td>\
   </tr>\
   <tr><td height="23">设置密码：</td>\
    <td align="left"><input type="checkbox" id="_$_new_album_pwd" onclick="newAlbumPassword()" style="border:0px;"/></td>\
   </tr>\
   <tr id="_$_new_album_input_pwd" style="display:none">\
    <td>相册密码：</td>\
    <td align="left"><input type="password" id="_$_new_album_password" class="g_htc_focus g_h_ipt"  onkeyup="newAlbumInputPassword()" maxLength="6"/></td></tr>\
   <tr id="_$_new_album_confirm_pwd" style="display:none">\
    <td>确认密码：</td>\
    <td align="left"><input type="password" id="_$_new_album_confirm_password" class="g_htc_focus g_h_ipt" onkeyup="newAlbumCheckPassword()" maxLength="6"/>\
     <span id="_$_checkIco" class="n_ f17" style="display:none">&nbsp;</span></td>\
   </tr>\
   <tr style="margin:0px 0px 5px 50px;height:15px;">\
    <td colspan="2" align="center">\
     <input class="input_button" type="button" id="_$_new_album_submit" value="创 建" onclick="newAlbumAndAddPhoto(\'${photoId}\');" disabled=true>\
     &nbsp;&nbsp;&nbsp;&nbsp;\
     <input class="input_button" type="button" value="取消" onclick="hideNewAlbumMenu();">\
    </td>\
   </tr>\
  </table>\
 </div>\
');
var jst_edit_or_new_album=new String('\
 <div id="_$_edit_album_menu">\
  <table width="300px" style="margin:3px 0px 3px 3px; table-layout:auto;">\
   <tr><td>相册名称：</td>\
    <td><input type="text" id="_$_new_album_name" class="g_htc_focus g_h_ipt" style="width:200px;" maxlength="14" onkeyup="checkNewAlbumInput();" value="${album.albumName}"></td>\
   </tr>\
   <tr><td>相册描述：</td>\
    <td><textarea id="_$_new_album_desc" class="g_htc_focus g_t_12" style="width:204px; height:75px;" onkeyup="textareaLimit(this, 255)">${album.albumDescription}</textarea></td>\
   </tr>\
   <tr class="g_p_none"><td style="vertical-align: top;">相册标签：</td>\
    <td><input type="text" id="_$_new_album_tag" class="g_htc_focus txt" style="width:200px;" autocomplete="off" onfocus="showUserAllTags(this);">\
     <div style="overflow:hidden;width:200px;word-break:break-all;" id="showUserTagsDiv__$_new_album_tag"></div></td>\
   </tr>\
   <tr><td height="23">设置密码：</td>\
    <td align="left"><input type="checkbox" id="_$_new_album_pwd" onclick="newAlbumPassword()" style="border:0px;"/></td>\
   </tr>\
   <tr id="_$_new_album_input_pwd" style="display:none">\
    <td>相册密码：</td>\
    <td align="left"><input type="password" id="_$_new_album_password" class="g_htc_focus g_h_ipt"  onkeyup="newAlbumInputPassword()" maxLength="6"/></td></tr>\
   <tr id="_$_new_album_confirm_pwd" style="display:none">\
    <td>确认密码：</td>\
    <td align="left"><input type="password" id="_$_new_album_confirm_password" class="g_htc_focus g_h_ipt" onkeyup="newAlbumCheckPassword()" maxLength="6"/>\
     <span id="_$_checkIco" class="n_ f17" style="display:none">&nbsp;</span></td>\
   </tr>\
   <tr style="margin:0px 0px 5px 50px;height:15px;">\
    <td colspan="2" align="center">\
     <input class="btncm btnok g_t_14" type="button" id="_$_new_album_submit" {if isNewAlbum}value="创 建"{else}value="确 定"{/if} onclick="confrimEditAlbum(${isNewAlbum});" disabled=true>\
     &nbsp;&nbsp;&nbsp;&nbsp;\
     <input class="btncm btnok g_t_14" type="button" value="取 消" onclick="cancelEditAlbum();">\
    </td>\
   </tr>\
  </table>\
 </div>\
');
var jst_recent_comment=new String('\
 <div class="g_crd_17">\
  {if comments.length > 0}\
   <div class="table" id="_$_recent_comment_panel">\
   {for com in comments }\
    <div class="tr g_h_1">\
     <div class="td0"><a href="http://${com.hostName|parentDomain}${prefix}/${urlPre}Photo.do?photoId=${com.APId}" target="_blank"><img src="${com.squareUrl}" /></a></div>\
    <div class="td1">\
           <a href="http://${com.hostName|parentDomain}${prefix}/${urlPre}Photo.do?photoId=${com.APId}" target="_blank">\
        ${com.content|default:""}\
          </a>\
    </div>\
    <div class="td2">\
    {if com.userName != ""}\
             <a class="c05" href="http://${com.userName|parentDomain}${prefix}/" target="_blank">${com.publisherNickname|escape}</a></p>\
            {else}\
             ${com.publisherNickname|escape}\
            {/if}\
    </div>\
    <div class="td3">${NetEase.DateTime.formatDate(com.publishTime,"yyyy-MM-dd")}</div>\
    <br class="clear"/>\
   </div>\
   {/for}\
   </div>\
  {else}\
   <div>没有最新评论</div>\
  {/if}\
 </div>\
');
var jst_batch_edit_photo_list=new String('\
 <div style="width: 650px;height: 360px;">\
 {for photo in photosToshow}\
  <div class="g_p_left g_c_hand" style="width: 91px; height: 91px;" onclick="toggleSelectedImg(\'${photo.id}\');return false;">\
   <div id="_$_batch_img_${photo.id}" style="width: 81px; height: 81px; margin: 5px auto;">\
    <img src="${photo.squareUrl}" width="75px" height="75px" style="margin: 4px 3px auto;" />\
   </div>\
  </div>\
 {forelse}\
  <div class="g_t_14" style="padding-top:20px;">${TipText}</div>\
 {/for}\
 </div>\
 <div style="clear: both;"></div>\
');
var jst_batch_edit_op=new String('\
 <div id="_$_batch_edit_op" style="width: 640px;">\
  <div class="g_p_left g_t_12 g_t_center" style="width: 15%;">\
   <input id="_$_batch_select_all" name="_$_batch_select_all" style="vertical-align:bottom;" type="checkbox" onclick="if(this.checked){selectBatchOnePage();}else{unselectBatchOnePage();}">&nbsp;<label for="_$_batch_select_all" style="vertical-align:bottom;">全选</label>\
  </div>\
  <div id="_$_batch_photo_nav" class="g_p_right g_t_12" style="width: 40%;"></div>\
  <div class="g_t_12" style="clear: both;">&nbsp;<div>\
  <div class="g_c_left g_t_14">\
   &nbsp;&nbsp;&nbsp;&nbsp;将所选相片{if curAlbum.id != selfCapAlbumId}移动{else}复制{/if}到：\
   <select id="_$_album_target_select" nohide="true" style="width:160px;" onchange="setEnableBatchMove(); return false;">\
    <option class="g_t_14" value="0" style="color:#AAA;">--请选择目的相册--</option>\
    {for album in albums}\
     {if album.id != unassortedAlbumId && album.id != selfCapAlbumId && album.id != curAlbum.id}\
      <option class="g_t_14 g_t_hide" value="${album.id}" style="color:#000;">${album.albumName}</option>\
     {/if}\
    {/for}\
   </select>\
   &nbsp;&nbsp;&nbsp;&nbsp;\
   <a id="_$_delete_photo_batch" disabled class="g_t_12 g_c_ul" href="#" onclick="clickDeleteBatch(\'${curAlbum.id}\'); return false;" />删除所选相片</a>\
  </div>\
  <br />\
  <div align="center">\
   <input id="_$_move_photo_batch" disabled  type="button" class="btncm btnok g_t_14" value="确定{if curAlbum.id != selfCapAlbumId}移动{else}复制{/if}相片" onclick="changPhotosAlbumBatch();return false;" />&nbsp;\
   <input id="_$_cancel_batch" type="button" class="btncm btncc g_t_14" value="取 消" onclick="cancelBatchOp();return false;" />&nbsp;\
  </div>\
  <br />\
 </div>\
');
var jst_album_all_del_confirm=new String('\
 <div id="operateBox" class="g_lay_com g_crd_7" style="display:none;position:absolute;width:190px;padding-bottom:10px;">\
  <span title="关闭" class="close n_ n7" onclick="return closeOperateBox()">&nbsp;</span>\
  <div class="g_c_mvdn g_h_25 clr00">\
   <div class="g_t_center g_t_bold">确定要删除相册吗？</div>\
    </div>\
    <div class="g_t_center">\
   <input id="confirm4AlOp" type="button" class="btncm btnok" value="确 定" onclick="return confirmYes()"/>&nbsp;&nbsp;\
         <input type="button" class="btncm btncc" value="取 消" onclick="return closeOperateBox()"/>\
     </div>\
 </div>\
');
var jst_edit_album_all=new String('\
 <table class="g_t_left" cellpadding="0" cellspacing="0" border="0" style="width:95%;table-layout: fixed;">\
 {var i = 0}\
 {for album in albums}\
  {if album.id!=null}\
   {var i = i+1}\
   {if album_index%3==0}<tr>{/if}<td>\
   <div id="${album.id}" style="padding-bottom:20px;">\
    <div class="g_p_left" style="width:100px;" {if album.id!=unassortedAlbumId && album.id!=selfCapAlbumId}onmouseover="showHandle(\'${album.id}_man\');return false;" onmouseout="hideHandle(\'${album.id}_man\');return false;"{/if}>\
     <div class="p_ p29 g_c_hand" onclick="window.open(\'http://${jstData.blogUrl}/album/edit/?albumId=${album.id}\', \'_self\');">\
      {if (album.coverPhUrl =="0" || album.coverPhId=="0")}\
                <img src="http://b.bst.126.net/style/common/album_face.gif"\
         {else}\
                <img src="${album.coverPhUrl}"\
            {/if} alt="${album.albumName}" />\
            <span class="{if album.hasPassword != 0}n_ f28{/if}" style="font-size: 12px; line-height: 12px;position: relative; top: -85px; left: 96px;">&nbsp;</span>\
     </div>\
     <div id="${album.id}_man" align="center" style="width:95px;visibility:hidden;margin-top:3px;"><span class="c05 g_c_ul g_t_12 g_c_hand" onclick="window.open(\'http://${hostName|parentDomain}/albumorganize\', target=\'_blank\');return false;" >高级管理</span><span class="bd1c">&nbsp;|&nbsp;</span><span id="link_${album.id}" onclick="openOperateBox(\'${album.id}\')" class="c05 g_t_12 g_c_ul g_c_hand">删除</span></div>\
    </div>\
    <div class="g_p_left g_t_left" style="width:145px;">\
     <div id="name_${album.id}" {if album.id!=unassortedAlbumId && album.id!=selfCapAlbumId}alt="点击即可编辑" title="点击即可编辑"{/if} class="g_t_hide c05" style="font-size:14px;line-height:120%;margin-top:3px;width:140px;">${album.albumName}</div>\
     <div class="g_t_hide c09 g_t_12" style="margin-top:5px;">${album.photoCount}张相片&nbsp;{if album.id!=unassortedAlbumId} ${NetEase.DateTime.formatDate(album.createTime,"yyyy-MM-dd")}{/if}</div>\
     <br/><br/>\
     <div class="g_c_hand g_t_12" onclick="return openFlashPlayer(true, \'${album.id}\');"><span class="n_ f25">&nbsp;</span><span class="c05 g_c_ul" href="#">播放幻灯片</span></div>\
    </div>\
    <div style="clear:both"></div>\
   </div>\
   </td>{if album_index%3==2}</tr>{/if}\
  {/if}\
 {forelse}\
  <tr><td><div class="c07 g_t_14 g_c_vmgin">暂无相册</div></td></tr>\
 {/for}\
 {if i > 0 && i%3 != 0}\
  <td colspan="${3-i%3}">&nbsp;</td></tr>\
 {/if}\
 </table>\
');
var jst_sort_album_all=new String('\
 {if albumList.length == 2 && albumList[0].id == selfCapAlbumId && albumList[1].id == unassortedAlbumId}\
  <div class="c07 g_t_14 g_c_vmgin">暂无相册</div>\
 {/if}\
 {for album in albumList}\
 {if album.id != unassortedAlbumId && album.id != selfCapAlbumId}\
 <div id="wrapper_${album.id}" style="margin:4px 4px" class="g_p_left g_img_01nsort">\
  <div class="p_ p29">\
   <img id="${album.id}" \
   {if (album.coverPhUrl =="0" || album.coverPhId=="0")}\
          src="http://b.bst.126.net/style/common/album_face.gif"\
      {else}\
          src="${album.coverPhUrl}"\
         {/if} alt="${album.albumName}" />\
  </div>\
  <div style="font-size: 14px; margin-top: 3px; width: 100px;" class="g_t_hide c07" id="name_${album.id}">${album.albumName}</div>\
 </div>\
 {/if}\
 {/for}\
');
var _$_controller_prohibit_user=false;
var _$_controller_nonactive_user=false;
var _$_controller_undefined_error_a=false;
var _$_controller_undefined_error_p=false;
var g_album_log_util={
maxLength:50,
logs:[],
browserInfo:window.navigator.userAgent,
clearedCookies:null,
needLog:function(){
var result=UD.hostId==UD.visitorId;
g_album_log_util.needLog=function(){
return result;
}
return g_album_log_util.needLog();
},
addLog:function(){
if(!g_album_log_util.needLog()){
g_album_log_util.addLog=function(){};
return;
}
if(g_album_log_util.logs.length>g_album_log_util.maxLength){
g_album_log_util.logs.shift();
}
g_album_log_util.logs.push(g_album_log_util.getTime()+'\t'+$A(arguments).join('\t')+'\n');
},
getLog:function(){
g_album_log_util.logs.unshift(g_album_log_util.getBasicInfo());
if(g_album_log_util.clearedCookies!=null){
g_album_log_util.logs.unshift(g_album_log_util.getClearedCookies());
}
var result=g_album_log_util.logs.join('|');
g_album_log_util.logs=[];
return result;
},
getBasicInfo:function(){
return'BrowserInfo:'+g_album_log_util.browserInfo+'\n';
},
getClearedCookies:function(){
return'ClearedCookies:'+g_album_log_util.clearedCookies+'\n';
},
getTime:function(){
var d=new Date();
return d.getFullYear()+'-'+(d.getMonth()+1)+'-'+d.getDate()+' '+d.getHours()+':'+d.getMinutes()+':'+d.getSeconds()+'.'+d.getMilliseconds();
},
notify163WhenError:function(url){
var headLoc,scriptId,scriptObj;
headLoc=document.getElementsByTagName("head").item(0);
scriptObj=document.createElement("script");
scriptObj.setAttribute("src",url);
headLoc.appendChild(scriptObj);
}
};
var g_album_cookie_util={
reloadCount:0,
g_saveCookieKeys:['JSESSIONID','NTES_UFC','NTESBLOGSI','NTESBLOGMSGSI','NTES_PASSPORT','NEBLOG_LOGIN','NTES_SESS','NETEASE_AUTH_USERNAME','NETEASE_AUTH_SOURCE','ALBUMAPPID','S_INFO','P_INFO'],
get:function(name){
var pattern="(^|;)\\s*"+escape(name)+"=([^;]+)";
var m=document.cookie.match(pattern);
if(m&&m[2]){
return unescape(m[2]);
}else{
return null;
}
},
set:function(name,value,expirationInDays,path,domain){
var cookie=escape(name)+"="+escape(value);
if(expirationInDays){
var date=new Date();
date.setDate(date.getDate()+expirationInDays);
cookie+="; expires="+date.toGMTString();
}
if(path){
cookie+=";path="+path;
}
if(domain){
cookie+=";domain="+domain;
}
document.cookie=cookie;
if(value&&(expirationInDays==undefined||expirationInDays>0)&&!g_album_cookie_util.get(name)){
return false;
}
},
clearMine:function(name){
g_album_cookie_util.set(name,"",-1,'/','163.com');
},
isSaveCookie:function(key){
for(var i=0,l=g_album_cookie_util.g_saveCookieKeys.length;i<l;i++){
if(g_album_cookie_util.g_saveCookieKeys[i]==key)
return true;
}
return false;
},
clearOtherCookie:function(hostName,callback){
if(g_album_controller.getUserSpaceDone){
g_album_controller.getUserSpaceDone=null;
return;
}
var cookieStr='';
for(var i=0,_arr=document.cookie.split(';'),l=_arr.length,_idx,_key;i<l;i++){
_arr[i]=_arr[i].replace(/(?:^\s+)|(?:\s+$)/g,'');
_idx=_arr[i].indexOf('=');
if(_idx!=-1){
_key=_arr[i].substring(0,_idx);
if(!g_album_cookie_util.isSaveCookie(_key)){
cookieStr+=(_key+'='+g_album_cookie_util.get(_key)+';');
g_album_cookie_util.clearMine(_key);
}
}
}
g_album_log_util.clearedCookies=cookieStr;
if(g_album_cookie_util.reloadCount==0){
g_album_cookie_util.reloadCount=1;
g_album_controller.getUserSpace(hostName,callback);
}
}
};
var g_album_controller_w={
iframeLoadStatus:0,
crossdomain:true,
loadIframeCountLimit:20,
retryTime:1000,
setCrossdomain:function(crossdomain){
this.crossdomain=crossdomain;
},
addIframe:function(hostName){
this.iframeLoadStatus=1;
document.domain="163.com";
var _iframe=document.getElementById('photo163Iframe');
if(_iframe==null){
g_album_log_util.addLog(hostName,"load iframe begin");
_iframe=document.createElement('iframe');
_iframe.id='photo163Iframe';
_iframe.name='photo163Iframe';
var visitorName=UD.visitorName||data_map_util.getCookie('NETEASE_AUTH_USERNAME');
if(!visitorName){
_iframe.src='http://photo.163.com/photo/dwrcross/'+hostName+'/';
}else{
_iframe.src='http://photo.163.com/photo/dwrcross/'+hostName+'/?u='+visitorName;
}
isIE?_iframe.onreadystatechange=this.ld_stateChange.bind(this,_iframe)
:_iframe.onload=this.ld_callback.bind(this,_iframe);
_iframe.style.display='none';
document.body.appendChild(_iframe);
}
},
ld_stateChange:function(_iframe){
var _state=_iframe.readyState;
if(_state=='loaded'||_state=='complete'){
this.ld_callback(_iframe);
}
},
ld_callback:function(_iframe){
g_album_log_util.addLog(hostName,"iframe readystate change");
this.iframeLoadStatus=2;
},
isIframeLoadingComplete:function(hostName){
if(this.iframeLoadStatus==0){
this.addIframe(hostName);
return true;
}else if(this.iframeLoadStatus==1){
return true;
}
try{
var result=!window.frames['photo163Iframe']||!window.frames['photo163Iframe'].g_dwrcrossphoto;
if(result==false){
g_album_log_util.addLog(hostName,"load iframe end");
}
return result;
}catch(e){
if(this.loadIframeCountLimit-->=0){
if(this.loadIframeCountLimit==14){
this.notifyLoadIframeFailed(hostName);
}
return true;
}
throw e;
}
},
notifyLoadIframeFailed:function(hostName){
var headLoc,scriptId,scriptObj;
headLoc=document.getElementsByTagName("head").item(0);
scriptObj=document.createElement("script");
scriptObj.setAttribute("src","http://photo.163.com/photo/dwrcross/iframefailedagain.js?h="+hostName+"&domain="+document.domain);
headLoc.appendChild(scriptObj);
},
createAlbum:function(hostName,album,callback){
g_album_controller.getAlbums(hostName,function(albums){
if(albums!=null&&albums.length>=1000){
alert('最多只能创建1000个相册。');
}else{
g_album_controller_w.createAlbum0(hostName,album,callback);
}
});
},
createAlbum0:function(hostName,album,callback){
if(this.isIframeLoadingComplete(hostName)){
setTimeout(this.createAlbum.bind(this,hostName,album,callback),this.retryTime);
return;
}
window.frames['photo163Iframe'].g_dwrcrossphoto._$createAlbum(album,function(album){
if(album==null||album.errorType==2){
callback(album);
return;
}
g_album_controller.clearUserSpace(hostName);
NewAlbum.needUpdateModifyTime('CreateAlbum');
callback(data_map_util.getOldAlbum(album));
});
},
deleteAlbum:function(hostName,id,callback){
if(this.isIframeLoadingComplete(hostName)){
setTimeout(this.deleteAlbum.bind(this,hostName,id,callback),this.retryTime);
return;
}
g_album_log_util.addLog(hostName,'delete album begin','aid:'+id);
window.frames['photo163Iframe'].g_dwrcrossphoto._$deleteAlbum(id,function(suc){
g_album_log_util.addLog(hostName,'delete album end');
g_album_controller.clearUserSpace(hostName);
NewAlbum.needUpdateModifyTime();
callback(suc);
});
},
deletePhotos:function(hostName,aid,pids,callback){
if(this.isIframeLoadingComplete(hostName)){
setTimeout(this.deletePhotos.bind(this,hostName,aid,pids,callback),this.retryTime);
return;
}
g_album_log_util.addLog(hostName,'delete photo begin','aid:'+aid,'pid:'+pids);
window.frames['photo163Iframe'].g_dwrcrossphoto._$deletePhotos(aid,pids,function(album){
g_album_log_util.addLog(hostName,'delete photo end');
g_album_controller.clearUserSpace(hostName);
NewPhoto.needUpdateModifyTime();
callback(data_map_util.getOldAlbum(album));
});
},
movePhotos:function(hostName,pids,srcId,destId,callback){
if(this.isIframeLoadingComplete(hostName)){
setTimeout(this.movePhotos.bind(this,hostName,pids,srcId,destId,callback),this.retryTime);
return;
}
window.frames['photo163Iframe'].g_dwrcrossphoto._$movePhotos(pids,srcId,destId,function(albumList){
g_album_controller.clearUserSpace(hostName);
NewPhoto.needUpdateModifyTime();
callback(data_map_util.getOldAlbums(albumList));
});
},
copyPhotos:function(hostName,pids,srcId,destId,callback){
if(this.isIframeLoadingComplete(hostName)){
setTimeout(this.copyPhotos.bind(this,hostName,pids,srcId,destId,callback),this.retryTime);
return;
}
window.frames['photo163Iframe'].g_dwrcrossphoto._$copyPhotos(pids,srcId,destId,function(album){
g_album_controller.clearUserSpace(hostName);
NewPhoto.needUpdateModifyTime();
callback(data_map_util.getOldAlbum(album));
});
},
updateAlbumName:function(hostName,_id,_name,_callback){
if(this.isIframeLoadingComplete(hostName)){
setTimeout(this.updateAlbumName.bind(this,hostName,_id,_name,_callback),this.retryTime);
return;
}
g_album_log_util.addLog(hostName,'update album name begin','aid:'+_id);
window.frames['photo163Iframe'].g_dwrcrossphoto._$updateAlbumName(_id,_name,function(album){
if(album==null||album.errorType==2){
_callback(album);
return;
}
g_album_log_util.addLog(hostName,'update album name end','aid:'+_id);
g_album_controller.clearUserSpace(hostName);
NewAlbum.needUpdateModifyTime();
_callback(data_map_util.getOldAlbum(album));
});
},
updateAlbumDesc:function(hostName,_id,_desc,_callback){
if(this.isIframeLoadingComplete(hostName)){
setTimeout(this.updateAlbumDesc.bind(this,hostName,_id,_desc,_callback),this.retryTime);
return;
}
g_album_log_util.addLog(hostName,'update album desc begin','aid:'+_id);
window.frames['photo163Iframe'].g_dwrcrossphoto._$updateAlbumDesc(_id,_desc,function(album){
if(album==null||album.errorType==2){
_callback(album);
return;
}
g_album_log_util.addLog(hostName,'update album desc end','aid:'+_id);
g_album_controller.clearUserSpace(hostName);
NewAlbum.needUpdateModifyTime();
_callback(data_map_util.getOldAlbum(album));
});
},
updateAlbumType:function(hostName,_id,_type,_password,_callback){
if(this.isIframeLoadingComplete(hostName)){
setTimeout(this.updateAlbumType.bind(this,hostName,_id,_type,_password,_callback),this.retryTime);
return;
}
window.frames['photo163Iframe'].g_dwrcrossphoto._$updateAlbumType(_id,_type,_password,function(album){
g_album_controller.clearUserSpace(hostName);
NewAlbum.needUpdateModifyTime();
_callback(data_map_util.getOldAlbum(album));
});
},
updateAlbumCover:function(hostName,_aid,_pid,_callback){
if(this.isIframeLoadingComplete(hostName)){
setTimeout(this.updateAlbumCover.bind(this,hostName,_aid,_pid,_callback),this.retryTime);
return;
}
window.frames['photo163Iframe'].g_dwrcrossphoto._$updateAlbumCover(_aid,_pid,function(album){
g_album_controller.clearUserSpace(hostName);
_callback(data_map_util.getOldAlbum(album));
});
},
changeAlbumSort:function(hostName,_type,_seq,_callback){
if(this.isIframeLoadingComplete(hostName)){
setTimeout(this.changeAlbumSort.bind(this,hostName,_type,_seq,_callback),this.retryTime);
return;
}
window.frames['photo163Iframe'].g_dwrcrossphoto._$changeAlbumSort(_type,_seq,function(suc){
g_album_controller.clearUserSpace(hostName);
_callback(suc);
});
},
changePhotoSort:function(hostName,_id,_type,_seq,_callback){
if(this.isIframeLoadingComplete(hostName)){
setTimeout(this.changePhotoSort.bind(this,hostName,_id,_type,_seq,_callback),this.retryTime);
return;
}
window.frames['photo163Iframe'].g_dwrcrossphoto._$changePhotoSort(_id,_type,_seq,function(suc){
g_album_controller.clearUserSpace(hostName);
_callback(suc);
});
},
updatePhotoDesc:function(hostName,_aid,_pid,_desc,_callback){
if(this.isIframeLoadingComplete(hostName)){
setTimeout(this.updatePhotoDesc.bind(this,hostName,_aid,_pid,_desc,_callback),this.retryTime);
return;
}
g_album_log_util.addLog(hostName,'update photo desc begin','aid:'+_aid,'pid:'+_pid);
window.frames['photo163Iframe'].g_dwrcrossphoto._$updatePhotoDesc(_aid,_pid,_desc,function(photo){
if(photo==null||photo.errorType==2){
_callback(photo);
return;
}
g_album_log_util.addLog(hostName,'update photo desc end','aid:'+_aid,'pid:'+_pid);
g_album_controller.clearUserSpace(hostName);
NewPhoto.needUpdateModifyTime();
g_album_controller.getAlbum(hostName,_aid,function(album){
_callback(data_map_util.getOldPhoto(photo,album));
});
});
},
updatePhotoKeywordPhoto:function(hostName,_aid,_pid,_keyword,_callback){
if(this.isIframeLoadingComplete(hostName)){
setTimeout(this.updatePhotoKeywordPhoto.bind(this,hostName,_aid,_pid,_keyword,_callback),this.retryTime);
return;
}
window.frames['photo163Iframe'].g_dwrcrossphoto._$updatePhotoKeyword(_aid,_pid,_keyword,function(photo){
g_album_controller.clearUserSpace(hostName);
g_album_controller.getAlbum(hostName,_aid,function(album){
_callback(data_map_util.getOldPhoto(photo,album));
});
});
},
getAvatar:function(avatar){
if(avatar==null||avatar=='-1000'){
return'';
}
return avatar;
},
createAlbumCom:function(hostName,_id,_content,_visitName,_visitNickName,_visitAvatar,replyToUserName,_valCode,_callback){
this.createAlbumComEx(hostName,_id,_content,_visitName,_visitNickName,_visitAvatar,1,"",replyToUserName,_valCode,_callback)
},
createCircleAlbumCom:function(hostName,_id,_content,_visitName,_visitNickName,_visitAvatar,replyToUserName,circleName,circleUrlName,_valCode,_callback){
var dataEx=circleName+";"+circleUrlName;
this.createAlbumComEx(hostName,_id,_content,_visitName,_visitNickName,_visitAvatar,2,dataEx,replyToUserName,_valCode,_callback)
},
createAlbumComEx:function(hostName,_id,_content,_visitName,_visitNickName,_visitAvatar,_reviewerType,_dataEx,replyToUserName,_valCode,_callback){
if(this.isIframeLoadingComplete(hostName)){
setTimeout(this.createAlbumComEx.bind(this,hostName,_id,_content,_visitName,_visitNickName,_visitAvatar,_reviewerType,_dataEx,replyToUserName,_valCode,_callback),this.retryTime);
return;
}
_visitAvatar=this.getAvatar(_visitAvatar);
if(_valCode==-1){
window.frames['photo163Iframe'].g_dwrcrossphoto._$createAlbumCom(_id,_content,_visitName,_visitNickName,_visitAvatar,_reviewerType,_dataEx,replyToUserName,function(comm){
if(comm==null||comm.errorType>0){
_callback(comm);
return;
}
NewAlbum.monitorAlbumCommCreate();
_callback(data_map_util.getOldComm(comm));
});
}else{
window.frames['photo163Iframe'].g_dwrcrossphoto._$createAlbumComAnonymous(_id,_content,_visitName,_visitNickName,_visitAvatar,_reviewerType,_dataEx,replyToUserName,_valCode,function(comm){
if(comm==null||comm.errorType>0){
_callback(comm);
return;
}
NewAlbum.monitorAlbumCommCreate();
_callback(data_map_util.getOldComm(comm));
});
}
},
createPhotoCom:function(hostName,_aid,_pid,_content,_visitName,_visitNickName,_visitAvatar,replyToUserName,_valCode,_callback){
this.createPhotoComEx(hostName,_aid,_pid,_content,_visitName,_visitNickName,_visitAvatar,1,"",replyToUserName,_valCode,_callback);
},
createCirclePhotoCom:function(hostName,_aid,_pid,_content,_visitName,_visitNickName,_visitAvatar,replyToUserName,circleName,circleUrlName,_valCode,_callback){
var dataEx=circleName+";"+circleUrlName;
this.createPhotoComEx(hostName,_aid,_pid,_content,_visitName,_visitNickName,_visitAvatar,2,dataEx,replyToUserName,_valCode,_callback);
},
createPhotoComEx:function(hostName,_aid,_pid,_content,_visitName,_visitNickName,_visitAvatar,_reviewerType,_dataEx,replyToUserName,_valCode,_callback){
if(this.isIframeLoadingComplete(hostName)){
setTimeout(this.createPhotoComEx.bind(this,hostName,_aid,_pid,_content,_visitName,_visitNickName,_visitAvatar,_reviewerType,_dataEx,replyToUserName,_valCode,_callback),this.retryTime);
return;
}
_visitAvatar=this.getAvatar(_visitAvatar);
if(_valCode==-1){
window.frames['photo163Iframe'].g_dwrcrossphoto._$createPhotoCom(_aid,_pid,_content,_visitName,_visitNickName,_visitAvatar,_reviewerType,_dataEx,replyToUserName,function(comm){
if(comm==null||comm.errorType>0){
_callback(comm);
return;
}
_callback(data_map_util.getOldComm(comm));
});
}else{
window.frames['photo163Iframe'].g_dwrcrossphoto._$createPhotoComAnonymous(_aid,_pid,_content,_visitName,_visitNickName,_visitAvatar,_reviewerType,_dataEx,replyToUserName,_valCode,function(comm){
if(comm==null||comm.errorType>0){
_callback(comm);
return;
}
_callback(data_map_util.getOldComm(comm));
});
}
},
deleteAlbumCom:function(hostName,_aid,_cids,_callback){
if(this.isIframeLoadingComplete(hostName)){
setTimeout(this.deleteAlbumCom.bind(this,hostName,_aid,_cids,_callback),this.retryTime);
return;
}
window.frames['photo163Iframe'].g_dwrcrossphoto._$deleteAlbumCom(_aid,_cids,function(success){
if(success)
g_album_controller.clearUserSpace(hostName);
_callback(success);
});
},
deletePhotoCom:function(hostName,_aid,_pid,_cids,_callback){
if(this.isIframeLoadingComplete(hostName)){
setTimeout(this.deletePhotoCom.bind(this,hostName,_aid,_pid,_cids,_callback),this.retryTime);
return;
}
window.frames['photo163Iframe'].g_dwrcrossphoto._$deletePhotoCom(_aid,_pid,_cids,function(success){
if(success)
g_album_controller.clearUserSpace(hostName);
_callback(success);
});
}
}
var g_album_controller={
getVisitorName:function(){
var visitorName=UD.visitorName||data_map_util.getCookie('NETEASE_AUTH_USERNAME')||'';
g_album_controller.getVisitorName=function(){
return visitorName;
}
return g_album_controller.getVisitorName();
},
userSpaces:{},
privacyMap:{
0:-100,
1:9000,
2:10000,
4:100
},
getUserSpace:function(hostName,callback){
if(this.userSpaces[hostName]!=null){
callback(this.userSpaces[hostName]);
return;
}
g_album_log_util.addLog(hostName,'getUserSpace begin');
window.setTimeout(function(){
g_album_cookie_util.clearOtherCookie(hostName,callback);
},5000);
window.setTimeout(function(){
if(!g_album_controller.userspaceReturned){
var v=g_album_controller.getVisitorName();
var owner=(v==hostName)?'&owner':'';
g_album_log_util.notify163WhenError("http://photo.163.com/photo/dwrcross/userSpaceError.js/?u="+hostName+owner);
if(v==hostName){
var photo_content=$('_$_photo_list_content');
if(photo_content!=null&&photo_content.innerHTML=='数据加载中...'){
photo_content.innerHTML='数据加载中...<br>如果长时间没有加载成功，请向我们<a style="color:#0000FF;line-height:25px;text-decoration:underline;" href="#" onclick="showFeedbackDialog(1);return false;">反馈</a>';
}
}
}
},12000);
Photo163.getUserSpace(hostName,this.getVisitorName(),function(user){
this.userspaceReturned=true;
this.getUserSpaceDone=true;
g_album_log_util.addLog(hostName,'getUserSpace end','cacheUrl:'+(user&&user.cacheFileUrl));
if(user!=null){
if(user.userType==-1){
_$_controller_prohibit_user=true;
if(UD.visitorRank==10000){
this.getUserSpaceWithSec(hostName,function(user){
this.getUserSpaceCb(user,hostName,callback);
}.bind(this));
}else{
this.getUserSpaceCb(null,hostName,callback);
}
}else{
this.getUserSpaceCb(user,hostName,callback);
}
}else{
if(UD.visitorRank==10000){
this.getUserSpaceWithSec(hostName,function(user){
this.getUserSpaceCb(user,hostName,callback);
}.bind(this));
}else{
_$_controller_nonactive_user=true;
this.getUserSpaceCb(user,hostName,callback);
}
}
}.bind(this));
},
getUserSpaceCb:function(user,hostName,callback){
if(!!user){
user.cacheFileUrl="http://"+user.cacheFileUrl;
this.userSpaces[hostName]=user;
callback(user);
}else{
callback(null);
}
},
clearUserSpace:function(hostName){
this.userSpaces[hostName]=null;
},
getpurlOfAlbum:function(hostName,album,callback){
var b=(!!album.id)&&(!album.purl);
if(b){
this.getPhotoIndexUrl(hostName,album.id,album.modifyTime,function(purl){
if(!!purl){
album.purl="http://"+purl;
album.album.purl=purl;
}
callback(album);
});
}else{
callback(album);
}
},
getVisiblePhotoCount:function(hostName,callback){
this.getAlbums(hostName,function(albumList){
albumList=this.getVisibleAlbumList(albumList);
var count=0;
albumList.each(function(item){
count+=item.photoCount;
});
callback(count);
}.bind(this));
},
getAlbum:function(hostName,albumId,callback){
this.getUserSpace(hostName,function(userSpace){
if(!userSpace){
callback({});
}
LD.dynamicLoadJS(userSpace.cacheFileUrl,function(){
var albumList=this.getAlbumListFromJS(userSpace);
var album=this.getAlbumFromList(albumList,albumId);
callback(data_map_util.getOldAlbum(album));
}.bind(this));
}.bind(this));
},
getAlbumRankStr:function(hostName,albumId,callback){
this.getUserSpace(hostName,function(userSpace){
if(!userSpace){
callback("未知");
}
LD.dynamicLoadJS(userSpace.cacheFileUrl,function(){
var albumList=this.getAlbumListFromJS(userSpace);
var album=this.getAlbumFromList(albumList,albumId);
return callback(data_map_util.getRankString(album.au));
}.bind(this));
}.bind(this));
},
getAlbums:function(hostName,callback){
this.getUserSpace(hostName,function(userSpace){
if(!userSpace){
callback([]);
}
LD.dynamicLoadJS(userSpace.cacheFileUrl,function(){
var albumList=this.getAlbumListFromJS(userSpace);
callback(data_map_util.getOldAlbums(albumList));
}.bind(this));
}.bind(this));
},
getPhoto:function(hostName,albumId,photoId,callback){
this.getAlbum(hostName,albumId,function(album){
this.getPhotoCb(hostName,photoId,album,callback);
}.bind(this));
},
getPhotoCb:function(hostName,photoId,album,callback){
this.getpurlOfAlbum(hostName,album,function(retAlbum){
if(!retAlbum.purl){
callback({});
return;
}
LD.dynamicLoadJS(retAlbum.purl,function(){
var photoList=this.getPhotoListFromJS(retAlbum);
var photo=this.getPhotoFromList(photoList,photoId);
callback(data_map_util.getOldPhoto(photo,retAlbum));
}.bind(this),{type:1,albumId:album.id});
}.bind(this));
},
getCommentsInAlbum:function(hostName,albumId,limit,offset,callback){
this.getAlbum(hostName,albumId,function(album){
if(!album.comm){
callback([]);
}
LD.dynamicLoadJS(album.comm,function(){
var commList=this.getAlbumCommFromJS(album.id);
callback(data_map_util.getOldComms(commList.slice(offset,offset+limit)));
}.bind(this),{type:2,albumId:albumId});
}.bind(this));
},
getCommentsInPhoto:function(hostName,albumId,photoId,limit,offset,callback){
this.getPhoto(hostName,albumId,photoId,function(photo){
if(!photo.comm){
callback([]);
}
LD.dynamicLoadJS(photo.comm,function(){
var commList=this.getPhotoCommFromJS(photo.id);
callback(data_map_util.getOldComms(commList.slice(offset,offset+limit)));
}.bind(this),{type:3,albumId:albumId,photoId:photoId});
}.bind(this));
},
getAllPhotosInAlbum:function(hostName,albumId,callback){
this.getAlbum(hostName,albumId,function(album){
this.getAllPhotosInAlbumCb(hostName,album,callback);
}.bind(this));
},
getAllPhotosInAlbumCb:function(hostName,album,callback){
this.getpurlOfAlbum(hostName,album,function(retAlbum){
if(!retAlbum.purl){
callback([]);
return;
}
LD.dynamicLoadJS(retAlbum.purl,function(){
var photoList=this.getPhotoListFromJS(retAlbum);
callback(data_map_util.getOldPhotos(photoList,retAlbum));
}.bind(this),{type:1,albumId:album.id});
}.bind(this));
},
getPhotosInAlbumByLimitOffset:function(hostName,albumId,limit,offset,callback){
this.getAlbum(hostName,albumId,function(album){
this.getPhotosInAlbumCb(hostName,album,limit,offset,callback);
}.bind(this));
},
getPhotosInAlbumCb:function(hostName,album,limit,offset,callback){
this.getpurlOfAlbum(hostName,album,function(retAlbum){
if(!retAlbum.purl){
callback([]);
return;
}
if(offset==0){
g_album_log_util.addLog(hostName,'getPhotos begin','aid:'+album.id,'purl:'+retAlbum.purl);
}
LD.dynamicLoadJS(retAlbum.purl,function(){
if(offset==0){
g_album_log_util.addLog(hostName,'getPhotos end','aid:'+album.id);
}
var photoList=this.getPhotoListFromJS(retAlbum);
callback(data_map_util.getOldPhotos(photoList.slice(offset,offset+limit),retAlbum));
}.bind(this),{type:1,albumId:album.id});
}.bind(this));
},
getPhotosInAlbum:function(hostName,albumId,photoId,preLimit,nextLimit,callback){
if(preLimit==0&&nextLimit==0){
callback([]);
return;
}
this.getAlbum(hostName,albumId,function(album){
this.getpurlOfAlbum(hostName,album,function(retAlbum){
LD.dynamicLoadJS(retAlbum.purl,function(){
var photoList=this.getPhotoListFromJS(retAlbum);
var photo=this.getPhotoFromList(photoList,photoId);
if(photo==null){
return;
}
var count=photoList.length;
var index=photoList.indexOf(photo);
var prePart=[];
var nextPart=[];
if(preLimit>0){
var start=index-preLimit;
if(start<0){
start=0;
}
prePart=photoList.slice(start,index);
}
if(nextLimit>0){
var end=index+nextLimit+1;
if(end>=count){
end=count;
}
nextPart=photoList.slice(index+1,end);
}
if(preLimit>0&&nextLimit>0){
photoList=prePart.concat([photo],nextPart);
}else{
photoList=prePart.concat(nextPart);
}
callback(data_map_util.getOldPhotos(photoList,album));
}.bind(this),{type:1,albumId:retAlbum.id});
}.bind(this));
}.bind(this));
},
getVisibleAlbumList:function(albumList){
if(UD.visitorRank==10000){
return albumList;
}else if(UD.visitorRank==100){
var ret=[];
albumList.each(function(item){
if(item.au==0||item.au==4||!!item.purl){
ret.push(item);
}
});
return ret;
}else{
var ret=[];
albumList.each(function(item){
if(item.au==0||!!item.purl){
ret.push(item);
}
});
return ret;
}
},
getPhotosInUserByLimitOffset:function(hostName,limit,offset,callback){
if(limit<=0||offset<0){
return;
}
this.getAlbums(hostName,function(albumList){
var startAlbumIndex=-1;
albumList=this.getVisibleAlbumList(albumList);
for(var i=0;i<albumList.length;i++){
if(offset<albumList[i].photoCount){
startAlbumIndex=i;
break;
}else{
offset-=albumList[i].photoCount;
}
}
if(startAlbumIndex>=0){
this.addPhotosToList(hostName,albumList,startAlbumIndex,[],offset+limit,function(photoList){
callback(photoList.slice(offset,offset+limit));
});
}else{
callback([]);
}
}.bind(this));
},
addPhotosToList:function(hostName,albumList,index,photoList,limit,callback){
if(index>=albumList.length){
callback(photoList);
return;
}
var album=albumList[index];
this.getpurlOfAlbum(hostName,album,function(retAlbum){
if(!retAlbum.purl){
this.addPhotosToList(hostName,albumList,index+1,photoList,limit,callback);
return;
}
LD.dynamicLoadJS(retAlbum.purl,function(){
var list=this.getPhotoListFromJS(retAlbum);
photoList=photoList.concat(data_map_util.getOldPhotos(list,retAlbum));
if(photoList.length<limit){
this.addPhotosToList(hostName,albumList,index+1,photoList,limit,callback);
}else{
callback(photoList);
}
}.bind(this),{type:1,albumId:retAlbum.id});
}.bind(this));
},
getPhotosInUser:function(hostName,albumId,photoId,preLimit,nextLimit,callback){
if(preLimit==0&&nextLimit==0){
callback([]);
return;
}
this.getAlbums(hostName,function(albumList){
var album=this.getAlbumFromList(albumList,albumId);
this.getpurlOfAlbum(hostName,album,function(retAlbum){
if(!retAlbum.purl){
callback([]);
return;
}
LD.dynamicLoadJS(retAlbum.purl,function(){
var photoList=this.getPhotoListFromJS(retAlbum);
var photo=this.getPhotoFromList(photoList,photoId);
if(photo==null){
return;
}
albumList=this.getVisibleAlbumList(albumList);
var index=photoList.indexOf(photo);
var albumIndex=-1;
for(var i=0;i<albumList.length;i++){
if(albumList[i].id==retAlbum.id){
albumIndex=i;
break;
}
}
if(albumIndex<0){
return;
}
var offset=0;
var limit=preLimit;
if(preLimit==0){
offset=index+1;
}else if(index>=preLimit){
offset=index-preLimit;
}else{
preLimit-=index;
for(var i=albumIndex-1;i>=0;i--){
if(preLimit<albumList[i].photoCount){
albumIndex=i;
offset=albumList[i].photoCount-preLimit;
preLimit=0;
break;
}else if(albumList[i].photoCount>0){
albumIndex=i;
preLimit-=albumList[i].photoCount;
}
}
limit-=preLimit;
}
if(nextLimit>0&&limit>0){
limit+=nextLimit+1;
}else{
limit+=nextLimit;
}
this.addPhotosToList(hostName,albumList,albumIndex,[],offset+limit,function(photoList){
callback(photoList.slice(offset,offset+limit));
});
}.bind(this),{type:1,albumId:retAlbum.id});
}.bind(this));
}.bind(this));
},
getPhotoListFromJS:function(album){
var photoListkey='g_p$'+album.id+'d';
if(typeof window[photoListkey]=='undefined'){
_$_controller_undefined_error_p=true;
g_album_log_util.addLog(photoListkey+" is undefined");
var user=UD.hostName?UD.hostName:"";
g_album_log_util.notify163WhenError("http://photo.163.com/photo/dwrcross/undefinedError.js/?u="+user+"&purl="+album.purl);
}else{
_$_controller_undefined_error_p=false;
}
var photoList=window[photoListkey]||[];
if(photoList.length==0){
return[];
}
if(album.photoCount!=photoList.length){
g_album_log_util.addLog(album.id,"photo count:"+album.photoCount+",count:"+photoList.length);
}
var sortKey='g_p$'+album.id+'s';
var retList=[].concat(photoList);
var sortedList=this.sortList(retList,album.seqType,sortKey,1);
if(album.photoCount!=sortedList.length){
g_album_log_util.addLog(album.id,"photo count:"+album.photoCount+",sorted count:"+sortedList.length);
}
return sortedList;
},
getAlbumListFromJS:function(userSpace){
var albumListkey='g_a$'+userSpace.userId+'d';
if(typeof window[albumListkey]=='undefined'){
_$_controller_undefined_error_a=true;
g_album_log_util.addLog(albumListkey+" is undefined");
var user=UD.hostName?UD.hostName:userSpace.userId;
g_album_log_util.notify163WhenError("http://photo.163.com/photo/dwrcross/undefinedError.js/?u="+user+"&cacheUrl="+userSpace.cacheFileUrl);
}else{
_$_controller_undefined_error_a=false;
}
var albumList=window[albumListkey]||[];
if(albumList.length==0){
return[];
}
if(userSpace.albumCount!=albumList.length){
g_album_log_util.addLog("album count in userspace:"+userSpace.albumCount+",count:"+albumList.length);
}
var sortKey='g_a$'+userSpace.userId+'s';
var retList=[].concat(albumList);
var sortedList=this.sortList(retList,userSpace.seqType,sortKey,0);
if(userSpace.albumCount!=sortedList.length){
g_album_log_util.addLog("album count in userspace:"+userSpace.albumCount+",sorted count:"+sortedList.length);
}
return sortedList;
},
sortList:function(list,seqType,sortKey,apType){
switch(seqType){
case 0:
list.sort(function(val1,val2){
return val1.t-val2.t;
});
break;
case 1:
list.sort(function(val1,val2){
return val2.t-val1.t;
});
break;
case 2:
if(apType==0){
list.sort(function(val1,val2){
return val1.count-val2.count;
});
}
break;
case 3:
if(apType==0){
list.sort(function(val1,val2){
return val2.count-val1.count;
});
}
break;
case 4:
if(apType==0){
list.sort(function(val1,val2){
return val1.name.localeCompare(val2.name);
});
}else if(apType==1){
list.sort(function(val1,val2){
return val1.desc.localeCompare(val2.desc);
});
}
break;
case 5:
if(apType==0){
list.sort(function(val1,val2){
return val2.name.localeCompare(val1.name);
});
}else if(apType==1){
list.sort(function(val1,val2){
return val2.desc.localeCompare(val1.desc);
});
}
break;
case 6:
if(apType==0){
list.sort(function(val1,val2){
return val1.ut-val2.ut;
});
}
break;
case 7:
if(apType==0){
list.sort(function(val1,val2){
return val2.ut-val1.ut;
});
}
break;
case 8:
var _hash={};
var ids=window[sortKey].split(';')||[];
list.each(function(item){
_hash[item.id]=item;
ids.push(item.id);
});
var ret=[];
ids.find(function(id){
if(_hash[id]!=null){
ret.push(_hash[id]);
if(ret.length>=list.length){
return true;
}
_hash[id]=null;
}
});
list=ret;
break;
}
return list;
},
getAlbumCommFromJS:function(albumId){
var _key='g_ac$'+albumId+'d';
return window[_key]||[];
},
getPhotoCommFromJS:function(photoId){
var _key='g_pc$'+photoId+'d';
return window[_key]||[];
},
getPhotoFromList:function(photoList,photoId){
return photoList.find(function(item){
if(item.id==photoId){
return true;
}
});
},
getAlbumFromList:function(albumList,albumId){
return albumList.find(function(item){
if(item.id==albumId){
return true;
}
});
},
getAlbumWithPassword:function(hostName,album,password,callback){
this.checkAlbumPassword(hostName,album.id,password,'fromblog',album.modifyTime,function(purl){
if(purl){
album.purl="http://"+purl;
}
callback(album);
});
},
getAlbumsInSession:function(hostName,callback){
Photo163.getAlbumData4PwdInSession(hostName,this.getVisitorName(),callback).bind(this);
},
checkAlbumPassword:function(hostName,_id,_password,_key,_modifyTime,_callback){
g_album_log_util.addLog(hostName,"getAlbumData begin",'aid:'+_id);
Photo163.getAlbumData(hostName,this.getVisitorName(),_id,_password,_key,_modifyTime,function(purl){
g_album_log_util.addLog(hostName,"getAlbumData end",'aid:'+_id,'purl:'+purl);
_callback(purl);
});
},
getPhotoIndexUrl:function(hostName,_id,_modifyTime,_callback){
this.checkAlbumPassword(hostName,_id,'','fromblog',_modifyTime,_callback);
},
getUserSpaceWithSec:function(hostName,_callback){
Photo163.getUserSpaceWithSec(hostName,this.getVisitorName(),_callback).bind(this);
},
getPhotoFav:function(hostName,apUserName,albumId,photoId,callback){
this.getAlbum(apUserName,albumId,function(album){
this.getPhotoFavCb(hostName,apUserName,photoId,album,callback);
}.bind(this));
},
getPhotoFavCb:function(hostName,apUserName,photoId,album,callback){
this.getpurlOfAlbumFav(hostName,apUserName,album,function(retAlbum){
if(!retAlbum.purl){
callback({});
return;
}
LD.dynamicLoadJS(retAlbum.purl,function(){
var photoList=this.getPhotoListFromJS(retAlbum);
var photo=this.getPhotoFromList(photoList,photoId);
callback(data_map_util.getOldPhoto(photo,retAlbum));
}.bind(this),{type:1,albumId:retAlbum.id});
}.bind(this));
},
getpurlOfAlbumFav:function(hostName,apUserName,album,_callback){
Photo163.getAlbumData4Fav(hostName,this.getVisitorName(),album.id,apUserName,function(purl){
if(purl){
album.purl="http://"+purl;
}
_callback(album);
});
}
}
var data_map_util={
completeURL:function(url,s){
if(url==null||url.indexOf("http")>=0){
return url;
}
var _tmp0=/^(.*?)\//,_tmp1='http://img$1.'+(s==3?'ph':'bimg')+'.126.net/';
if(url){
return url.replace(_tmp0,_tmp1);
}
},
setWidthAndHeight:function(originWidth,originHeight,width,height){
if(originWidth<=width&&originHeight<=height){
return[originWidth,originHeight];
}
if((originWidth/width)>=(originHeight/height)){
return[width,Math.floor(originHeight*width/originWidth)];
}else{
return[Math.floor(originWidth*height/originHeight),height];
}
},
setMediumWidthAndHeight:function(originWidth,originHeight){
var width=600.0,height=750.0;
return this.setWidthAndHeight(originWidth,originHeight,width,height);
},
setSmallWidthAndHeight:function(originWidth,originHeight){
var width=240.0,height=240.0;
return this.setWidthAndHeight(originWidth,originHeight,width,height);
},
getOldPhoto:function(photo,album){
var oldPhoto={};
if(!!photo){
var size=this.setMediumWidthAndHeight(photo.ow,photo.oh);
var smallSize=this.setSmallWidthAndHeight(photo.ow,photo.oh);
oldPhoto.id=photo.id;
oldPhoto.mediumUrl=this.completeURL(photo.murl,photo.s);
oldPhoto.smallWidth=smallSize[0];
oldPhoto.smallHeight=smallSize[1];
oldPhoto.mediumWidth=size[0];
oldPhoto.mediumHeight=size[1];
oldPhoto.originWidth=photo.ow;
oldPhoto.originHeight=photo.oh;
oldPhoto.smallUrl=this.completeURL(photo.surl,photo.s);
oldPhoto.url=this.completeURL(photo.ourl,photo.s);
oldPhoto.squareUrl=this.completeURL(photo.qurl,photo.s);
oldPhoto.timeStamp=photo.t;
oldPhoto.createTime=photo.t;
oldPhoto.photoName=photo.desc;
oldPhoto.description=photo.desc;
oldPhoto.commentCount=photo.comnum;
if(!!photo.comm){
oldPhoto.comm="http://"+photo.comm;
}else{
oldPhoto.comm='';
}
oldPhoto.tag=photo.kw;
oldPhoto.storeType=photo.s;
}
if(!!album){
oldPhoto.albumId=album.id;
oldPhoto.albumName=album.albumName;
oldPhoto.albumCount=1;
oldPhoto.hasPassword=album.hasPassword;
oldPhoto.au=album.au;
oldPhoto.privacy=g_album_controller.privacyMap[album.au];
}
return oldPhoto;
},
getOldPhotos:function(photoList,album){
var oldPhotoList=[];
photoList.each(function(item){
oldPhotoList.push(data_map_util.getOldPhoto(item,album));
});
return oldPhotoList;
},
getOldAlbum:function(album){
var oldAlbum={};
if(!!album){
oldAlbum.id=album.id;
oldAlbum.albumName=album.name;
oldAlbum.albumDescription=album.desc;
oldAlbum.friendPhotoCount=album.count;
oldAlbum.pwdFriendPhotoCount=album.count;
oldAlbum.guestPhotoCount=album.count;
oldAlbum.pwdGuestPhotoCount=album.count;
oldAlbum.au=album.au;
if(!!album.purl){
oldAlbum.purl="http://"+album.purl;
}else{
oldAlbum.purl='';
}
if(!!album.comm){
oldAlbum.comm="http://"+album.comm;
}else{
oldAlbum.comm='';
}
oldAlbum.photoCount=album.count;
oldAlbum.seqType=album.st;
oldAlbum.coverPhUrl=this.completeURL(album.surl,album.s);
oldAlbum.hasPassword=(album.au==1?1:0);
oldAlbum.checkPassword=(album.au==1?0:1);
oldAlbum.createTime=album.t;
oldAlbum.modifyTime=album.dmt;
if(!!album.comnum){
oldAlbum.commentCount=album.comnum;
}else{
oldAlbum.commentCount=0;
}
oldAlbum.album=album;
oldAlbum.rankStr=this.getRankString(album.au);
}
return oldAlbum;
},
getOldAlbums:function(albumList){
var oldAlbumList=[];
if(albumList!=null){
for(var i=0;i<albumList.length;i++){
oldAlbumList.push(data_map_util.getOldAlbum(albumList[i]));
}
}
return oldAlbumList;
},
getAlbumString:function(album){
var t=[];
t.push(album.id);
t.push(album.photoCount);
t.push('['+album.albumName+']');
t.push(album.au);
return t.join('&!&')+'&!&#';
},
getAlbumListString:function(albumList){
var tList=[];
if(albumList!=null){
albumList.each(function(item){
tList.push(data_map_util.getAlbumString(item));
});
}
return tList.join('&!&');
},
getOldComm:function(comm){
var oldComm={};
if(!!comm){
oldComm.id=comm.id;
if(!!comm.con)
oldComm.content=comm.con.replace(/\r\n/g,'<br>');
oldComm.publishTime=comm.t;
oldComm.publisherName=comm.runame;
if(!comm.rnname){
oldComm.publisherNickname=comm.runame;
}else{
oldComm.publisherNickname=comm.rnname;
}
if(!comm.rav){
oldComm.publisherAvatar="http://b.bst.126.net/style/common/user_default.gif";
}else{
oldComm.publisherAvatar=comm.rav;
}
oldComm.publisherAvatarUrl=oldComm.publisherAvatar;
oldComm.rtype=comm.rtype;
if(!comm.ip){
oldComm.ip="";
}else{
oldComm.ip=comm.ip;
}
if(!comm.ipname){
oldComm.ipName="";
}else{
oldComm.ipName=comm.ipname;
}
if(!!comm.dataex){
var dataExs=comm.dataex.split(';')||[];
if(dataExs.length>=2){
oldComm.CircleName=dataExs[0];
oldComm.CircleUrlName=dataExs[1];
}
}
oldComm.valcode=comm.valcode===false?false:true;
}
return oldComm;
},
getOldComms:function(comms){
var oldComms=[];
comms.each(function(item){
oldComms.push(data_map_util.getOldComm(item));
});
return oldComms;
},
getRankString:function(au){
switch(au){
case 0:return"公开";
case 1:return"加密";
case 2:return"私密";
case 4:return"博友可见";
default:return"未知";
}
},
getCookie:function(c_name){
if(document.cookie.length>0){
c_start=document.cookie.indexOf(c_name+"=");
if(c_start!=-1){
c_start=c_start+c_name.length+1;
c_end=document.cookie.indexOf(";",c_start);
if(c_end==-1)
c_end=document.cookie.length;
return unescape(document.cookie.substring(c_start,c_end));
}
}
return"";
}
}
var LD={
count:0,
pool:{},
urls:{},
dynamicLoadJS:function(_url,_callback,errArg){
if(!_url){
_callback();
return;
}
if(this.urls[_url]==null){
if(this.pool[_url]!=null){
this.pool[_url].callbacks.push(_callback);
return;
}
var _script=document.createElement('script');
_script.type='text/javascript';
_script.charset='gbk';
isIE?_script.onreadystatechange=this.dynamicLoadJS_StateChange.bind(this,_url,_callback,errArg)
:_script.onload=this.dynamicLoadJS_Callback.bind(this,_url);
_script.onerror=function(){
this.pool[_url]=null;
if(errArg!=null){
this.reloadData(errArg,_callback);
}else{
_callback();
}
}.bind(this);
this.pool[_url]={script:_script,callbacks:[_callback]};
if(_url!=''){
_script.src=_url;
}
document.getElementsByTagName('head')[0].appendChild(_script);
}else{
_callback();
}
},
dynamicLoadJS_StateChange:function(_url,_callback,errArg){
var _obj=this.pool[_url],
_state=_obj.script.readyState;
if(_state=='loaded'||_state=='complete'){
if(errArg!=null&&this.is404Response(errArg)){
this.pool[_url]=null;
this.reloadData(errArg,_callback);
}else{
setTimeout(function(){LD.dynamicLoadJS_Callback(_url);},0);
}
}
},
dynamicLoadJS_Callback:function(_url){
var _obj=this.pool[_url];
this.urls[_url]=1;
_obj.callbacks.each(function(callback){
try{
callback();
}catch(ex){}
});
},
is404Response:function(errArg){
switch(errArg.type){
case 1:
return typeof window['g_p$'+errArg.albumId+'d']=='undefined'?true:false;
case 2:
return typeof window['g_ac$'+errArg.albumId+'d']=='undefined'?true:false;
case 3:
return typeof window['g_pc$'+errArg.photoId+'d']=='undefined'?true:false;
default:return false;
}
},
reloadData:function(errArg,_callback){
switch(errArg.type){
case 1:
Photo163.reloadAlbumData(hostName,g_album_controller.getVisitorName(),errArg.albumId,function(url){
LD.dynamicLoadJS("http://"+url,_callback);
});
break;
case 2:
Photo163.reloadCommentsInAlbum(hostName,g_album_controller.getVisitorName(),errArg.albumId,g_album_controller.userSpaces[hostName].userId,function(album){
LD.dynamicLoadJS("http://"+album.comm,_callback);
});
break;
case 3:
Photo163.reloadCommentsInPhoto(hostName,g_album_controller.getVisitorName(),errArg.albumId,errArg.photoId,g_album_controller.userSpaces[hostName].userId,function(photo){
LD.dynamicLoadJS("http://"+photo.comm,_callback);
});
break;
default:_callback();
}
}
};
var isHomepage;
var hostName;
var photoModuleUrl;
var albumModuleId=4;
try{
if(!!initParas){
var paras=initParas[albumModuleId][initParas[albumModuleId].length-1];
isHomepage=paras.isHomepage;
hostName=paras.hostName;
photoModuleUrl=paras.newPhotoModuleUrl;
}else{
isHomepage=false;
}
}catch(ex){
isHomepage=false;
}
var isIE;
if(!isIE){
isIE=(navigator.appVersion.indexOf("MSIE")!=-1)?true:false;
}
initNewPhotoModule(hostName);
function initNewPhotoModule(hostName){
if(isHomepage&&typeof UD!='undefined'&&UD.migStat==3){
g_album_controller.getAlbums(hostName,function(albumList){
if(albumList==null||albumList.length==0){
initAlbumListPage([]);
initEBDPlayer(null);
}
var album,albums=[];
if(UD.hostId==UD.visitorId){
albums=albumList;
album=albums.find(function(item){
if(item.photoCount>0){
return true;
}
});
}else{
albumList.each(function(album){
if((album.au==4&&UD.visitorRank>=100)||album.au==0){
albums.push(album);
}
});
album=albums.find(function(item){
if(item.photoCount>0&&item.au==0){
return true;
}
});
}
if(typeof album=='undefined'||album==null){
initAlbumListPage([]);
initEBDPlayer(null);
return;
}
g_album_controller.getPhotosInAlbumCb(hostName,album,50,0,function(photoList){
UD.photos=photoList;
initAlbumListPage(albums);
initEBDPlayer(album.id);
});
});
}
}
if(NECtrl==undefined){
var NECtrl={};
}
NECtrl.AdvancedEditor=Class.create();
NECtrl.AdvancedEditor.MenuCommand=function(iState,iType,oTarget){
this.state=iState;
this.type=iType;
this.target=oTarget;
}
NECtrl.AdvancedEditor.commands=[
'FontName','FontSize',
'ForeColor','BackColor','Portrait',
'Bold','Italic','Underline','JustifyLeft','JustifyCenter','JustifyRight','InsertOrderedList','InsertUnorderedList',
'Indent','Outdent','Link','Image','Media','Table','Paragraph','Line','ClearFormat',
'Copy','Paste','Cut',
'ShowCode'];
NECtrl.AdvancedEditor.commandsType=[3,3,2,2,2,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,-1,-1,-1,0];
NECtrl.AdvancedEditor.prototype={
initialize:function(sParentId,sEditorDivId){
this.options=Object.extend({
sEditorSrc:"/blankEditor.html",
bSimpleEditor:false,
iWidth:0,
iHeight:350,
iMaxLen:65535,
sObjName:null,
fnAfterLoad:null,
oAfterLoadParams:null,
fnPreview:null,
fnHideDiv:null,
oHideDivParmas:null,
iDeltaHeight:30,
oToolbarArray:null,
bFriend:true,
bHome:false,
sInitContent:null,
sTitle:null,
sEditorHint:'在这里开始书写日记、心情 …',
sTitleHint:'在这里添加日志标题',
bBig:false,
fnSetPref:null,
fnGetPortraitPref:null,
fnSetPortraitPref:null,
bNewCommentEditor:false,
fnOnCommentFocus:null,
fnAfterPortraitClick:null,
bFeelingEditor:false
},arguments[2]||{});
this.objectName=this.options.sObjName;
this.oToolbarArray=this.options.oToolbarArray;
this.parentId=sParentId;
this.containerId=sEditorDivId;
this.editorHint=this.options.sEditorHint;
this.titleHint=this.options.sTitleHint;
this.designEditor=null;
this.designEditorDoc=null;
this.sourceEditor=null;
this.smallForeColor=null;
this.bigForeColor=null;
this.bigBackColor=null;
this.smallPortrait=null;
this.insertAnything=null;
this.bigPortrait=null;
this.oFrame=null;
this.oFrameBody=null;
this.allToolbar={};
this.textToolbar={};
this.popMenuToolbar={};
this.copyPasteToolbar={};
this.oTitle=null;
this.currMode="Design";
this.iFrameHeight=this.options.iHeight;
this.isIE;
this.bDisabled=false;
this.ranges=null;
this.onSetting=false;
this.onInserting=false;
this.bBigEditor=this.options.bBig;
this.cloneNode=null;
this.body=document.body;
this.init();
},
init:function(){
if(document.all)this.isIE=true;else this.isIE=false;
if(typeof UD!='undefined'&&typeof UD.body!='undefined'){
this.body=UD.body;
}
this._getToolbar();
var _oData={editorId:this.parentId,objName:this.options.sObjName,
height:this.options.iHeight+220,bFriend:this.options.bFriend};
var _sResult;
if(this.options.bSimpleEditor){
if(this.options.bNewCommentEditor){
$(this.containerId).innerHTML=jst_global_simple_notoolbar_editor.processUseCache(_oData);
}else{
$(this.containerId).innerHTML=jst_global_simple_editor.processUseCache(_oData);
}
this.smallPortrait=new NECtrl.Portrait(this.parentId+"smallPortrait",this,{bNav:false,sObjName:this.options.sObjName+".smallPortrait",fnAfterPortraitClick:this.options.fnAfterPortraitClick,fnGetPref:this.options.fnGetPortraitPref,fnSetPref:this.options.fnSetPortraitPref});
}else{
$(this.containerId).innerHTML=jst_global_advanced_editor.processUseCache(_oData);
if(this.bBigEditor){
this.bigForeColor=new NECtrl.ColorPanel(this.parentId+"bigForeColor",this,this.options.sObjName+".bigForeColor");
this.bigBackColor=new NECtrl.ColorPanel(this.parentId+"bigBackColor",this,this.options.sObjName+".bigBackColor");
this.bigPortrait=new NECtrl.Portrait(this.parentId+"bigPortrait",this,{bNav:true,sObjName:this.options.sObjName+".bigPortrait",fnGetPref:this.options.fnGetPortraitPref,fnSetPref:this.options.fnSetPortraitPref});
var _oBig=$("big_toolbar"+this.parentId);
_oBig.innerHTML=jst_global_advanced_editor_bigToolbar.processUseCache(_oData);
_oBig.style.display="block";
}else{
this.smallForeColor=new NECtrl.ColorPanel(this.parentId+"smallForeColor",this,this.options.sObjName+".smallForeColor");
this.smallPortrait=new NECtrl.Portrait(this.parentId+"smallPortrait",this,{bNav:true,sObjName:this.options.sObjName+".smallPortrait",fnGetPref:this.options.fnGetPortraitPref,fnSetPref:this.options.fnSetPortraitPref});
var _oSmall=$("small_toolbar"+this.parentId);
_oSmall.innerHTML=jst_global_advanced_editor_smallToolbar.processUseCache(_oData);
_oSmall.style.display="block";
}
}
this.insertAnything=new NECtrl.InsertAnything(this.parentId,this,{sObjName:this.options.sObjName+".insertAnything"});
var _oHtmlDiv=$("designEditorDiv"+this.parentId);
var _iWidth=this.options.iWidth;
if(_iWidth==0){
if(_oHtmlDiv.offsetWidth>2)
_iWidth=_oHtmlDiv.offsetWidth;
}
var _sIFrame=this.isIE?"<iframe></iframe>":"iframe";
var _oIframeObj=document.createElement(_sIFrame);
_oIframeObj.setAttribute("id","designEditor"+this.parentId);
if(this.options.bSimpleEditor){
_oIframeObj.setAttribute("width",_iWidth);
if(_iWidth!=0)
$("editorWrap"+this.parentId).style.width=_iWidth+"px";
}else{
_oIframeObj.setAttribute("width",726);
}
_oIframeObj.height=this.options.iHeight+'px';
_oIframeObj.setAttribute("name","designEditor"+this.parentId);
_oIframeObj.setAttribute("frameBorder",0);
var hash="";
if(document.domain=='163.com'){
hash="#topdomain";
}
_oIframeObj.setAttribute("src",this.options.sEditorSrc+hash);
_oIframeObj.setAttribute("designMode","on");
_oHtmlDiv.appendChild(_oIframeObj);
if(!this.options.bSimpleEditor){
this.sourceEditor=$("sourceEditor"+this.parentId);
this.sourceEditor.style.width=$("editorDiv"+this.parentId).offsetWidth-6+"px";
}
if(this.isIE){
_oIframeObj.attachEvent("onload",function(){
if(!this.options.bSimpleEditor){
event.srcElement.contentWindow.document.body.contentEditable=true;
}else if(!!hash){
event.srcElement.contentWindow.document.body.contentEditable=true;
this._fnEditorMouseOvr=this._setFrameBodyMouseOver.bind(this);
}else{
if(event.srcElement.contentWindow.document.designMode!='On'){
event.srcElement.contentWindow.document.designMode="On";
return;
}
this._fnEditorMouseOvr=this._setFrameBodyMouseOver.bind(this);
}
this._afterLoad();
}.bind(this));
}else{
var _oThis=this;
_oIframeObj.addEventListener("load",function(){
this.contentWindow.onfocus=function(){
this.document.designMode="on";
}
_oThis._afterLoad();
},false);
}
},
_afterLoad:function(){
this.oFrame=$("designEditor"+this.parentId);
this.designEditor=this.oFrame.contentWindow;
this.designEditorDoc=this.designEditor.document;
this.oFrameBody=this.designEditorDoc.body;
if(this.isIE){
Event.observe(this.designEditorDoc,"selectionchange",this.onEditContentSelChange.bind(this));
}else{
Event.observe(this.designEditorDoc,"keydown",this.onEditorContentKeyDown.bind(this));
}
Event.observe(this.designEditorDoc,"click",this.onEditorClick.bind(this));
Event.observe(window.document.body,'click',this.onWindowClick.bindAsEventListener(this));
this._registerToolbar();
if(!this.options.bSimpleEditor){
Event.observe(this.designEditor,"focus",this.onEditorFocus.bind(this));
if(this.isIE){
Event.observe(this.designEditorDoc.body,"beforedeactivate",this.onEditorBlur.bind(this));
}else{
Event.observe(this.designEditorDoc,"blur",this.onEditorBlur.bind(this));
}
this.oTitle=$("title"+this.parentId);
if(this.options.sTitle&&this.options.sTitle!='')
this.oTitle.value=this.options.sTitle;
else
this.oTitle.value=this.titleHint;
Event.observe(this.oTitle,"click",this.onTitleClick.bind(this));
Event.observe(this.oTitle,"blur",this.onTitleBlur.bind(this));
Event.observe(this.oTitle,"keypress",this.onTitleKeypress.bindAsEventListener(this));
if(this.options.sInitContent&&this.options.sInitContent!=''){
this.oFrameBody.innerHTML=this.options.sInitContent;
}else{
this.oFrameBody.innerHTML=this.editorHint;
}
if(this.isIE){
this._oSubEditor=document.createElement("iframe");
this._oSubEditor.style.cssText="height:1px;width:1px;overflow:hidden;visibility:hidden";
this.body.appendChild(this._oSubEditor);
this.designEditorDoc.body.attachEvent("onpaste",function(){
var _oSubDoc=this._oSubEditor.contentWindow.document.body;
_oSubDoc.innerHTML="";
_oSubDoc.createTextRange().execCommand("Paste");
var _htmlData=_oSubDoc.innerHTML;
if(this._checkIfHTMLTxt(_htmlData)){
if(confirm('你粘贴的内容中含html或其他不便于你阅读  \r\n\r\n和编辑的格式，是否清除原来的格式！ ')){
var _source=this._clearAllFormat(_htmlData);
this.insertHTML(_source);
return false;
}
}
}.bind(this));
}
}else{
this.oFrameBody.style.fontSize="12px";
if(this.isIE&&!this.options.bFeelingEditor){
this.designEditorDoc.attachEvent('onmouseover',this._fnEditorMouseOvr);
}
if(this.options.fnOnCommentFocus!=null){
Event.observe(this.designEditor,"focus",this.options.fnOnCommentFocus);
}
if(this.options.bFeelingEditor||!this.isIE){
this.designEditor.focus();
}
}
if(this.options.fnAfterLoad!=null){
this.options.fnAfterLoad(this.options.oAfterLoadParams);
}
},
_setFrameBodyMouseOver:function(){
if(!this._oBodyOvered){
this.designEditor.focus();
this._oBodyOvered=true;
}else{
this.oFrame.detachEvent("onmouseover",this._fnEditorMouseOvr);
}
},
_getToolbar:function(){
if(this.oToolbarArray==null){
this.oToolbarArray=[];
for(var i=0;i<17;i++)
this.oToolbarArray[i]=1;
if(!this.options.bSimpleEditor){
this.oToolbarArray[0]=0;
this.oToolbarArray[3]=0;
this.oToolbarArray[8]=0;
this.oToolbarArray[9]=0;
this.oToolbarArray[10]=0;
this.oToolbarArray[11]=0;
this.oToolbarArray[12]=0;
this.oToolbarArray[13]=0;
this.oToolbarArray[14]=0;
}else{
this.oToolbarArray[0]=0;
this.oToolbarArray[1]=0;
this.oToolbarArray[3]=0;
this.oToolbarArray[8]=0;
this.oToolbarArray[9]=0;
this.oToolbarArray[10]=0;
this.oToolbarArray[11]=0;
this.oToolbarArray[12]=0;
this.oToolbarArray[13]=0;
this.oToolbarArray[14]=0;
this.oToolbarArray[16]=0;
if(!this.options.bFriend){
this.oToolbarArray[2]=0;
this.oToolbarArray[15]=0;
}
}
}
},
_registerToolbar:function(){
if(this.bBigEditor==true){
this.allToolbar={};
this.textToolbar={};
this.popMenuToolbar={};
this.copyPasteToolbar={};
for(var i=NECtrl.AdvancedEditor.commands.length-1;i>=0;i--){
var name=NECtrl.AdvancedEditor.commands[i];
var type=NECtrl.AdvancedEditor.commandsType[i];
var oTarget=$(name+"Btn"+this.parentId);
if(oTarget==null)
continue;
var oCommand=new NECtrl.AdvancedEditor.MenuCommand(0,type,oTarget);
if(type==-1&&!this.isIE){
oCommand.state=-1;
this.changeCss(name,oTarget,-1);
}else{
this.allToolbar[name]=oCommand;
oTarget.onmouseover=this.onMenuIconOver.bind(this,name);
oTarget.onmouseout=this.onMenuIconOut.bind(this,name);
if(name!='Image'){
oTarget.onmousedown=this.onMenuIconDown.bind(this,name);
oTarget.onmouseup=this.onMenuIconUp.bind(this,name);
oTarget.onclick=this.onMenuIconClick.bindAsEventListener(this);
if(type==1||type==3){
this.textToolbar[name]=oCommand;
}
if(type>=2){
this.popMenuToolbar[name]=oCommand;
}else if(type==-1&&this.isIE){
this.copyPasteToolbar[name]=oCommand;
}
}
}
}
}else{
this.allToolbar={};
this.textToolbar={};
this.popMenuToolbar={};
for(var i=this.oToolbarArray.length-1;i>=0;i--){
if(this.oToolbarArray[i]==1){
var name=NECtrl.AdvancedEditor.commands[i];
var type=NECtrl.AdvancedEditor.commandsType[i];
var oTarget=$(name+"Btn_s"+this.parentId);
if(oTarget==null)
continue;
var oCommand=new NECtrl.AdvancedEditor.MenuCommand(0,type,oTarget);
this.allToolbar[name]=oCommand;
oTarget.onmouseover=this.onMenuIconOver.bind(this,name);
oTarget.onmouseout=this.onMenuIconOut.bind(this,name);
if(name!='Image'){
oTarget.onmousedown=this.onMenuIconDown.bind(this,name);
oTarget.onmouseup=this.onMenuIconUp.bind(this,name);
oTarget.onclick=this.onMenuIconClick.bindAsEventListener(this);
if(type==1||type==3){
this.textToolbar[name]=oCommand;
}
if(type>=2){
this.popMenuToolbar[name]=oCommand;
}
}
}
}
}
},
onTitleClick:function(){
if(this.oTitle.value==this.titleHint)
this.oTitle.value="";
if(this.bBigEditor){
$("toolbarCover"+this.parentId).style.width="80%";
$("toolbarCover"+this.parentId).style.display="block";
$("func"+this.parentId).style.display="none";
}else{
$("toolbarCover_s"+this.parentId).style.display="block";
$("func_s"+this.parentId).style.display="none";
}
},
onTitleBlur:function(){
if(this.oTitle.value==""){
this.oTitle.value=this.titleHint;
}
if(this.bBigEditor){
$("toolbarCover"+this.parentId).style.display="none";
$("func"+this.parentId).style.display="inline";
}else{
$("toolbarCover_s"+this.parentId).style.display="none";
$("func_s"+this.parentId).style.display="inline";
}
},
onTitleKeypress:function(event){
if(event.keyCode==13){
this.designEditor.focus();
Event.stop(event);
return false;
}
},
onEditorBlur:function(){
if(!this.bDisabled){
if(this.isIE&&!this.onInserting)
this.ranges=this.designEditorDoc.selection.createRange();
if(this.oFrameBody.innerHTML==""&&!this.options.bSimpleEditor){
this.oFrameBody.innerHTML=this.editorHint;
}
}
},
onMenuIconOver:function(sName){
if(!this.bDisabled||sName=="ShowCode"){
var oCommand=this.allToolbar[sName];
if(oCommand.state>=0)
this.changeCss(sName,oCommand.target,1);
}
},
onMenuIconOut:function(sName){
if(!this.bDisabled||sName=="ShowCode"){
var oCommand=this.allToolbar[sName];
switch(oCommand.state){
case 2:
this.changeCss(sName,oCommand.target,0);
oCommand.state=0;
break;
case 3:
this.changeCss(sName,oCommand.target,3);
break;
case 4:
this.changeCss(sName,oCommand.target,4);
break;
case 0:
this.changeCss(sName,oCommand.target,0);
break;
}
}
},
onMenuIconDown:function(sName){
if(sName=="ShowCode"){
this.switchEditor();
return;
}
var oCommand=this.allToolbar[sName];
if(!this.bDisabled&&oCommand.state>=0){
this.onSetting=true;
this._setAllIcons(sName);
this.onSetting=false;
this.syncTextToolbar();
}
},
onMenuIconUp:function(sName){
if(!this.bDisabled||sName=="ShowCode"){
var oCommand=this.allToolbar[sName];
if(oCommand.state>0){
if(oCommand.state>=3){
this.changeCss(sName,oCommand.target,3);
}else if(oCommand.state>=0){
this.changeCss(sName,oCommand.target,1);
}
if(!(/^(FontSize|FontName|Link|Table|Media|ClearFormat|Image)$/.test(sName))){
this.designEditor.focus();
}
}
}
},
onMenuIconClick:function(event){
if(!this.bDisabled){
Event.stop(event);
}
},
onEditorClick:function(){
if(!this.bDisabled){
this.hiddenAllMenu();
if(this.isIE&&this.bBigEditor&&!this.options.bSimpleEditor)
this.syncCopyPaste();
if(this.isIE){
if(this.designEditorDoc.selection.type.toLowerCase()=="text")
this.syncTextToolbar();
}else{
this.syncTextToolbar();
}
}
if(this.options.fnHideDiv!=null){
this.options.fnHideDiv(this.options.oHideDivParmas);
}
},
onEditorFocus:function(){
if(this.editorHint==this.oFrameBody.innerHTML){
this.oFrameBody.innerHTML="";
}
},
onWindowClick:function(event){
if(!this.bDisabled){
this.hiddenAllMenu();
}
},
onEditorContentKeyDown:function(){
if(!this.bDisabled){
this.syncTextToolbar();
}
},
onEditContentSelChange:function(){
if(!this.bDisabled&&!this.onSetting){
if(this.designEditorDoc.selection.type.toLowerCase()=="text"){
this.syncTextToolbar();
if(this.bBigEditor&&!this.options.bSimpleEditor){
this.syncCopyPaste();
}
}
}
},
_setAllIcons:function(sCurrent){
for(name in this.allToolbar){
var oCommand=this.allToolbar[name];
switch(oCommand.state){
case 0:
if(name==sCurrent){
if(oCommand.type<=0){
this.changeCss(name,oCommand.target,5);
oCommand.state=2;
this.cmd(name);
}else if(oCommand.type==1){
this.changeCss(name,oCommand.target,5);
oCommand.state=3;
this.cmd(name);
}else if(oCommand.type>=2){
this.changeCss(name,oCommand.target,5);
oCommand.state=4;
this.openMenu(name);
}
}
break;
case 3:
if(name==sCurrent){
this.changeCss(name,oCommand.target,5);
oCommand.state=0;
this.cmd(name);
}
break;
case 4:
this.changeCss(name,oCommand.target,0);
oCommand.state=0;
this.hiddenMenu(name);
break;
case 2:
if(name==sCurrent){
this.changeCss(name,oCommand.target,5);
this.cmd(name);
}
}
}
},
changeCss:function(sName,oTarget,iType){
switch(iType){
case 0:
oTarget.className="com";
break;
case 1:
oTarget.className="over";
break;
case 2:
case 3:
case 4:
oTarget.className="click";
break;
case 5:
oTarget.className="down";
break;
case-1:
oTarget.className="disb";
break;
}
},
syncTextToolbar:function(){
for(name in this.textToolbar){
var oCommand=this.textToolbar[name];
try{
switch(name){
case'FontName':
var value=this.designEditorDoc.queryCommandValue(name);
value=this._processFontName(value);
if(!this.bBigEditor)
$('FontNameValue_s'+this.parentId).innerHTML=value;
else
$('FontNameValue'+this.parentId).innerHTML=value;
break;
case'FontSize':
var value=this.designEditorDoc.queryCommandValue(name);
value=this._processFontSize(value);
if(!this.bBigEditor)
$('FontSizeValue_s'+this.parentId).innerHTML=value;
else
$('FontSizeValue'+this.parentId).innerHTML=value;
break;
default:
var value=this.designEditorDoc.queryCommandState(name);
if(value){
this.changeCss(name,oCommand.target,3);
oCommand.state=3;
}else{
this.changeCss(name,oCommand.target,0);
oCommand.state=0;
}
}
}catch(e){}
}
},
syncCopyPaste:function(){
for(name in this.copyPasteToolbar){
try{
var oCommand=this.copyPasteToolbar[name];
if(name=='Copy')
name='Cut';
if(this.designEditorDoc.queryCommandEnabled(name)){
this.changeCss(name,oCommand.target,0);
oCommand.state=0;
}else{
this.changeCss(name,oCommand.target,-1);
oCommand.state=-1;
}
}catch(e){}
}
},
showMenu:function(sMenuElem,iAdjustLeft,iAdjustTop){
if(iAdjustTop==undefined){
sMenuElem.style.top=27+"px";
}else{
sMenuElem.style.top=27+iAdjustTop+"px";
}
if(iAdjustLeft==undefined){
sMenuElem.style.left=0+"px";
}else{
sMenuElem.style.left=0+iAdjustLeft+"px";
}
sMenuElem.style.display="block";
},
setInserting:function(b){
if(b){
this.onInserting=true;
}else{
this.onInserting=false;
}
},
disableToolBar:function(bDisable){
if(bDisable){
if(!this.onSetting){
this.onSetting=true;
this.hiddenAllMenu();
for(name in this.allToolbar){
var oCommand=this.allToolbar[name];
if(name!="ShowCode"){
oCommand.state=0;
this.changeCss(name,oCommand.target,0);
}
}
this.onSetting=false;
this.bDisabled=true;
}
}else{
this.bDisabled=false;
}
},
initState:function(){
this.hiddenAllMenu();
for(name in this.allToolbar){
var oCommand=this.allToolbar[name];
oCommand.state=0;
this.changeCss(name,oCommand.target,0);
}
},
hiddenAllMenu:function(){
for(name in this.popMenuToolbar){
var oCommand=this.popMenuToolbar[name];
if(oCommand.state==4){
this.changeCss(name,oCommand.target,0);
oCommand.state=0;
this.hiddenMenu(name);
}
}
return false;
},
hiddenMenu:function(name){
var o;
if(!this.bBigEditor){
o=$(name+"Div_s"+this.parentId);
}else{
o=$(name+"Div"+this.parentId);
}
if(o!=null&&o.style.display!="none")
o.style.display="none";
if(this.options.bSimpleEditor&&o!=null){
this.body.removeChild(o);
}
},
openMenu:function(name){
var _oMemuElem;
if(!this.bBigEditor){
_oMemuElem=$(name+"Div_s"+this.parentId);
}else{
_oMemuElem=$(name+"Div"+this.parentId);
}
switch(name){
case"FontName":
case"FontSize":
this.showMenu(_oMemuElem,0,-4);
break;
case"Portrait":
if(this.options.bSimpleEditor){
_oMemuElem=this._createAndShowMenuDiv(name);
var _pos=Position.cumulativeOffset($(name+'Btn_s'+this.parentId));
this.showMenu(_oMemuElem,_pos[0]-1,_pos[1]);
this.smallPortrait.display(_oMemuElem);
}else{
this.showMenu(_oMemuElem,-140,0);
if(!this.bBigEditor)
this.smallPortrait.display(_oMemuElem);
else
this.bigPortrait.display(_oMemuElem);
}
break;
case"ForeColor":
if(this.options.bSimpleEditor){
_oMemuElem=this._createAndShowMenuDiv(name);
var _pos=Position.cumulativeOffset($(name+'Btn_s'+this.parentId));
this.showMenu(_oMemuElem,_pos[0],_pos[1]);
this.smallForeColor.display(_oMemuElem,name);
}else{
this.showMenu(_oMemuElem);
if(!this.bBigEditor)
this.smallForeColor.display(_oMemuElem,name);
else
this.bigForeColor.display(_oMemuElem,name);
}
break;
case"BackColor":
this.showMenu(_oMemuElem);
this.bigBackColor.display(_oMemuElem,name);
break;
}
},
_createAndShowMenuDiv:function(name){
var _oDiv=document.createElement('DIV');
_oDiv.id=name+'Div_s'+this.parentId;
_oDiv.style.cssText='position:absolute;border:none;z-index:10000;display:none;';
if(name=='Portrait')
_oDiv.className='edt_mgcf';
this.body.appendChild(_oDiv);
return _oDiv;
},
fixState:function(name){
var oCommand=this.allToolbar[name];
oCommand.state=0;
this.changeCss(name,oCommand.target,0);
},
cmd:function(sType){
switch(sType){
case"Link":
this._createLink();
break;
case"Media":
this._createMedia();
break;
case"Table":
this._createTable();
break;
case"Image":
this.addImg();
break;
case"Paragraph":
this._paraFormating();
break;
case"ClearFormat":
this._clearHTMLFormat();
break;
case"Line":
this.format("InsertHorizontalRule");
break;
case"JustifyLeft":
this._alignLeft();
break;
case"JustifyRight":
this._alignRight();
break;
case"JustifyCenter":
this._alignCenter();
break;
default:
this.format(sType);
}
},
format:function(sType,vPara,vLoseFocus){
this.designEditor.focus();
if(this.isIE&&vLoseFocus&&this.ranges){
this.ranges.select();
}
if(!vPara){
if(this.isIE){
this.designEditorDoc.execCommand(sType);
}else{
this.designEditorDoc.execCommand(sType,false,false);
}
}else{
this.designEditorDoc.execCommand(sType,false,vPara);
}
},
switchToolbar:function(){
this.onSetting=true;
this.hiddenAllMenu();
if(this.bBigEditor){
this.bBigEditor=false;
var oSmall=$("small_toolbar"+this.parentId);
if(oSmall.innerHTML==""){
var _oData={editorId:this.parentId,objName:this.options.sObjName};
oSmall.innerHTML=jst_global_advanced_editor_smallToolbar.processUseCache(_oData);
}
if(!this.smallForeColor)
this.smallForeColor=new NECtrl.ColorPanel(this.parentId+"smallForeColor",this,this.options.sObjName+".smallForeColor");
if(!this.smallPortrait)
this.smallPortrait=new NECtrl.Portrait(this.parentId+"smallPortrait",this,{bNav:true,sObjName:this.options.sObjName+".smallPortrait",fnGetPref:this.options.fnGetPortraitPref,fnSetPref:this.options.fnSetPortraitPref});
$("big_toolbar"+this.parentId).style.display="none";
oSmall.style.display="block";
this._registerToolbar();
this.onSetting=false;
this.designEditor.focus();
}else{
this.bBigEditor=true;
var oBig=$("big_toolbar"+this.parentId);
if(oBig.innerHTML==""){
var _oData={editorId:this.parentId,objName:this.options.sObjName};
oBig.innerHTML=jst_global_advanced_editor_bigToolbar.processUseCache(_oData);
}
if(!this.bigForeColor)
this.bigForeColor=new NECtrl.ColorPanel(this.parentId+"bigForeColor",this,this.options.sObjName+".bigForeColor");
if(!this.bigBackColor)
this.bigBackColor=new NECtrl.ColorPanel(this.parentId+"bigBackColor",this,this.options.sObjName+".bigBackColor");
if(!this.bigPortrait)
this.bigPortrait=new NECtrl.Portrait(this.parentId+"bigPortrait",this,{bNav:true,sObjName:this.options.sObjName+".bigPortrait",fnGetPref:this.options.fnGetPortraitPref,fnSetPref:this.options.fnSetPortraitPref});
$("small_toolbar"+this.parentId).style.display="none";
oBig.style.display="block";
this._registerToolbar();
this.onSetting=false;
this.designEditor.focus();
if(this.bBigEditor&&!this.options.bSimpleEditor)
this.syncCopyPaste();
}
if(this.options.fnSetPref){
this.options.fnSetPref(this.bBigEditor);
}
this.syncTextToolbar();
},
insertHTML:function(sHtml,vLoseFocus){
this.designEditor.focus();
if(this.isIE&&vLoseFocus&&this.ranges){
this.ranges.select();
}
this._beforeExecCommand();
if(this.isIE){
var rng=this.designEditorDoc.selection.createRange();
if(this.designEditorDoc.selection.type.toLowerCase()=="control"){
try{
var tg=this.designEditorDoc.body.createTextRange();
tg.moveToElementText(rng.item(0));
rng=tg;
}catch(e){}
}
rng.pasteHTML(sHtml);
}else{
this.designEditor.document.execCommand("inserthtml",null,sHtml);
}
},
_beforeExecCommand:function(){
if(this.oFrameBody.innerHTML==this.editorHint)
this.oFrameBody.innerHTML='';
},
switchEditor:function(){
var oCommand=this.allToolbar["ShowCode"];
if(this.currMode=="Design"){
this.disableToolBar(true);
$("toolbarCover"+this.parentId).style.width="536px";
$("toolbarCover"+this.parentId).style.display="block";
this.changeCss("ShowCode",oCommand.target,5);
oCommand.state=3;
if(this.oFrameBody.innerHTML!=this.editorHint)
this.sourceEditor.value=this.oFrameBody.innerHTML;
$("editorDiv"+this.parentId).style.display="none";
$("sourceDiv"+this.parentId).style.display="block";
if(this.bBigEditor){
$("func"+this.parentId).style.display="none";
}else{
$("func_s"+this.parentId).style.display="none";
}
this.currMode="Code";
oCommand.target.title="隐藏HTML代码";
this.sourceEditor.focus();
}else{
this.disableToolBar(false);
this.changeCss("ShowCode",oCommand.target,5);
oCommand.state=0;
try{
if(this.sourceEditor.value=="")
this.oFrameBody.innerHTML=this.editorHint;
else{
this.designEditorDoc.body.innerHTML=this._stripData(this.sourceEditor.value);;
}
}catch(e){}
$("editorDiv"+this.parentId).style.display="block";
$("sourceDiv"+this.parentId).style.display="none";
$("toolbarCover"+this.parentId).style.display="none";
if(this.bBigEditor){
$("func"+this.parentId).style.display="inline";
}else{
$("func_s"+this.parentId).style.display="inline";
}
this.currMode="Design";
oCommand.target.title="显示HTML代码";
this.designEditor.focus();
}
},
setFontName:function(sFontName){
this.hiddenAllMenu();
this.format('FontName',sFontName,true);
var value=this._processFontName(sFontName);
if(!this.bBigEditor){
$('FontNameValue_s'+this.parentId).innerHTML=value;
}else{
$('FontNameValue'+this.parentId).innerHTML=value;
}
},
setFontSize:function(sFontSize){
this.hiddenAllMenu();
this.format('FontSize',sFontSize,true);
var value=this._processFontSize(sFontSize);
if(!this.bBigEditor){
$('FontSizeValue_s'+this.parentId).innerHTML=value;
}else{
$('FontSizeValue'+this.parentId).innerHTML=value;
}
},
addImg:function(){
this.designEditor.focus();
window.open("uploadBlogPhoto.do","addPicWin","resizable=no,scrollbars=no,status=yes, width=785px, height=470px");
},
_createTable:function(){
this.designEditor.focus();
this.onInserting=true;
if(this.isIE)
this.ranges=this.designEditorDoc.selection.createRange();
this.insertAnything.showTable();
},
_createMedia:function(){
this.designEditor.focus();
this.onInserting=true;
if(this.isIE)
this.ranges=this.designEditorDoc.selection.createRange();
this.insertAnything.showMedia();
},
_getSelectNode:function(){
var elm;
if(isIE){
var rng=this.designEditorDoc.selection.createRange();
elm=rng.item?rng.item(0):rng.parentElement();
}else{
var sel=this.designEditor.getSelection();
var rng=null;
if(sel.rangeCount>0){
rng=sel.getRangeAt(0);
}else{
return;
}
elm=rng.commonAncestorContainer;
if(!rng.collapsed){
if(rng.startContainer==rng.endContainer){
if(rng.startOffset-rng.endOffset<2){
if(rng.startContainer.hasChildNodes())
elm=rng.startContainer.childNodes[rng.startOffset];
}
}
}
}
return elm;
},
_alignLeft:function(){
var e=this._getSelectNode();
if(e.tagName.toLowerCase()=="img"||e.tagName.toLowerCase()=="embed"){
e.style.display="";
e.style.textAlign="";
if(isIE)
e.style.styleFloat="left";
else
e.style.cssFloat="left";
}else{
this.format("JustifyLeft");
}
},
_alignRight:function(){
var e=this._getSelectNode();
if(e.tagName.toLowerCase()=="img"||e.tagName.toLowerCase()=="embed"){
e.style.display="";
e.style.textAlign="";
if(isIE)
e.style.styleFloat="right";
else
e.style.cssFloat="right";
}else{
this.format("JustifyRight");
}
},
_alignCenter:function(){
var e=this._getSelectNode();
if(e.tagName.toLowerCase()=="img"||e.tagName.toLowerCase()=="embed"){
if(isIE)
e.style.styleFloat="";
else
e.style.cssFloat="";
e.style.textAlign="center";
e.style.display="block";
}else{
this.format("JustifyCenter");
}
},
_createLink:function(){
this.designEditor.focus();
this.onInserting=true;
if(this.isIE){
this.ranges=this.designEditorDoc.selection.createRange();
var rng=this.designEditorDoc.selection.createRange();
var elm=rng.item?rng.item(0):rng.parentElement();
var p=elm;
while(p.tagName.toLowerCase()!='a'&&p.tagName.toLowerCase()!='body'){
p=p.parentNode;
}
if(p.tagName.toLowerCase()=='a'){
this.insertAnything.showLink(true,p);
}else{
if(rng.text==""){
this.insertAnything.showLink(false,null);
}else{
if(rng.item){
this.insertAnything.showLink(false,rng.item(0).outerHTML);
}else{
this.insertAnything.showLink(false,rng.htmlText);
}
}
}
}else{
var sel=this.designEditor.getSelection();
var rng=null;
if(sel.rangeCount>0){
rng=sel.getRangeAt(0);
}else{
return;
}
var elm=rng.commonAncestorContainer;
if(!rng.collapsed){
if(rng.startContainer==rng.endContainer){
if(rng.startOffset-rng.endOffset<2){
if(rng.startContainer.hasChildNodes())
elm=rng.startContainer.childNodes[rng.startOffset];
}
}
}
var p=elm;
while(p.nodeName.toLowerCase()!='a'&&p.nodeName.toLowerCase()!='body'){
p=p.parentNode;
}
if(p.nodeName.toLowerCase()=='a'){
this.insertAnything.showLink(true,p);
}else{
if(rng.collapsed){
this.insertAnything.showLink(false,null);
}else{
if(!this.cloneNode){
this.cloneNode=document.createElement("DIV");
this.cloneNode.style.cssText="display:none;";
this.body.appendChild(this.cloneNode);
}
this.cloneNode.innerHTML="";
this.cloneNode.appendChild(rng.cloneContents());
var value=this.cloneNode.innerHTML;
value=value.replace(/<a.*?>(.*?)<\/a[^>]*>/ig,"$1");
this.insertAnything.showLink(false,value);
}
}
}
},
_processFontSize:function(value){
if(value==null||value=="")
return"字号";
switch(value+""){
case"2":
return"小";
case"3":
return"标准";
case"4":
return"大";
case"5":
return"特大";
case"6":
return"极大";
default:
return"字号";
}
},
_processFontName:function(value){
if(value==null||value=="")
return"字体";
if(value=="楷体_GB2312")
return"楷体";
if(!this.isIE&&value.indexOf(",")!=-1){
var index=value.indexOf(",");
value=value.substring(0,index);
}
return value;
},
_doAfterGetContent:function(_sContent){
if(this.bHarm){
this.setData(_sContent);
}
if(isFirefox){
_sContent=this._fixFFLink(_sContent,"a","href");
}
this._saveDataForSubmit(_sContent);
return _sContent;
},
_fixFFLink:function(content,tag,attribute){
var _r=new RegExp('(<'+tag+'.*?'+attribute+'=")([^"]*)("[^>]*>)',"ig");
content=content.replace(_r,function($1,$2,$3,$4){
if($3.indexOf("http://")<0&&$3.indexOf("https://")<0&&$3.indexOf("mms://")<0&&$3.indexOf("rtsp://")<0&&$3.indexOf("mmst://")<0&&$3.indexOf("mailto:")<0&&$3.indexOf("mmsu://")<0&&$3.indexOf("ftp://")<0&&$3.indexOf("/")!=0){
return $2+"/"+$3+　$4;
}
return $1;
});
return content;
},
getPrevContent:function(){
var _sContent=this._getPrimitiveData();
var _sContent=this._stripData(_sContent);
return _sContent;
},
getTitle:function(){
if(this.oTitle){
if(this.oTitle.value==this.titleHint)
return"";
else
return this.oTitle.value;
}
return null;
},
setTitle:function(sTitle){
if(this.oTitle)
this.oTitle.value=sTitle;
},
_getPrimitiveData:function(){
var _sContent;
if(this.currMode=="Design"){
_sContent=this.oFrameBody.innerHTML;
}else{
_sContent=this.sourceEditor.value;
}
if(_sContent==this.editorHint)
_sContent='';
return _sContent;
},
_getReserveTag:function(){
return this.options.bSimpleEditor?[]:["embed","style"];
},
setData:function(sContent){
if(this.currMode=="Design"){
this.oFrameBody.innerHTML=sContent;
}else{
this.sourceEditor.value=sContent;
}
},
emptyContent:function(){
this.oFrameBody.innerHTML="";
},
_saveDataForSubmit:function(sContent){
try{
var oldContent=sContent;
if(this.sourceEditor.value=="")
this.oFrameBody.innerHTML=sContent;
else{
this.designEditorDoc.body.innerHTML=sContent;
}
sContent=this.oFrameBody.innerHTML;
}catch(e){}
$("HEContent"+this.parentId).value=sContent;
},
_exceedMaxLen:function(sContent){
var pureText=this.clearAllTag(sContent);
if(pureText.length>this.options.iMaxLen||sContent.length>this.options.iMaxLen*5){
return true;
}else
return false;
},
goPreview:function(){
var _htmlData=this.getPrevContent();
if(this.options.fnPreview!=null)
this.options.fnPreview(_htmlData);
},
focus:function(){
this.designEditor.focus();
},
setEditorWidth:function(iWidth){
this.oFrame.width=iWidth+"px";
$("editorWrap"+this.parentId).style.width=iWidth+"px";
},
clearAllTag:function(sContent){
return sContent.replace(/<\/?.*?>/ig,"");
},
_clearAllFormat:function(sTxt){
try{
var c=sTxt.replace(/\n/ig,"");
c=c.replace(/<script.*?>.*?<\/scrip[^>]*>/ig,"");
c=c.replace(/<[^>]*?javascript:[^>]*>/ig,"");
c=c.replace(/<style.*?>.*?<\/styl[^>]*>/ig,"");
c=c.replace(/<\/?(font|span|center|sohu|form|input|select|textarea|iframe|strong|b|EM|U|SUB|SUP)(\s[^>]*)?>/ig,"");
c=c.replace(/<\/?(div|code|h\d)[^>]*>/ig,'<br>');
c=c.replace(/<\?xml[^>]*>/ig,'');
c=c.replace(/<\!--.*?-->/ig,'');
c=c.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/ig,"<$1$3");
c=c.replace(/<(\w[^>]*) style="([^"]*)"([^>]*)/ig,"<$1$3");
c=c.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/ig,"<$1$3");
c=c.replace(/<\\?\?xml[^>]*>/ig,"");
c=c.replace(/<\/?\w+:[^>]*>/ig,"");
c=c.replace(/<img.*?src=([^ |>]*)[^>]*>/ig,"<img src=$1 border=0>");
c=c.replace(/<a.*?href="([^"]*)"[^>]*>/ig,"<a href=\"$1\">");
c="MM163brMM"+c;
c=c.replace(/<br>\s*<br>/ig,'MM163brMM');
c=c.replace(/<center>\s*<center>/ig,'<center>');
c=c.replace(/<\/center>\s*<\/center>/ig,'</center>');
c=c.replace(/<center>/ig,'MM163brMM<center>');
c=c.replace(/<\/center>/ig,'</center>MM163brMM');
c=c.replace(/<br>/ig,'MM163brMM');
c=c.replace(/<p[^>]*>/ig,'MM163brMM');
c=c.replace(/<\/p[^>]*>/ig,'');
c=c.replace(/(\r|\n)/ig,'');
c=c.replace(/MM163brMM\s*MM163brMM/ig,'MM163brMM');
c=c.replace(/MM163brMM/ig,'</P><P style="TEXT-INDENT: 2em">');
c=c.replace("</P>","");
return c;
}catch(e){}
},
_clearHTMLFormat:function(){
if(confirm('"清除格式"将修改文章的格式,确定清除? ')){
var bSelected=true;
if(this.isIE){
var rng=this.designEditorDoc.selection.createRange();
if(rng.text=="")
bSelected=false;
}else{
var rng=this.designEditor.getSelection().getRangeAt(0);
if(rng.collapsed)
bSelected=false;
}
if(bSelected){
this.format("removeformat");
}else{
var _sValue=this.oFrameBody.innerHTML;
try{
this.oFrameBody.innerHTML=this._clearAllFormat(_sValue);
}catch(e){}
}
}
return;
},
_checkIfHTMLTxt:function(sTxt){
var r=/<\/?(span|div|h2|h3|code|center|form|input|select|textarea|iframe|img|a).*?>/ig;
if(r.test(sTxt))
return true;
else
return false;
},
_paraFormating:function(){
var _sValue=this.oFrameBody.innerHTML;
var _reg=/<P>(.*)<\/P>/g;
var _sResult=_sValue.replace(_reg,'<P style="TEXT-INDENT: 2em">$1</P>');
this.oFrameBody.innerHTML=_sResult;
return;
}
}
Object.extend(NECtrl.AdvancedEditor.prototype,NECtrl.AbstractEditor.prototype);
if(NECtrl==undefined){
var NECtrl={};
}
NECtrl.ColorPanel=Class.create();
NECtrl.ColorPanel._ColorHex=['00','33','66','99','CC','FF'];
NECtrl.ColorPanel._SpColorHex=['FF0000','00FF00','0000FF','FFFF00','00FFFF','FF00FF'];
NECtrl.ColorPanel._picSrc=Const.STDomain+"/style/common/htmlEditor/place.gif";
NECtrl.ColorPanel.prototype={
initialize:function(sParentId,oHtmlEditor,sObjName){
this._sParentId=sParentId;
this._oHtmlEditor=oHtmlEditor;
this._sObjName=sObjName;
this._oCurrentColor=null;
this.simpleHTML=null;
this.fullHTML=null;
if(document.all)this.isIE=true;else this.isIE=false;
},
display:function(oColorDiv,sColorType){
this._displaySimpleColorBoard(oColorDiv,sColorType);
},
colorTxtOvr:function(event){
var e=Event.element(event);
e.style.border="1px #000080 solid";
e.style.backgroundColor="#FFEEC2";
},
colorTxtOut:function(event){
var e=Event.element(event);
e.style.border="1px white solid";
e.style.backgroundColor="white";
},
_drawSimpleColorPanel:function(){
var a=[];
a.push('<div style="border:1px #9FAC87 solid; width:158px;background-color:white;">');
a.push('<div style="position:relative;margin-left:2px; margin-top:3px; margin-bottom:0px;height:19px">');
a.push('<img id="colorClear'+this._sParentId+'" src="'+Const.STDomain+'"/style/common/htmlEditor/simple_colr_remove.gif" style="width:150px;height:17px;background-color:white;border:1px solid #FFFFFF;cursor:pointer;" />');
a.push('<div id="colorPrez'+this._sParentId+'" style="position:absolute;top:3px;left:4px;border:1px solid #ACA899;font-size:1px;width:28px;height:11px;"> </div>');
a.push('</div>');
a.push('<div>');
a.push('<table class="g_c_clrpd" id="colorSelectPanel'+this._sParentId+'" cellspacing="6" cellpadding="0" style="border-collapse:separate;">');
a.push('<tr>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#000000; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="黑色"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#993300; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="褐色"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#333300; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="橄榄色"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#003300; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="深绿"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#003366; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="深青"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#000080; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="深蓝"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#333399; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="靛蓝"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#333333; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="灰色-80%"></img></td>');
a.push('</tr><tr>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#800000; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="深红"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#FF6600; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="橙色"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#808000; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="深黄"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#008000; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="绿色"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#008080; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="青色"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#0000FF; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="蓝色"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#666699; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="蓝-灰"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#808080; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="灰色-50%"></img></td>');
a.push('</tr><tr>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#FF0000; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="红色"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#FF9900; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="浅橙色"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#99CC00; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="酸橙色"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#339966; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="海绿"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#33CCCC; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="水绿色"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#3366FF; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="浅蓝"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#800080; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="紫罗兰"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#999999; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="灰色-40%"></img></td>');
a.push('</tr><tr>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#FF00FF; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="粉红"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#FFCC00; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="金色"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#FFFF00; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="黄色"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#00FF00; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="鲜绿"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#00FFFF; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="青绿"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#00CCFF; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="天蓝"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#993366; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="梅红"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#C0C0C0; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="灰色-25%"></img></td>');
a.push('</tr><tr>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#FF99CC; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="玫瑰红"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#FFCC99; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="茶色"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#FFFF99; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="浅黄"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#CCFFCC; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="浅绿"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#CCFFFF; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="浅青绿"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#99CCFF; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="淡蓝"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#CC99FF; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="淡紫"></img></td>');
a.push('<td><img src="'+NECtrl.ColorPanel._picSrc+'" style="background-color:#FFFFFF; border:1px solid #ACA899;font-size:1px;width:11px;height:11px; cursor:pointer" title="白色"></img></td>');
a.push('</tr>');
a.push('</table>');
a.push('</div>');
a.push('<img id="moreColor'+this._sParentId+'" src="http://b.bst.126.net/style/common/htmlEditor/more_colr.gif" style="border:1px solid white; margin-left:3px; margin-top:0px; margin-bottom:3px; height:16px; width:150px; cursor:pointer;"/>');
a.push('</div>');
return a.join("");
},
_drawFullColorPanel:function(){
var a=[];
a.push('<div style="width:203px; border:1px #4e6e89 solid;background-color:#FFFFFF">');
a.push('<div style="position:relative;margin:1px 1px 1px 1px;height:19px">');
a.push('<img id="colorClear'+this._sParentId+'" src="http://b.bst.126.net/style/common/htmlEditor/full_colr_remove.gif" style="width:199px;height:17px;background-color:white;border:1px solid white;cursor:pointer;" />');
a.push('<div id="colorPrez'+this._sParentId+'" style="position:absolute;top:3px;left:3px;border:1px solid #ACA899;font-size:1px;width:28px;height:11px;"> </div>');
a.push('</div>');
a.push('<div style="margin-left:2px!important;margin-left:1px;margin-top:2px!important;margin-top:1px; margin-bottom:1px;width:201px;">');
a.push('<table id="fullColorSelect'+this._sParentId+'" border="1" cellspacing="0" cellpadding="0" style="border-collapse: collapse;cursor:pointer; border:1px solid #000000" bordercolor="#000000" >');
for(i=0;i<2;i++){
for(j=0;j<6;j++){
a.push('<tr height=10>');
if(i==0){
a.push('<td style="padding:0px;font-size:0px;border:1px #000000 solid"><img '+((this.isIE)?"":"src="+NECtrl.ColorPanel._picSrc)+' width=9 style="font-size:1px;background-color:#'+NECtrl.ColorPanel._ColorHex[j]+NECtrl.ColorPanel._ColorHex[j]+NECtrl.ColorPanel._ColorHex[j]+'"></img></td>');
}else{
a.push('<td style="padding:0px;font-size:0px;border:1px #000000 solid"><img '+((this.isIE)?"":"src="+NECtrl.ColorPanel._picSrc)+' width=9 style="font-size:1px;background-color:#'+NECtrl.ColorPanel._SpColorHex[j]+'"></img></td>');
}
a.push('<td style="padding:0px;font-size:0px;border:1px #000000 solid"><img '+((this.isIE)?"":"src="+NECtrl.ColorPanel._picSrc)+' width=9 style="font-size:1px;background-color:#000000"></img></td>');
for(k=0;k<3;k++){
for(l=0;l<6;l++){
a.push('<td style="padding:0px;font-size:0px;border:1px #000000 solid"><img '+((this.isIE)?"":"src="+NECtrl.ColorPanel._picSrc)+' width=9 style="font-size:1px;background-color:#'+NECtrl.ColorPanel._ColorHex[k+i*3]+NECtrl.ColorPanel._ColorHex[l]+NECtrl.ColorPanel._ColorHex[j]+'"></img></td>');
}
}
a.push('</tr>');
}
}
a.push('</table>');
a.push('</div>');
a.push('</div>');
return a.join("");
},
_onMoreColor:function(oColorDiv,sColorType){
this._displayFullColorBoard(oColorDiv,sColorType);
},
_onColorClear:function(sColorType){
var color;
if(sColorType=="ForeColor"){
color="black";
}else if(sColorType=="BackColor"){
color="white";
}
try{
if(this._oCurrentColor!=null){
this._oCurrentColor_savedColor=color;
this._oHtmlEditor.format(sColorType,color);
}
this._oHtmlEditor.hiddenAllMenu();
return;
}catch(e){}
},
_onColorOvr:function(oEvent){
var _oNode;
if(this.isIE)
_oNode=event.srcElement;
else
_oNode=oEvent.target;
if(_oNode.tagName=="IMG"){
if(this._oCurrentColor!=null){
this._oCurrentColor.style.backgroundColor=this._oCurrentColor._background;
}
_oNode._background=_oNode.style.backgroundColor;
$("colorPrez"+this._sParentId).style.backgroundColor=_oNode.style.backgroundColor;
this._oCurrentColor=_oNode;
}
},
_onColorOut:function(sColorType){
if(this._oCurrentColor!=null){
if(this._oCurrentColor_savedColor!=null){
$("colorPrez"+this._sParentId).style.backgroundColor=this._oCurrentColor_savedColor;
}else{
if(sColorType=="ForeColor"){
$("colorPrez"+this._sParentId).style.backgroundColor="black";
}else if(sColorType=="BackColor"){
$("colorPrez"+this._sParentId).style.backgroundColor="white";
}
}
}
},
_onColorClick:function(sColorType,oEvent){
var _oNode;
if(this.isIE)
_oNode=event.srcElement;
else
_oNode=oEvent.target;
if(_oNode.tagName=="IMG"){
try{
if(this._oCurrentColor!=null){
this._oCurrentColor_savedColor=_oNode.style.backgroundColor;
this._oHtmlEditor.format(sColorType,_oNode.style.backgroundColor);
}
this._oHtmlEditor.hiddenAllMenu();
}catch(e){}
}
return false;
},
_displaySimpleColorBoard:function(oColorDiv,sColorType){
if(this.simpleHTML==null)
this.simpleHTML=this._drawSimpleColorPanel();
oColorDiv.innerHTML=this.simpleHTML;
if(this._oCurrentColor!=null){
$("colorPrez"+this._sParentId).style.backgroundColor=this._oCurrentColor_savedColor;
}else{
if(sColorType=="ForeColor"){
$("colorPrez"+this._sParentId).style.backgroundColor="black";
}else if(sColorType=="BackColor"){
$("colorPrez"+this._sParentId).style.backgroundColor="white";
}
}
var _oColorSelect=$("colorSelectPanel"+this._sParentId);
_oColorSelect.onmouseover=this._onColorOvr.bind(this);
_oColorSelect.onmouseout=this._onColorOut.bind(this,sColorType);
_oColorSelect.onclick=this._onColorClick.bind(this,sColorType);
var _oColorClear=$("colorClear"+this._sParentId);
_oColorClear.onclick=this._onColorClear.bind(this,sColorType);
_oColorClear.onmouseover=this.colorTxtOvr.bindAsEventListener(this);
_oColorClear.onmouseout=this.colorTxtOut.bindAsEventListener(this);
var _oMoreClear=$("moreColor"+this._sParentId);
_oMoreClear.onclick=this._onMoreColor.bind(this,oColorDiv,sColorType);
_oMoreClear.onmouseover=this.colorTxtOvr.bindAsEventListener(this);
_oMoreClear.onmouseout=this.colorTxtOut.bindAsEventListener(this);
return true;
},
_displayFullColorBoard:function(oColorDiv,sColorType){
if(this.fullHTML==null)
this.fullHTML=this._drawFullColorPanel();
oColorDiv.innerHTML=this.fullHTML;
var _oColorSelectPanel=$("fullColorSelect"+this._sParentId);
if(this._oCurrentColor!=null){
$("colorPrez"+this._sParentId).style.backgroundColor=this._oCurrentColor_savedColor;
}else{
if(sColorType=="ForeColor"){
$("colorPrez"+this._sParentId).style.backgroundColor="black";
}else if(sColorType=="BackColor"){
$("colorPrez"+this._sParentId).style.backgroundColor="white";
}
}
_oColorSelectPanel.onclick=this._onColorClick.bind(this,sColorType);
_oColorSelectPanel.onmouseover=this._onColorOvr.bind(this);
_oColorSelectPanel.onmouseout=this._onColorOut.bind(this,sColorType);
var _oColorClear=$("colorClear"+this._sParentId);
_oColorClear.onclick=this._onColorClear.bind(this,sColorType);
_oColorClear.onmouseover=this.colorTxtOvr.bindAsEventListener(this);
_oColorClear.onmouseout=this.colorTxtOut.bindAsEventListener(this);
return true;
}
}
if(NECtrl==undefined){
var NECtrl={};
}
NECtrl.InsertAnything=Class.create();
NECtrl.InsertAnything.prototype={
initialize:function(sParentId,oEditor){
this.options=Object.extend({
sObjName:null
},arguments[2]||{});
this.parentId=sParentId;
this.objName=this.options.sObjName;
this.oEditor=oEditor;
this.body=document.body;
if(document.all)this.isIE=true;else this.isIE=false;
var oDiv=document.createElement('div');
oDiv.className="edt_lay_outer";
this.body.appendChild(oDiv);
this.coverBack=oDiv;
this.coverBack.style.display='none';
},
makeCenter:function(mainId){
var mainDiv=$(mainId);
var left=((document.documentElement.clientWidth||document.body.clientWidth)-mainDiv.offsetWidth)/2;
if(left<10)left=10;
var top=0;
top=(document.documentElement.scrollTop||document.body.scrollTop)+
((document.documentElement.clientHeight||document.body.clientHeight)-mainDiv.offsetHeight)/2;
if(top<40)top=40;
mainDiv.style.top=(top-120)+"px";
mainDiv.style.left=left+"px";
},
showCoverBack:function(){
if(this.coverBack)
this.coverBack.style.display='block';
},
hideCoverBack:function(name){
if(this.coverBack)
this.coverBack.style.display='none';
this.oEditor.fixState(name);
},
moveCursor2End:function(oInput){
var r=oInput.createTextRange();
r.moveStart("character",oInput.value.length);
r.collapse(true);
r.select();
},
showLink:function(hasLink,vHTML){
this.showCoverBack();
if(!this.linkWindow){
oMainDiv=document.createElement('div');
oMainDiv.className="edt_lay_com edt_lay_lnk";
oMainDiv.id='addLinkLayer'+this.parentId;
oMainDiv.innerHTML=this.drawLinkDlg();
this.body.appendChild(oMainDiv);
this.makeCenter('addLinkLayer'+this.parentId);
this.linkWindow=oMainDiv;
}else{
this.linkWindow.style.display='block';
}
var oInput=$('linkURL'+this.parentId);
if(hasLink){
$('isLink'+this.parentId).className="three";
oInput.value=vHTML.href;
}else{
$('isLink'+this.parentId).className="two";
var oInput=$('linkURL'+this.parentId);
oInput.value='http://';
}
oInput.focus();
if(this.isIE)
this.moveCursor2End(oInput);
$('linkOK'+this.parentId).onclick=this.addLink.bind(this,hasLink,vHTML);
$('linkURL'+this.parentId).onkeydown=this.linkInputKeyDown.bindEventWithArgs(this,hasLink,vHTML);
},
linkInputKeyDown:function(hasLink,vHTML,event){
if(event.keyCode==13){
this.addLink(hasLink,vHTML);
Event.stop(event);
}
},
addLink:function(hasLink,vHTML){
var sURL=$('linkURL'+this.parentId).value;
if(sURL==""||sURL=="http://"){
if(hasLink){
this.cancelLink();
}
}else{
if(sURL.indexOf("http://")!=0&&sURL.indexOf("https://")!=0&&sURL.indexOf("ftp://")!=0&&sURL.indexOf("mms://")!=0&&sURL.indexOf("rtsp://")!=0&&sURL.indexOf("mmst://")!=0&&sURL.indexOf("mmsu://")!=0&&sURL.indexOf("mailto:")!=0){
sURL="http://"+sURL;
}
if(hasLink){
var _oldHTML=vHTML.innerHTML;
vHTML.href=sURL;
vHTML.innerHTML=_oldHTML;
}else{
var value='';
if(vHTML!=null){
value='<a href="'+sURL+'" target="_blank">'+vHTML+'</a>';
}else{
value='<a href="'+sURL+'" target="_blank">'+sURL+'</a>';
}
this.oEditor.insertHTML(value,true);
}
}
this.hide('Link');
},
cancelLink:function(){
this.oEditor.format("unlink",null,true);
this.hide('Link');
},
drawLinkDlg:function(){
var s=[];
s.push('<div class="titlebar">');
s.push('<span>添加/修改链接</span>');
s.push('</div>');
s.push('<div class="content">');
s.push('<div class="addr"><input id="linkURL'+this.parentId+'" type="text" value="http://"></div>');
s.push('<div class="btm"><div id="isLink'+this.parentId+'" class="two">');
s.push('<input id="linkOK'+this.parentId+'" class="btncm btnok" type="button" value="确 定">');
s.push('<input class="btncm" type="button" value="取 消" onclick="'+this.objName+'.hide(\'Link\');return false;">');
s.push('<input class="btncm btoff" type="button" value="撤销链接" onclick="'+this.objName+'.cancelLink();return false;">');
s.push('</div></div>');
return s.join('');
},
showTable:function(){
if(!this.tableWindow){
var oDiv=document.createElement('div');
oDiv.className="edt_lay_com edt_lay_tbl";
oDiv.id="tableMain"+this.parentId;
oDiv.innerHTML=this.drawTableDlg();
this.body.appendChild(oDiv);
this.makeCenter(oDiv.id);
this.tableWindow=oDiv;
}else{
this.tableWindow.style.display='block';
}
this.showCoverBack();
var oInput=$('tableRows'+this.parentId)
oInput.focus();
if(this.isIE)
this.moveCursor2End(oInput);
},
tableKeydown:function(event){
if(event.keyCode==13){
this.submitTable();
Event.stop(event);
}
},
drawTableDlg:function(){
var a=[];
a.push('<div class="titlebar">添加表格</div><div class="content" onkeydown="'+this.objName+'.tableKeydown(event);">');
a.push('<div style="margin-left:30px; margin-top:10px; margin-right:30px">行<span style="margin-left:23px">&nbsp;</span>数:<input id="tableRows');
a.push(this.parentId);
a.push('" type="text" name="textfield2" style="width:35px;" value="2"/>&nbsp;&nbsp;');
a.push('列<span style="margin-left:23px">&nbsp;</span>数:<input id="tableCols');
a.push(this.parentId);
a.push('" type="text" name="textfield2" style="width:35px;" value="2"/>');
a.push('</div>');
a.push('<div style="margin-left:30px; margin-top:5px; margin-right:30px">表格宽度:<input id="tableWidth');
a.push(this.parentId);
a.push('" type="text" name="textfield2" style="width:52px;"/><span style="margin-left:5px">&nbsp;</span>');
a.push('<select name="p" style="width:86px!important;width:88px; height:22px" id="tableType');
a.push(this.parentId);
a.push('">');
a.push('<option value=1>百分比</option>');
a.push('<option value=2>像素</option>');
a.push('</select></div>');
a.push('<div class="tglicn" style="margin-left:30px; margin-top:8px"> <span id="tableImgAdvance');
a.push(this.parentId);
a.push('" onclick="');
a.push(this.objName);
a.push('.switchTableAdvance();return false;" class="fold" style="cursor:pointer;">&nbsp;</span><span style="cursor:pointer;" onclick="');
a.push(this.objName);
a.push('.switchTableAdvance();return false;" > 高级设置</span></div>');
a.push('<div id="tableAdvanceDetail');
a.push(this.parentId);
a.push('" style="display:none;overflow:hidden;">');
a.push('<div style="margin-left:46px; margin-top:4px">');
a.push('边框粗细:<span style="margin-left:11px">&nbsp;</span><input id="tableBorder');
a.push(this.parentId);
a.push('" type="tableText');
a.push(this.parentId);
a.push('" name="textfield2" style="width:40px;" value="1"/>&nbsp;像素');
a.push('</div>');
a.push('<div style="margin-left:44px; margin-top:3px">');
a.push('<div style="float:left">');
a.push('单元格边距:&nbsp;<input id="tableCellpadding');
a.push(this.parentId);
a.push('" type="text" name="textfield2" style="width:40px;" value="1"/>&nbsp;');
a.push('</div>');
a.push('<div class="blkicn">&nbsp;</div>');
a.push('</div>');
a.push('<div style="margin-left:44px; margin-top:3px">');
a.push('<div style="float:left; margin-top:3px!important;margin-top:0px">');
a.push('单元格间距:&nbsp;<input id="tableCellspacing');
a.push(this.parentId);
a.push('" type="text" name="textfield2" style="width:40px;" value="1"/>&nbsp;');
a.push('</div>');
a.push('<div class="spcicn">&nbsp;</div>');
a.push('</div>');
a.push('</div>');
a.push('<div style="clear:both;height:0px;line-height:0px;font-size:0px;margin-left:56px;"></div>');
a.push('<div style="margin-left:56px; margin-top:21px;display:inline;" class="btm">');
a.push('<input name="button" type="button" class="btncm btnok" value="确 定" onclick="');
a.push(this.objName);
a.push('.submitTable();"/>');
a.push('<input name="button" type="button" class="btncm" value="取 消" onclick="');
a.push(this.objName);
a.push('.hide(\'Table\');"/>');
a.push('</div>');
a.push('</div>');
return a.join('');
},
switchTableAdvance:function(){
var adv=$("tableAdvanceDetail"+this.parentId);
var imgAdvance=$("tableImgAdvance"+this.parentId);
var maindiv=$('tableMain'+this.parentId);
if(adv.style.display=="none"){
adv.style.display="block";
Element.removeClassName('tableImgAdvance'+this.parentId,'fold');
Element.addClassName('tableImgAdvance'+this.parentId,'unfold');
maindiv.style.height='280px';
}else{
adv.style.display="none";
Element.removeClassName('tableImgAdvance'+this.parentId,'unfold');
Element.addClassName('tableImgAdvance'+this.parentId,'fold');
$("tableBorder"+this.parentId).value=1;
$("tableCellpadding"+this.parentId).value=0;
$("tableCellspacing"+this.parentId).value=0;
maindiv.style.height='218px';
}
},
submitTable:function(){
var rows=$F("tableRows"+this.parentId);
var cols=$F("tableCols"+this.parentId);
var width=$F("tableWidth"+this.parentId);
var selection=$("tableType"+this.parentId);
var widthType=selection.options[selection.selectedIndex].value;
var border=$F("tableBorder"+this.parentId);
var cellpadding=$F("tableCellpadding"+this.parentId);
var cellspacing=$F("tableCellspacing"+this.parentId);
this.addTable(rows,cols,width,widthType,border,cellpadding,cellspacing);
this.hide('Table');
},
addTable:function(iRows,iCols,iWidth,iWidthType,iBorder,iCellpadding,iCellspacing){
var _reg=/^\d+$/;
if(!_reg.test(iRows)||(iRows==0))
return;
if(!_reg.test(iCols)||(iCols==0))
return;
var _sWidth="";
if(!_reg.test(iWidth)){
_sWidth="100%";
}else{
if(iWidthType==1){
if(iWidth<=100&&iWidth>=0)
_sWidth=iWidth+"%";
else
_sWidth="100%";
}else if(iWidthType==2){
_sWidth=iWidth+"px";
}else{
_sWidth="100%";
}
}
var _sBorder=iBorder;
if(!_reg.test(iBorder))
_sBorder=0;
var _sCellpadding=iCellpadding;
if(!_reg.test(iCellpadding))
_sCellpadding=0;
var _sCellspacing=iCellspacing;
if(!_reg.test(iCellspacing))
_sCellspacing=0;
var _s=[];
if(_sBorder==0){
_s.push('<table class="editor_zero_border" width="');
}else{
_s.push('<table style="border:'+_sBorder+'px solid" width="');
}
_s.push(_sWidth);
_s.push('" border="');
_s.push(_sBorder);
_s.push('" cellPadding="');
_s.push(_sCellpadding);
_s.push('" cellSpacing="');
_s.push(_sCellspacing);
_s.push('">');
for(var i=0;i<iRows;++i){
_s.push('<tr>');
for(var j=0;j<iCols;++j){
_s.push('<td>&nbsp;</td>');
}
_s.push('</tr>');
}
_s.push('</table>');
var _sHTML=_s.join("");
this.oEditor.insertHTML(_sHTML,true);
},
showMedia:function(){
if(!this.mediaWindow){
var oDiv=document.createElement('div');
oDiv.className="edt_lay_com edt_lay_mda";
oDiv.id='mediaMain'+this.parentId;
oDiv.innerHTML=this.drawMediaDlg();
this.body.appendChild(oDiv);
this.makeCenter(oDiv.id);
this.mediaWindow=oDiv;
}else{
this.mediaWindow.style.display='block';
}
this.initMediaWindow();
this.showCoverBack();
var oInput=$('mediaUrl'+this.parentId);
oInput.focus();
if(this.isIE)
this.moveCursor2End(oInput);
},
mediaInputKeydown:function(event){
if(event.keyCode==13){
this.submitMedia();
Event.stop(event);
}
},
drawMediaDlg:function(){
var a=[];
a.push('<div class="titlebar">添加多媒体</div><div class="content">');
a.push('<div style="margin-left:20px; margin-top:10px"> 网 址：');
a.push('<input id="mediaUrl');
a.push(this.parentId);
a.push('" ');
a.push('onkeydown="');
a.push(this.objName);
a.push('.mediaInputKeydown(event);" ');
a.push('type="text" name="textfield" style="width:420px;" class="utxt" value="http://"/>');
a.push('</div>');
a.push('<div class="tglicn" style="margin-left:20px; margin-top:10px"><span id="mediaImgAdvance');
a.push(this.parentId);
a.push('" onclick="');
a.push(this.objName);
a.push('.switchMediaAdvance();return false;" class="fold" style="cursor:pointer;">&nbsp;</span> <span style="cursor:pointer;color:#3366cc;" onclick="');
a.push(this.objName);
a.push('.switchMediaAdvance();return false;" > 高级选项</span></div>');
a.push('<div id="mediaAdvanceDetail');
a.push(this.parentId);
a.push('" style="display:none">');
a.push('<div style="margin-left:38px; margin-top:10px"><span>播放方式：</span>');
a.push('<input id="mediaAutoPlay');
a.push(this.parentId);
a.push('" type="checkbox" name="checkbox" value="checkbox" class="cb" style="margin-left:7px;"/>');
a.push('<span style="color:#000;">自动播放</span>');
a.push('<input id="mediaLoopPlay');
a.push(this.parentId);
a.push('" type="checkbox" name="checkbox" value="checkbox" class="cb" style="margin-left:19px;"/>');
a.push('<span style="color:#000;">循环播放</span>');
a.push('</div>');
a.push('<div style="margin-left:38px; margin-top:10px"> 显示尺寸：<span style="color:#000;"> 宽</span>&nbsp;');
a.push('<input id="mediaWidth');
a.push(this.parentId);
a.push('" type="text" name="textfield2" style="width:40px;margin-right:25px;"/>');
a.push('<span style="color:#000;">高</span>&nbsp;');
a.push('<input id="mediaHeight');
a.push(this.parentId);
a.push('" type="text" name="textfield2" style="width:40px;"/><span style="color:#000;"> 像素</span>');
a.push('</div>');
a.push('<div style="margin-left:38px; margin-top:15px;overflow:hidden;">');
a.push('<div style="float:left;"> 对齐方式：</div>');
a.push('<div class="icnwrp" style="margin-left:3px;" ><div id="mediaDefault');
a.push(this.parentId);
a.push('" class="mdad" onclick="');
a.push(this.objName);
a.push('.ImgClick(this)">&nbsp;</div></div>');
a.push('<div class="icnwrp"><div id="mediaLeft');
a.push(this.parentId);
a.push('" class="mdal" onclick="');
a.push(this.objName);
a.push('.ImgClick(this)">&nbsp;</div></div>');
a.push('<div class="icnwrp"><div id="mediaCenter');
a.push(this.parentId);
a.push('" class="mdac" onclick="');
a.push(this.objName);
a.push('.ImgClick(this)">&nbsp;</div></div>');
a.push('<div class="icnwrp"><div id="mediaRight');
a.push(this.parentId);
a.push('" class="mdar" onclick="');
a.push(this.objName);
a.push('.ImgClick(this)">&nbsp;</div></div>');
a.push('</div>');
a.push('<div style="clear:both; margin-left:127px; margin-top:3px;">');
a.push('<span style="color:#000;">默认</span>');
a.push('<span style="margin-left:62px;color:#000;">居左</span>');
a.push('<span style="margin-left:62px;color:#000;">居中</span>');
a.push('<span style="margin-left:62px;color:#000;">居右</span>');
a.push('</div>');
a.push('<div style="margin-left:37px; margin-top:15px;"><input id="mediaRemember');
a.push(this.parentId);
a.push('" type="checkbox" class="cb"/> <span style="color:#000;font-size:12px;">以后都使用此次设置</span></div>');
a.push('</div>');
a.push('<div style="margin-left:180px; margin-top:15px;display:inline;" class="btm">');
a.push('<input name="button" type="button" class="btncm btnok" value="确 定" onclick="');
a.push(this.objName);
a.push('.submitMedia();"/>');
a.push('<input name="button" type="button"  class="btncm" value="取 消" onclick="');
a.push(this.objName);
a.push('.hide(\'Media\');"/>');
a.push('</div>');
return a.join('');
},
initMediaWindow:function(){
this.setMediaByCookie();
},
setMediaByCookie:function(){
var c=this.getCookieByName("addMediaCookie");
var mediaCookie=c.split('|');
if(mediaCookie[0]==1){
$("mediaAutoPlay"+this.parentId).checked=true;
}else{
$("mediaAutoPlay"+this.parentId).checked=false;
}
if(mediaCookie[1]==1){
$("mediaLoopPlay"+this.parentId).checked=true;
}else{
$("mediaLoopPlay"+this.parentId).checked=false;
}
if(mediaCookie[2]!=undefined&&mediaCookie[2]!="")
$("mediaWidth"+this.parentId).value=mediaCookie[2];
if(mediaCookie[3]!=undefined&&mediaCookie[3]!="")
$("mediaHeight"+this.parentId).value=mediaCookie[3];
var oPosition;
switch(mediaCookie[4]){
case"mediaLeft":
oPosition=$("mediaLeft"+this.parentId);
break;
case"mediaCenter":
oPosition=$("mediaCenter"+this.parentId);
break;
case"mediaRight":
oPosition=$("mediaRight"+this.parentId);
break;
default:
oPosition=$("mediaDefault"+this.parentId);
}
oPosition.style.borderColor="#316AC5";
this.currPos=oPosition;
},
addCookie:function(autoChecked,loopChecked,wid,high,position){
var date=new Date();
var expireDays=300;
date.setTime(date.getTime()+expireDays*24*3600*1000);
document.cookie='addMediaCookie='+autoChecked+'|'+loopChecked+'|'+
wid+'|'+high+'|'+position
+";domain=163.com;expires="+date.toGMTString();
},
getCookieByName:function(c_name){
if(document.cookie.length>0){
c_start=document.cookie.indexOf(c_name+"=");
if(c_start!=-1){
c_start=c_start+c_name.length+1;
c_end=document.cookie.indexOf(";",c_start);
if(c_end==-1)
c_end=document.cookie.length;
return unescape(document.cookie.substring(c_start,c_end));
}
}
return"";
},
switchMediaAdvance:function(){
var adv=$("mediaAdvanceDetail"+this.parentId);
var imgAdvance=$("mediaImgAdvance"+this.parentId);
if(adv.style.display=="none"){
adv.style.display="block";
Element.removeClassName('mediaImgAdvance'+this.parentId,'fold');
Element.addClassName('mediaImgAdvance'+this.parentId,'unfold');
this.mediaWindow.style.height='355px';
}else{
adv.style.display="none";
Element.removeClassName('mediaImgAdvance'+this.parentId,'unfold');
Element.addClassName('mediaImgAdvance'+this.parentId,'fold');
this.mediaWindow.style.height='155px';
}
},
ImgClick:function(obj){
if(obj!=this.currPos){
obj.style.borderColor="#316AC5";
this.currPos.style.borderColor="white";
this.currPos=obj;
}
},
isInt:function(oNum){
if(!oNum)
return false;
var strP=/^\d+$/;
if(!strP.test(oNum))
return false;
else
return true;
},
clearMedia:function(){
$("mediaAutoPlay"+this.parentId).checked=false;
$("mediaLoopPlay"+this.parentId).checked=false;
$("mediaWidth"+this.parentId).value='';
$("mediaHeight"+this.parentId).value='';
$("mediaLeft"+this.parentId).style.border='white 2px solid';
$("mediaCenter"+this.parentId).style.border='white 2px solid';
$("mediaRight"+this.parentId).style.border='white 2px solid';
$("mediaDefault"+this.parentId).style.border='white 2px solid';
$("mediaRemember"+this.parentId).checked=false;
},
submitMedia:function(){
var autoPlay;
var loopPlay;
var width;
var height;
if($("mediaAutoPlay"+this.parentId).checked==true){
autoPlay=1;
}else{
autoPlay=0;
}
if($("mediaLoopPlay"+this.parentId).checked==true){
loopPlay=1;
}else{
loopPlay=0;
}
var wid=$("mediaWidth"+this.parentId).value;
var high=$("mediaHeight"+this.parentId).value;
if(wid==''||!this.isInt(wid)){
width="";
}else{
width=wid;
}
if(high==''||!this.isInt(high)){
height="";
}else{
height=high;
}
if($("mediaRemember"+this.parentId).checked==true){
this.addCookie(autoPlay,loopPlay,width,height,this.currPos.id);
}
var sUrl=$("mediaUrl"+this.parentId).value;
this.addMedia(sUrl,autoPlay,loopPlay,width,height,this.currPos.id);
this.hide('Media');
},
addMedia:function(sUrl,bAuto,bLoop,width,height,sPos){
if(sUrl==""||sUrl=="http://")
return false;
var _real=/^http:\/\/(.+)\.(rm|rmvb|rt|ra|rp|rv|mov|qt|aac|m4a|m4p|ssm|sdp|3gp|amr|awb|3g2|divx)$/ig;
var _wm=/^http:\/\/(.+)\.(mp3|avi|asf|wmv|wma|mpg|mpeg|wax|asx|wm|wmx|wvx|wav|mpv|mps|m2v|m1v|mpe|mpa|mp4|m4e|mp2|mp1|au|aif|aiff|mid|midi|rmi)$/ig;
var _flash=/^http:\/\/(.+)\.swf(\?.*)?$/ig;
var _sPos=sPos;
var _sAuto=bAuto;
var _sLoop=bLoop;
var _sWidHigh;
if(width!=""){
_sWidHigh=" width="+width;
}else{
_sWidHigh="";
}
if(height!=""){
_sWidHigh=_sWidHigh+" height="+height;
}
var _sMediaHTML='';
var _sStyle="";
switch(_sPos){
case"mediaLeft":
_sStyle="FLOAT: left; MARGIN: 0px 10px 10px 0px";
break;
case"mediaCenter":
_sStyle="DISPLAY: block; MARGIN: 0px auto 10px; TEXT-ALIGN: center";
break;
case"mediaRight":
_sStyle="FLOAT: right; MARGIN: 0px 0px 10px 10px";
break;
default:
_sStyle="DISPLAY: block";
}
var _bIsReal=false;
if(_real.test(sUrl)){
_bIsReal=true;
if(width==""||height==""){
_sWidHigh="width=300 height=200";
}
_sMediaHTML='<embed src='+sUrl+' style="'+_sStyle+'" type="audio/x-pn-realaudio-plugin" controls="ImageWindow,ControlPanel,StatusBar" '+
_sWidHigh+' autostart="'+_sAuto+'" loop="'+_sLoop+'"></embed>';
}else if(_wm.test(sUrl)){
_sMediaHTML='<embed src='+sUrl+' style="'+_sStyle+'" pluginspage="http://www.microsoft.com/isapi/redir.dll?prd=windows&amp;sbp=mediaplayer&amp;ar=media&amp;sba=plugin&amp;" type="application/x-mplayer2" showcontrols="1" showaudiocontrols="1" showstatusbar="1" enablecontextmenu="1" '+
_sWidHigh+' autostart="'+_sAuto+'" loop="'+_sLoop+'"></embed>';
}else if(_flash.test(sUrl)){
_sMediaHTML='<embed src='+sUrl+' style="'+_sStyle+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" '+
'wmode="transparent" quality="high" '+_sWidHigh+'></embed>';
}else{
_sMediaHTML='<embed src='+sUrl+' style="'+_sStyle+'"'+_sWidHigh+' autostart="'+_sAuto+'" loop="'+_sLoop+'"></embed>';
}
_sMediaHTML+='&nbsp;';
this.oEditor.insertHTML(_sMediaHTML,true);
if(this.isIE&&_bIsReal)
this.oEditor.designEditorDoc.body.contentEditable=true;
},
hide:function(name){
if(this.linkWindow)this.linkWindow.style.display='none';
if(this.tableWindow)this.tableWindow.style.display='none';
if(this.mediaWindow)this.mediaWindow.style.display='none';
this.hideCoverBack(name);
if(name=='Media')
this.clearMedia();
this.oEditor.setInserting(false);
}
}
if(NECtrl==undefined){
var NECtrl={};
}
NECtrl.Portrait=Class.create();
NECtrl.Portrait._faceTips=
['微笑','开怀笑','哭泣','失望','困了',
'好好笑','啵','电到了','汗','流口水了',
'真困啊','我吐','眨眼','？？？','嘘',
'砸死你','不说','坏','色迷迷','教训',
'可爱','YEAH','崩溃','惊讶','鄙视',
'开心','仰慕你','晕','挖鼻孔','撒娇',
'鼓掌','害羞','老大','欠揍','吐舌笑脸',
'飞吻','工作忙','大哭','偷偷笑','送花给你',
'来，亲一个','拍桌子','拜拜','得意的笑','生气',
'怕怕','尴尬','难过','叹气','我是女生',
'玫瑰','好爱你','心碎了','亲亲','NO',
'YES','握个手','到点了','音乐','我是男生',
'带血的刀','炸弹','有了','好晚了','吸血蝙蝠',
'便便','干一杯','抽烟','打电话','家',
'车子','礼物','金钱','太阳','下雨',
'猪猪','小猫','小狗','骨头','喝水',
'汉堡','包子','西瓜','约会','CALL我'
];
NECtrl.Portrait._westTips=
['微笑','开心','得意','晕了','怕了吧','蝙蝠','牛奶','小狗','心碎了','爱你',
'蛋糕','握手','时钟','咖啡','不爽','痛哭','牛头','脸红','阴险吧','再见',
'帅哥','亲一个','电话','献花','不是吧','吐舌头','yes','no','爽啊','小猪',
'灯泡','可乐','骂人','礼物','晚安','讨厌','乌云','yeah','你好','扇风',
'眯眼','飞吻','唱歌','臭美','庆祝','惊叹','叫好','安慰','我行啊','崩溃',
'胜利了','叫好','我哭','可爱','不爽','疑问','憨笑','call我','不错哦','休息',
'呸','欢呼','大笑','哈哈','飞行','呕吐','挨揍','我闭嘴','困了','晦气',
'就医','鄙视','喜欢你','回来了','汗','加油','厉害','高兴','倒霉','我顶',
'流口水','速度','不理你','欢迎','恭喜','邮件','瞧我的','爱意','色迷迷','亲爱的',
'不稀罕','强','喝酒','完蛋','蓬头','拜拜','爽啊','献花','快来人','念经',
'下雨了','快记','小看你','溜走'
];
NECtrl.Portrait._popoTips=
['饶了我','敢惹我','蜘蛛侠','微笑','抓狂','流鼻血','谁放p','开饭了','崇拜','血窟窿',
'不是吧','打哈欠','真衰','大家好','投降','大笑','流口水','老大','雄霸','命歹啊',
'亲你','痛哭','挨揍','脸肿','服了','傲慢','得意','满意','汗','可怜',
'怒了','傻笑','伤心','倒霉','鬼脸','羡慕','偷看','绷带','挨砖','挨铁球',
'好色','行星','害羞','泪流','烧香','挨扁','不敢了','哈哈','强','寒',
'爽啊','惊讶','yoyo','太有才','吓我','出击','耍酷','缺牙','又打我','友好',
'黑心','我哭','骷髅','白牙','掉眼球','戴花','我也要','美味','狂笑','眯眼',
'晕死','爱财','发呆','滴汗','爱你','哼哼','眼镜','怕了','大小眼','飞天侠',
'甲虫脸','错愕','欢迎','不懂',
'标枪','风帆','击剑','跨栏MM','跨栏',
'马术','平衡木','铅球','拳击','射击',
'射箭','手球','跆拳道','田径','田径MM',
'跳马','铁饼','棒球','撑竿跳','弹床',
'吊环','举重','排球','皮划艇','皮划艇',
'乒乓','自行车','曲棍球','沙滩排球','水上排球',
'体操','跳台','网球','游泳','羽毛球','加油！','加油！'
];
NECtrl.Portrait._bearTips=
['打球','我听话','吃零食','写字','跳舞','吹气','肚皮舞','无聊哦','吃饭了','吃冰棍',
'大笑','发火','击球','揍你','唱歌','眨眼睛','打喷嚏','纳闷','爆发吧','做鬼脸',
'威胁','玩彩球','星月','挨揍','哼歌','魔法棒','舞大刀','再见','扩胸'
];
NECtrl.Portrait._tuTips=
['正义超人陈队','大八卦','啊~~~死掉了','吃饱饱','HAPPY~~',
'哇 哈哈哈','好急好急','好开心','BS你','星星眼',
'正义超人','调皮','WS老别别','钢琴小王子','挖啊挖鼻孔',
'爆炸芭蕾','风尘式抽烟','华丽转圈圈','色别别归来','拉拉队长',
'第一手','草莓星星眼','撒娇撒娇','弱弱小鸡','心永不变',
'我追呀追','我跑呀跑','梨花带雨','不要离开我','含蓄滴脸红',
'怨念','抓狂','WS偷偷笑','欢迎欢迎','热烈欢迎',
'坏坏扭扭','色色扭扭','忠心扭扭','勾人的小妞','帅锅',
'WS眼镜男','华丽吐啊吐','指着鼻子骂','伤心滴飘走','不倒翁',
'喝醉鸟','不爽','121 121 121','软绵绵滴撒娇','摇啊摇',
'激烈滴撒娇','小白扭扭','小黑扭扭','怕不怕啊','小白跳舞',
'小黑跳舞','小白跳舞','小黑跳舞','HAPPY小暴牙','钢琴小公主',
'钢琴小王子','美少女花子','垂涎美色滴WSN~~~~','是说我吗','在做什么捏',
'僵尸宝宝','僵尸妈妈','僵尸爸爸','僵尸爷爷','一起跳~~',
'一起跳~~','天生一对','白扭扭队','黑扭扭队','僵尸家族出游鸟~~~',
'偶棉在浇花啊','啦啦啦~','心花怒放','大心~~','蹲地发呆',
'招手','喔~~~','扇扇风左','少奶奶打招呼','扇扇风右',
'圣诞快乐','圣诞树','洗白白',' 绿茶面膜','巧克力面膜',
'睡得香','臭屁轰炸','生气厨娘','快乐游泳','比基尼',
'恭喜发财','招财进宝','吉祥如意','对不起','不想起床',
'抱抱','蹬腿','兔子火锅','情人节快乐','胡思乱想',
'小可爱','小三八','抓抓手','生日快乐','顿脚','摇摇椅','贱贱扭扭腰','乖乖扭扭腰','蓝蓝路','奥运火炬手','鼠宝宝','牛宝宝','虎宝宝','兔宝宝','龙宝宝','蛇宝宝','马宝宝','羊宝宝','猴宝宝','鸡宝宝','狗宝宝','猪宝宝','棒棒糖','吃冰棒','划水','玩水','假假PMP','忠心PMP'
];
NECtrl.Portrait._rTips=
['慢慢来嘛','可恶啊','扭扭捏捏','阴险','我就说啊','弹吉他','唱歌','你给我记着','好笑','太好笑了','怎么!?','听我的','换脑壳','不会吧!','摇摆','扭动','瀑布汗','我吐','呼啦圈','怎么这样...','呜呜','真的吗!!','好心痛!','这个这个这个','Yin笑','喵呜','你就吹吧!','咳嗽','你啊你啊!','潜水','气绝','小声点!','NONONO','怎么办怎么办?','削皮','我是LOLI','鼓掌','扭头','这边不对那边不对!','喷饭!','拜拜','冲啊','亲亲','有弹性就有魅力','好冷','摇摇晃晃','捏你','失落','你就扯吧!','有惊喜!','啊呀呀呀!','翻滚中','滚圈圈','鄙视你!','打喷嚏','来呀来呀!~','头很光滑','我说没说过!','华丽摇摆!','就是这样','晕厥～','啊？？','单挑！','我刷啊刷压','我洗啊洗脸','长角...','僵尸','我变我变变','我切我切切','秀逗了？','做鬼脸','杀人狂魔','我舔～～','撞墙啦','冲啊～','打冷战','点头','滚来滚去','雀跃啊','休息了','撞头党'];
NECtrl.Portrait._gTips=
['羞羞','叹气','爱哟~','锻炼','扯虾米','88','好重','欺负人','不活了','讨厌啦','好HIGH','燃了！','亲爱D','喝茶','头晕','很有才','驾~','亢奋','惊！','吓！','摸头','不要吖~','抖~','脸色铁青','红牌','NONO','抬眼镜','天使','亲亲','打拳','这样吗','叹','恶魔','超亢奋','哪里哪里','受打击','喝酒','啊哦','受刺激！','学习','怕怕','尿急','花痴','受伤','抠鼻子','超人','好爱吖','欺负人','飘~','切~','摇吖摇','钓鱼','郁闷']
NECtrl.Portrait._mayangTips=
['戳苍蝇','忽悠','偷窥','飞','鬼脸','刷牙','隐身','吃汉堡','我们是冠军','熏苍蝇','被球砸','摇头','转头斜视','吹风','尿尿','叹气','临危不乱','惊讶','打劫','鬼','汗','喷火','飘过','亲','顶','狡猾','怒','中指','睡觉','问号','大惊','生气','胜利','耶','坐禅','哭','大笑','喊号','比手势'];
NECtrl.Portrait._naiTips=
['被揍','猫猫','我爱奶瓶','爱心','祈祷','再见','不耐烦','下流手势','狂笑','伤心咬奶瓶','怒火','狂笑2','微笑','烦恼','凌厉的眼光','拜奶瓶','懒虫喝奶','抱奶瓶睡觉','趴在地上哭','自虐','疑问','皱眉头','路过','吐舌头','号啕大哭','大吐舌头','害羞','亲亲奶瓶','胜利手势','犯困','指挥','幽灵','生气想揍人','喝醉奶','休息一下','大肚子','后悔捶桌子','威胁','狡猾地笑','不要','踏着奶瓶狂笑','着急奶头不见了','做早操','背奶离乡','可怜地摇摇奶瓶','感动','奸笑海盜','哈哈大笑','惊吓','教训','可怜','惊吓2','点头','努力','害羞','呕吐','鬼脸','型','冷','囧','汗颜','晕','奸','无语','疑惑','嘀咕','高兴','萌动','淫','发怒','瞎跳舞','奶虫','点点点','睡着了','病了','奶虫回眸','喷奶','打扫','干劲十足','数钱','受欺负','雷倒','花前月下','懒','开饭啦','早上好','冒个泡','拜拜','-花心萝卜','扮可爱','足金奶瓶仔','感冒','奶神','甩头','谢谢','加班','肚痛','醉了','扮鬼','电话哭诉','发火','吃汉堡','洗澡','SORRY','扮可怜','沙发','饥饿','神气','逍遥','摇滚','哀愁','呲牙','撞墙','吃','欢喜','棒棒糖','被揍2','爆樽','嗯','投降','你最棒','K书','杀气','奶气冲天','笨蛋','DJ','长胡子了','蔑视','吮手指','发飙','受伤了','拨弄','翘腿','做不完的功课','哭泣'];
NECtrl.Portrait._minimoTips=
['好喜欢','棒','你好','飘过','鼓掌','不明白','晕','新年好','汗','哭','可爱','我是女王','我吐','玩耍','加油','吃东西','恭贺新春','钱啊钱','好冷','有计谋','嘲笑','潜水太久','不会吧','不要','睡觉','扭扭捏捏','发财拉','不行','哈哈','路过','怕怕','献吻','涮牙了','好气','我错了','再见','鬼','藐视','电你','尴尬','偷看','胜利','郁闷','找打','惊'];
NECtrl.Portrait._mlihoTips=
['吃东西','你欺负我','嘿嘿','欢迎','亲爱的','发火','偷亲','笑死了','吐血','再见','快亲我','很好很强大','耍赖','我吐','我汗','爆发','数钱','逗你玩','恭喜','着迷','听话','喜欢','疼爱','恶整','起床啦','伤心','鬼脸','不会吧','疑惑','有美女吖','刷牙啦','超人','我来啦','看不见','发怒','别惹我','噪音攻击','报复','反攻击','坏笑','满足','害羞','欢呼','落魄','无视','探勘','求饶','吸引','虐待','很乖'];
NECtrl.Portrait._likiTips=
['ok','偷笑','大笑','害羞','腼典','撒娇','崇拜','仰慕','怒骂','失望','大惊','向前进','老大','教训','哭','大哭','委屈','献花','晕','撒皮','乖','加油','寒','见鬼','刷牙','超人'];
NECtrl.Portrait._mxTips=
['拍手','抚摸','汗','诡笑','眨眼','棒棒糖','豆眼','点头','摇头','蹭','来抱抱','乃人噢','开心跳','happy','看热闹','生日快乐','亲亲','氺汪汪','好冷','看','一起来','得意','扭呀扭','拨耳朵','美滋滋','可怕','亲宝贝','揉揉','工作','不高兴','啦啦','偷笑','奇怪','吃','惊','私语','抽咽','委屈','流泪','哭','强吻','偷看','抱住','献花','跳舞','hi','睡','冷哇','么么','困','亲','不要','无语','魂','再见','我说','大步走','摆手','扭动','噢噢噢'];
NECtrl.Portrait._xiayuTips=
['555哭','凉快','介个','无语','哼哼~~','happy~','我来啦','耶~','我扑','委屈','love','困了','前进','思考','肚子痛','love','困了','前进','思考','肚子痛','吃饭中','睡觉觉','化妆','变脸','什么','打针','忙','可怜的哭','坏笑','不耐烦','喝果汁','疯','怒视','很强大','傻呆呆','好主意','no','甩葱','脸红'];
NECtrl.Portrait._coboTips=
['不活啦','瞌睡','嘻！嘻！','斗虫虫','NO!NO!',
'Hi!','琢磨！琢磨！','撞墙','嘘！','嘻！嘻！',
'潜水中','偷笑','亲亲','再变','笑崩溃',
'我变','嘿哈','敬礼','推','好HAPPY哦',
'变','嘿嘿','来呀','陶醉','逗你',
'扭扭','翻过','得意','我飘','旋转快乐',
'左右扭','新年快乐','滚来滚去','放炮啦','恭喜发财',
'耶～','加油～','感冒了','别理我','吐舌头',
'我跳','看我的','北京欢迎你','看箭','中国加油',
'我顶','我跳','揍你','力气太大了吗','我劈',
'啷哩个啷','鲤鱼跳','熊式游法','我顶','汗。。。',
'我画圈圈','顶！！','同志们好～','被雷到','脑残',
'我戳我戳','已阅','得意','耶！','啊～～',
'臭屁','这里这里...','哦？','哼！','我来啦～','听音乐','看招！','哦','得得意意','啊 切','看招！','草裙舞','啦啦啦','啦啦啦','泪眼花花','看招！','啊～哈！','我！老大！','熊家拳！','嘘！小声点!','旋转快乐！','晕','琢磨','撞墙','找抽','豆豆','嘿哈','黄飞熊','降龙十八掌','觉觉','啊～切～～','美女','88','笑死我了','让我们集结吧！','装可爱','我来啦～','88','泪啊～','no no'];
NECtrl.Portrait._popTips=
['吃饭','晕','抓狂','喷血','哭','抽你','吐了','扫射','潜水','BIBI','KAO','抽烟','捏你','抱抱','汗','爽啊','我甩','舔你','哟西','去你的','我吐','回来','看你狂不','感动','喷水','你好棒','你……我倒','早','洗澡澡',' “鹿”过',
'开枪','蝙蝠侠','我“滚”呀“滚”','找我啥事','恰我一拳','抠鼻鼻','好困那','哼','拜托拉','好寒那','爆头','发飚啦','大笑',' 痴笑','大寒'];
NECtrl.Portrait._meakyTips=
['抽烟','鄙视','媒婆','大笑','困了','浪舞','凄凉','大哭','倒了','很馋','嘁~','膜拜','怒奔','自残'];
NECtrl.Portrait._wuzhiTips=
['火炬接力','石化','元气满点','俯卧撑','发呆','恐怖','蓝蓝路','不好意思','生日快乐','懒','无所谓','生病','星星眼','谢谢','偷窥','kiss','打飞','皮又痒了','鄙视你','砍死你','眼泪汪汪','挖鼻子','大笑','暴走','sm','orz','晕','色眯眯','咬住','不良','华丽登场','捏脸','吃面包','摇头晃脑','瞌睡','挠挠','怒','思考'];
NECtrl.Portrait._pegTips=
['困啦','嘿嘿...','喵～','气死我了','我爱漂漂','刷牙','真好吃','好呀','伤心','搅啊搅拌','我晕','寒～','吃瓜瓜','我爱大包','吸面功','可爱','奸笑','睡觉觉','发呆','胜利','委屈','该睡觉了','睏了','爱睡觉','晚安','爱猪猪'];
NECtrl.Portrait._frogleonTips=
['开心','伤心','惊恐','怒','疑惑',
'可爱','白眼','伤心','委屈','喜悦',
'痛苦','狂喜','庆祝','惊讶','贼笑',
'雀跃','咬牙切齿','不爽','胆小怕事','被扁',
'冷汗','可怜','吃惊','抓狂','无奈',
'惊喜','害怕','忐忑','发疯','感动'];
NECtrl.Portrait._zhuxiaoliangTips=['我飞～','跑路喽','快跑','跳舞','扮花花','扮苍蝇','中箭','哭给你看','电死你','出发','吃饭啦','好吃','飘过','泡咖啡','泡茶'];
NECtrl.Portrait._popommTips=[
'同意','怕怕','女侠','高兴','做面膜',
'杂耍','病了','困了','咳咳','生气',
'不要啊 ','撅嘴','嗯嗯','请安','为什么',
'怒','爱心','可爱'
];
NECtrl.Portrait._tips=
{"face":NECtrl.Portrait._faceTips,
"popo":NECtrl.Portrait._popoTips,
"west":NECtrl.Portrait._westTips,
"bear":NECtrl.Portrait._bearTips,
"tu":NECtrl.Portrait._tuTips,
"r":NECtrl.Portrait._rTips,
"g":NECtrl.Portrait._gTips,
"mayang":NECtrl.Portrait._mayangTips,
"nai":NECtrl.Portrait._naiTips,
"minimo":NECtrl.Portrait._minimoTips,
"mliho":NECtrl.Portrait._mlihoTips,
"liki":NECtrl.Portrait._likiTips,
"mx":NECtrl.Portrait._mxTips,
"xiayu":NECtrl.Portrait._xiayuTips,
"cobo":NECtrl.Portrait._coboTips,
"pop":NECtrl.Portrait._popTips,
"meaky":NECtrl.Portrait._meakyTips,
"wuzhi":NECtrl.Portrait._wuzhiTips,
"peg":NECtrl.Portrait._pegTips,
"frogleon":NECtrl.Portrait._frogleonTips,
"zhuxiaoliang":NECtrl.Portrait._zhuxiaoliangTips,
"popomm":NECtrl.Portrait._popommTips
};
NECtrl.Portrait._filePath="http://b.bst.126.net/style/common/htmlEditor/portrait/";
NECtrl.Portrait._row=6;
NECtrl.Portrait._col=10;
NECtrl.Portrait._navRow=8;
NECtrl.Portrait._navPageHeight=176;
NECtrl.Portrait._portraitPage=function(iSize,sName,sPath,iGrid,bNewly){
this.size=iSize;
this.name=sName;
this.path=sPath;
this.grid=iGrid;
this.newly=bNewly;
this.pageCount=Math.ceil(iSize/(NECtrl.Portrait._row/iGrid*NECtrl.Portrait._col/iGrid))-1;
};
NECtrl.Portrait._allCat={
"face":new NECtrl.Portrait._portraitPage(85,"泡泡","face",1),
"popo":new NECtrl.Portrait._portraitPage(121,"大泡泡","popo",1),
"west":new NECtrl.Portrait._portraitPage(104,"梦幻西游","west",1),
"bear":new NECtrl.Portrait._portraitPage(29,"蛋壳熊","bear",2),
"tu":new NECtrl.Portrait._portraitPage(133,"兔耳控","tu",2),
"r":new NECtrl.Portrait._portraitPage(81,"土豆仔","r",2),
"g":new NECtrl.Portrait._portraitPage(53,"绿头巾","g",2),
"mayang":new NECtrl.Portrait._portraitPage(39,"玛央猫","mayang",2),
"nai":new NECtrl.Portrait._portraitPage(135,"奶瓶仔","nai",2),
"minimo":new NECtrl.Portrait._portraitPage(45,"帽帽鼠","minimo",2),
"mliho":new NECtrl.Portrait._portraitPage(50,"唛哩轰","mliho",2),
"liki":new NECtrl.Portrait._portraitPage(26,"liki公主","liki",2),
"mx":new NECtrl.Portrait._portraitPage(60,"麦咪熊熊","mx",2),
"xiayu":new NECtrl.Portrait._portraitPage(34,"小夏","xiayu",2),
"cobo":new NECtrl.Portrait._portraitPage(105,"酷巴熊","cobo",2,true),
"pop":new NECtrl.Portrait._portraitPage(45,"炮炮兵","pop",2,true),
"meaky":new NECtrl.Portrait._portraitPage(14,"怪物熊猫","meaky",2),
"wuzhi":new NECtrl.Portrait._portraitPage(38,"无知熊猫","wuzhi",2),
"peg":new NECtrl.Portrait._portraitPage(15,"PEG","peg",2),
"frogleon":new NECtrl.Portrait._portraitPage(30,"绿豆蛙","frogleon",2),
"zhuxiaoliang":new NECtrl.Portrait._portraitPage(15,"猪小梁","zhuxiaoliang",2),
"popomm":new NECtrl.Portrait._portraitPage(18,"泡泡妹","popomm",2)
};
NECtrl.Portrait._allTypes=["face","popo","west","bear","tu","r","g","mayang","nai","minimo","mliho","liki","mx","xiayu","cobo","pop","meaky","wuzhi","peg","frogleon","zhuxiaoliang","popomm"];
NECtrl.Portrait.prototype={
initialize:function(sParentId,oHtmlEditor){
this._oOptions=Object.extend({
bNav:false,
sObjName:null,
fnGetPref:null,
fnAfterPortraitClick:null,
fnSetPref:null
},arguments[2]||{});
this._sParentId=sParentId;
this._oHtmlEditor=oHtmlEditor;
this._sStart="face";
this._current=new Object();
this._current.navPage=0;
this._current.type=this._sStart;
this._current.page=0;
this._sObjectName=this._oOptions.sObjName;
this._oPortraitDiv=null;
var _data={editorId:this._sParentId,isNav:this._oOptions.bNav,objName:this._sObjectName};
this._sPortraitHTML=NECtrl.Portrait._sPorJst.processUseCache(_data);
return this;
},
display:function(oPortraitDiv){
var _type=this._current.type;
if(this._oOptions.fnGetPref){
_type=this._oOptions.fnGetPref()||this._current.type;
}
var _page=this._current.page,_types=NECtrl.Portrait._allTypes;
oPortraitDiv.innerHTML=this._sPortraitHTML;
this._oPortraitDiv=oPortraitDiv;
this._oPortraitDiv.onclick=function(oEvent){
Event.stop(isIE?window.event:oEvent);
};
if(this._oOptions.bNav==true){
this._setNav();
}
this.go(_type);
for(var i=0;i<_page;i++)
this.portraitNextPage();
},
go:function(sType){
this._current.type=sType;
this._current.page=0;
this._change(sType);
},
clickNavPageup:function(){
if(this._current.navPage>0){
var _navs=$('navs'+this._sParentId),_style=_navs.style;
_style.top=parseInt(_style.top)+NECtrl.Portrait._navPageHeight+'px';
this._current.navPage--;
!(this._current.navPage)&&Element.addClassName('navPageup'+this._sParentId,'disabled');
Element.removeClassName('navPagedown'+this._sParentId,'disabled');
this.go(NECtrl.Portrait._allTypes[this._current.navPage*NECtrl.Portrait._navRow]);
}
},
clickNavPagedown:function(){
var _navPageCount=Math.floor(NECtrl.Portrait._allTypes.length/NECtrl.Portrait._navRow)+1;
if(this._current.navPage<_navPageCount-1){
var _navs=$('navs'+this._sParentId),_style=_navs.style;
_style.top=parseInt(_style.top)-NECtrl.Portrait._navPageHeight+'px';
this._current.navPage++;
if(this._current.navPage==_navPageCount-1)
Element.addClassName('navPagedown'+this._sParentId,'disabled');
Element.removeClassName('navPageup'+this._sParentId,'disabled');
this.go(NECtrl.Portrait._allTypes[this._current.navPage*NECtrl.Portrait._navRow]);
}
},
portraitMouseOvr:function(oPorPic,iNum,iGrid){
oPorPic.style.border='1px solid #000000';
var _oPreview=$("portraitPreview"+this._sParentId);
var row,col;
if(iGrid==1){
row=NECtrl.Portrait._row;
col=NECtrl.Portrait._col;
}else{
row=NECtrl.Portrait._row/2;
col=NECtrl.Portrait._col/2;
}
var _iCountStart=this._current.page*row*col;
_oPreview.innerHTML='<table style="table-layout:auto;width:60px;height:60px;border:solid #777777 1px;background-color:#ffffff"><tr valign=middle align=center><td><img src='+NECtrl.Portrait._filePath+this._current.type+"/preview/"+this._current.type+(_iCountStart+iNum)+'.gif></td></tr></table>';
var _pos=oPorPic.parentNode.cellIndex;
if(Math.round(_pos/col)){
_oPreview.style.left='4px';
_oPreview.style.right='';
}else{
if(this._oOptions.bNav==true){
_oPreview.style.right='69px';
}else{
_oPreview.style.right='7px';
}
_oPreview.style.left='';
}
_oPreview.style.top="5px";
_oPreview.style.display="block";
},
portraitMouseOut:function(oPorPic){
oPorPic.style.border='';
var _oPreview=$("portraitPreview"+this._sParentId);
_oPreview.style.display="none";
},
portraitClick:function(_element){
var sSrc=_element.attributes['source'].nodeValue;
if(sSrc!=null){
var index=sSrc.lastIndexOf("/");
var file=sSrc.substring(index);
sSrc=sSrc.replace(file,"/preview"+file);
this._oHtmlEditor.format("InsertImage",sSrc);
this._oHtmlEditor.hiddenAllMenu();
if(this._oOptions.fnAfterPortraitClick){
this._oOptions.fnAfterPortraitClick();
}
}
},
portraitNextPage:function(){
var _obj=this._getTypeObj(this._current.type);
if(this._current.page!=_obj.pageCount){
this._current.page++;
}
this._change(this._current.type);
$('portraitContent'+this._sParentId).className=this._current.type+this._current.page;
},
portraitPrePage:function(){
if(this._current.page!=0){
this._current.page--;
}
this._change(this._current.type);
$('portraitContent'+this._sParentId).className=this._current.type+this._current.page;
},
_setNav:function(){
var _temp=document.createElement('div');
var _iSize=NECtrl.Portrait._allTypes.length;
for(var i=0;i<_iSize;i++){
var _oNav=document.createElement('div');
var _sType=NECtrl.Portrait._allTypes[i];
_oNav.id=_sType+this._sParentId;
_oNav.className="navitem";
_temp.appendChild(_oNav);
}
var _navs=$('navs'+this._sParentId)
var _navPageCount=Math.floor(NECtrl.Portrait._allTypes.length/NECtrl.Portrait._navRow)+1,_page=this._current.navPage;
if(_page>=0){
var _style=_navs.style;
_style.top=parseInt(_style.top)-_page*NECtrl.Portrait._navPageHeight+'px';
if(_page==_navPageCount-1)
Element.addClassName('navPagedown'+this._sParentId,'disabled');
if(_page==0)
Element.addClassName('navPageup'+this._sParentId,'disabled');
}
_navs.appendChild(_temp);
},
_changeTag:function(sType){
var _iSize=NECtrl.Portrait._allTypes.length;
for(var i=0;i<_iSize;i++){
var _type=NECtrl.Portrait._allTypes[i];
var _oNav=$(_type+this._sParentId);
if(_type==sType){
Element.addClassName(_oNav,"mf_nowchose");
_oNav.innerHTML="&nbsp;"+NECtrl.Portrait._allCat[_type].name+(NECtrl.Portrait._allCat[_type].newly?'<span>新</span>':'');
Element.removeClassName('navPageup'+this._sParentId,'delbd');
Element.removeClassName('navPagedown'+this._sParentId,'delbd');
if(i%NECtrl.Portrait._navRow==0)
Element.addClassName('navPageup'+this._sParentId,'delbd');
else if((i+1)%NECtrl.Portrait._navRow==0)
Element.addClassName('navPagedown'+this._sParentId,'delbd');
}else{
_oNav.className="navitem";
_oNav.innerHTML='<a  href="#" onclick="'+this._sObjectName+'.go(\''+_type+'\'); return false;">'+NECtrl.Portrait._allCat[_type].name+(NECtrl.Portrait._allCat[_type].newly?'<span>新</span>':'')+'</a>';
}
}
if(this._oOptions.fnSetPref){
this._oOptions.fnSetPref(this._current.type);
}
},
_change:function(sType){
if(this._oOptions.bNav==true){
this._changeTag(sType);
}
this._fillPic(sType);
this._getPage(sType);
},
_getPage:function(sType){
var _oPage=$("portraitPage"+this._sParentId);
var obj=this._getTypeObj(sType);
_oPage.innerHTML=((this._current.page!=0)?'<a href="#" id="portraitPrePage'+this._sParentId+'" class="mf_link" onclick="'+this._sObjectName+'.portraitPrePage();return false;">上一页</a>':'<span style="color:#777777">上一页</span>')+
'&nbsp;<span style="color:#777777;">|</span>&nbsp;'+
((this._current.page!=obj.pageCount)?'<a href="#" class="mf_link" onclick="'+this._sObjectName+'.portraitNextPage();return false;">下一页</a>':'<span style="color:#777777">下一页</span>');
},
_fillPic:function(sType){
var _iCount=this._getCurrentPageCount(sType,this._current.page);
var row,col,borderLen;
if(NECtrl.Portrait._allCat[sType].grid==1){
row=NECtrl.Portrait._row;
col=NECtrl.Portrait._col;
borderLen=29;
}else{
row=NECtrl.Portrait._row/2;
col=NECtrl.Portrait._col/2;
borderLen=59;
}
var _iCountStart=this._current.page*row*col;
var _oContent=$("portraitContent"+this._sParentId);
var n=0;
for(var i=_oContent.rows.length-1;i>-1;i--){
_oContent.deleteRow(i);
}
for(var i=0;i<row;i++){
if(n==_iCount)break;
var tr=_oContent.insertRow(-1);
for(var j=0;j<col;j++){
if(n==_iCount){
if(_iCount<col){
for(var k=0;k<(col-_iCount);k++){
var emptyTd=tr.insertCell(-1);
emptyTd.cssText="height:"+borderLen+"px; width:"+borderLen+"px;";
}
}
break;
}
var _oTd=tr.insertCell(-1);
_oTd.style.cssText="height:"+borderLen+"px; width:"+borderLen+"px; text-align:center;";
_oTd.innerHTML='<div style=" width:'+(borderLen-2)+'px; height:'+(borderLen-2)+'px;text-align:center;" onmouseover="'+this._sObjectName+'.portraitMouseOvr(this,'+n+','+NECtrl.Portrait._allCat[sType].grid+')" onmouseout="'+this._sObjectName+'.portraitMouseOut(this)"><a href="#"><img src="http://b.bst.126.net/style/common/empty.gif" source="'+NECtrl.Portrait._filePath+sType+"/"+sType+(_iCountStart+n)+'.gif" width="'+(borderLen-4)+'" height="'+(borderLen-4)+'" title="'+NECtrl.Portrait._tips[sType][_iCountStart+n]+'" border="0" onclick="'+this._sObjectName+'.portraitClick(this);return false;"></a></div>';
n++;
}
}
_oContent.className=sType+'0';
},
_getCurrentPageCount:function(sType,iPage){
var size=NECtrl.Portrait._allCat[sType].size;
var pageCount=NECtrl.Portrait._allCat[sType].pageCount;
var row,col;
if(NECtrl.Portrait._allCat[sType].grid==1){
row=NECtrl.Portrait._row;
col=NECtrl.Portrait._col;
}else{
row=NECtrl.Portrait._row/2;
col=NECtrl.Portrait._col/2;
}
if(iPage==pageCount){
if(size%(row*col)==0)
return(row*col);
else
return size%(row*col);
}else{
return row*col;
}
},
_getTypeObj:function(sType){
return NECtrl.Portrait._allCat[sType];
}
}
NECtrl.Portrait._sPorJst=new String('\
 {if isNav == true}\
  <table style="width:374px;height:220px" border="0" cellpadding="0" cellspacing="0">\
 {else}\
  <table style="width:317px;height:220px" border="0" cellpadding="0" cellspacing="0">\
 {/if}\
 <tr>\
 <td valign="top" bgcolor="#e5e5e1" id="magicface${editorId}" style="width:308px;height:200px;border:1px solid #aaaaaa; border-right:none; padding:3px;">\
  <div style="height:182px;">\
   <table style="width:308px" border="0" cellspacing="1" cellpadding="0" id="portraitContent${editorId}"></table>\
  </div>\
  <div id="portraitPage${editorId}" class="mf_page"></div>\
 </td>\
 {if isNav == true}\
  <td style="width:64px" valign="top">\
  <div id="portraitNav${editorId}" class="portraitNav">\
  <a href="#" id="navPageup${editorId}" class="pgup" onclick="${objName}.clickNavPageup();return false;"><div class="pgupline"><div class="n_ f26">&nbsp;</div></div></a>\
  <div class="navs_con"><div id="navs${editorId}" class="navs" style="top:0px;"></div></div>\
  <a href="#" id="navPagedown${editorId}" class="pgdown" onclick="${objName}.clickNavPagedown();return false;"><div class="pgdownline"><div class="n_ f27">&nbsp;</div></div></a>\
  </div>\
  </td>\
 {else}\
  <td class="mf_leftBorder" style="height:200px;width:2px">&nbsp;</td>\
 {/if}\
 </tr>\
 </table>\
 <div id="portraitPreview${editorId}" style="position:absolute;z-index:200000;display:none"></div>');
var jst_global_simple_editor=new String('\
<div id="editorWrap${editorId}" class="edt_relt">\
 <input type="hidden" name="HEContent" id="HEContent${editorId}">\
 <div class="edt_relt">\
  <table border="0" class="nEdt ccEdt"><tr>\
      <td class="td0">&nbsp;</td>\
      <td class="td2"><div id="BoldBtn_s${editorId}" class="com" title="加粗"><div class="av_ bld i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div></td>\
      <td class="td2"><div id="ItalicBtn_s${editorId}" class="com" title="斜体"><div class="av_ Ita i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div></td>\
      <td class="td2"><div id="UnderlineBtn_s${editorId}" class="com" title="下划线"><div class="av_ udl i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div></td>\
   <td class="td2"><div id="PortraitBtn_s${editorId}" class="com" title="魔法表情"><div class="av_ fac i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div></td>\
   <td>&nbsp;</td>\
  </tr></table>\
 </div>\
 <div id="designEditorDiv${editorId}"></div>\
</div>\
');
var jst_global_simple_notoolbar_editor=new String('\
<div id="editorWrap${editorId}" class="edt_relt">\
 <input type="hidden" name="HEContent" id="HEContent${editorId}">\
 <div class="edt_relt" style="display:none">\
  <table border="0" class="nEdt ccEdt"><tr>\
      <td class="td0" style="width:2px;">&nbsp;</td>\
   <td class="td2"><div id="PortraitBtn_s${editorId}" class="com" title="魔法表情"><div class="av_ fac i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div></td>\
   <td>&nbsp;</td>\
  </tr></table>\
 </div>\
 <div id="designEditorDiv${editorId}"></div>\
</div>\
');
var jst_global_advanced_editor=new String('\
<div id="editorWrap${editorId}" class="edt_relt">\
 <input type="hidden" name="HEContent" id="HEContent${editorId}">\
    <div id="toolbar${editorId}" >\
  <div id="small_toolbar${editorId}" class="edt_relt" style="display:none;"></div>\
  <div id="big_toolbar${editorId}" class="edt_relt" style="display:none;zoom:1"></div>\
    </div>\
 <!--以下是编辑区-->\
 <div class="EdtPaper" id="editorDiv${editorId}" style="display:block">\
  <div class="pp shw">\
   <div class="t"></div>\
   <div class="wp">\
    <div class="uRule"><input id="title${editorId}" name="title" type="text" class="tt" maxlength="255" AUTOCOMPLETE="off"></div>\
    <div class="content" id="designEditorDiv${editorId}"></div>\
    <div class="bRule"></div>\
   </div>\
   <div class="b"></div>\
  </div>\
 </div>\
 <div id="sourceDiv${editorId}" style="display:none" class="sourEdt">\
  <textarea id="sourceEditor${editorId}" class="content" style="height:${height}px;"></textarea>\
 </div>\
</div>\
');
var jst_global_advanced_editor_smallToolbar=new String('\
<table border="0" class="nEdt ccEdt smlEdt"><tr>\
    <td class="td0">&nbsp;</td>\
 <td class="td2"><div id="BoldBtn_s${editorId}" class="com" title="加粗"><div class="av_ bld i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div></td>\
    <td class="td2"><div id="ItalicBtn_s${editorId}" class="com" title="斜体"><div class="av_ Ita i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div></td>\
    <td class="td2"><div id="UnderlineBtn_s${editorId}" class="com" title="下划线"><div class="av_ udl i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div></td>\
    <td class="td5 zhgh"><div class="edt_relt">\
     <div id="FontSizeBtn_s${editorId}" class="com"><div id="FontSizeValue_s${editorId}" class="txt">字号</div><div class="av_ arw l">&nbsp;</div></div>\
     <div id="FontSizeDiv_s${editorId}" class="ftsz" style="display:none;">\
   <a onclick="${objName}.setFontSize(2);return false;" href="#" class="n" style="font-size:x-small;">小</a>\
   <a onclick="${objName}.setFontSize(3);return false;" href="#" class="n" style="font-size:small;">标准</a>\
   <a onclick="${objName}.setFontSize(4);return false;" href="#" class="n" style="font-size:medium;">大</a>\
   <a onclick="${objName}.setFontSize(5);return false;" href="#" class="n" style="font-size:large;">特大</a>\
   <a onclick="${objName}.setFontSize(6);return false;" href="#" class="n" style="font-size:x-large;">极大</a>\
  </div>\
    </div></td>\
    <td class="td0">&nbsp;</div>\
    <td class="td2"><div class="edt_relt">\
     <div id="ForeColorBtn_s${editorId}" class="com" title="字体颜色"><div class="av_ fco i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div>\
  <div id="ForeColorDiv_s${editorId}" style="display:none;position:absolute;z-index:100000;background:#FFF;"></div>\
 </div></td>\
 <td class="td3" ><div class="av_ ssp i"><img  src="http://b.bst.126.net/style/common/empty.gif"/></div></td>\
 <td class="td2"><div id="LinkBtn_s${editorId}" class="com" title="超链接"><div class="av_ lnk i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div></td>\
 <td class="td2"><div class="edt_relt">\
     <div id="PortraitBtn_s${editorId}" class="com" title="魔法表情"><div class="av_ fac i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div>\
  <div id="PortraitDiv_s${editorId}"  class="edt_mgcf" style="display:none;"></div>\
 </div></td>\
 <td class="td2"><div id="ImageBtn_s${editorId}" class="com" title="添加图片" onclick="${objName}.addImg()"><div class="av_ sIm i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div></td>\
 <td class="td6"><div class="menu">\
  <span id="func_s${editorId}"><a onclick="${objName}.switchToolbar();return false;" href="#">全部功能</a>&nbsp;&nbsp;|&nbsp;&nbsp;</span><span><a onclick="${objName}.goPreview();return false;" href="#">预览</a></span>\
 </div></td>\
</tr></table>\
<div class="disbBar disbSml" id="toolbarCover_s${editorId}" style="display:none;"></div>\
');
var jst_global_advanced_editor_bigToolbar=new String('\
<table border="0" class="nEdt">\
  <tr class="top">\
    <td rowspan="2" class="td0">&nbsp;</td>\
    <td rowspan="2" class="td1"><div id="PasteBtn${editorId}" class="com" title="粘贴"><div class="av_ pst i"><img class="bpic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div></td>\
    <td class="td2"><div id="CutBtn${editorId}" class="com" title="剪切"><div class="av_ cut i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div></td>\
    <td rowspan="2" class="td3"><div class="av_ spl i"><img src="http://b.bst.126.net/style/common/empty.gif"/></div></td>\
    <td colspan="3" class="td4 zhgh"><div class="edt_relt">\
     <div class="com" id="FontNameBtn${editorId}"><div id="FontNameValue${editorId}" class="txt">字体</div><div class="av_ arw l">&nbsp;</div></div>\
     <div id="FontNameDiv${editorId}" class="ftna" style="display:none;">\
   <a onclick="${objName}.setFontName(\'宋体\');return false;" href="#" class="n" style="font-family: \'宋体\';">宋体</a>\
   <a onclick="${objName}.setFontName(\'黑体\');return false;" href="#" class="n" style="font-family: \'黑体\';">黑体</a>\
   <a onclick="${objName}.setFontName(\'楷体_GB2312\');return false;" href="#" class="n" style="font-family: \'楷体_GB2312\';">楷体</a>\
   <a onclick="${objName}.setFontName(\'隶书\');return false;" href="#" class="n" style="font-family: \'隶书\';">隶书</a>\
   <a onclick="${objName}.setFontName(\'幼圆\');return false;" href="#" class="n" style="font-family: \'幼圆\';">幼圆</a>\
   <a onclick="${objName}.setFontName(\'Arial\');return false;" href="#" class="n" style="font-family: \'Arial\';">Arial</a>\
   <a onclick="${objName}.setFontName(\'Arial Narrow\');return false;" href="#" class="n" style="font-family: \'Arial Narrow\';">Arial Narrow</a>\
   <a onclick="${objName}.setFontName(\'Arial Black\');return false;" href="#" class="n" style="font-family:\'Arial Black\';">Arial Black</a>\
   <a onclick="${objName}.setFontName(\'Comic Sans MS\');return false;" href="#" class="n" style="font-family: \'Comic Sans MS\';">Comic Sans MS</a>\
   <a onclick="${objName}.setFontName(\'Courier\');return false;" href="#" class="n" style="font-family: \'Courier\';">Courier</a>\
   <a onclick="${objName}.setFontName(\'System\');return false;" href="#" class="n" style="font-family: \'System\';">System</a>\
   <a onclick="${objName}.setFontName(\'Verdana\');return false;" href="#" class="n" style="font-family: \'Verdana\';">Verdana</a>\
  </div>\
    </div></td>\
    <td colspan="2" class="td5 zhgh"><div class="edt_relt">\
     <div id="FontSizeBtn${editorId}" class="com"><div id="FontSizeValue${editorId}" class="txt">字号</div><div class="av_ arw l">&nbsp;</div></div>\
     <div id="FontSizeDiv${editorId}" class="ftsz" style="display:none;">\
   <a onclick="${objName}.setFontSize(2);return false;" href="#" class="n" style="font-size:x-small;">小</a>\
   <a onclick="${objName}.setFontSize(3);return false;" href="#" class="n" style="font-size:small;">标准</a>\
   <a onclick="${objName}.setFontSize(4);return false;" href="#" class="n" style="font-size:medium;">大</a>\
   <a onclick="${objName}.setFontSize(5);return false;" href="#" class="n" style="font-size:large;">特大</a>\
   <a onclick="${objName}.setFontSize(6);return false;" href="#" class="n" style="font-size:x-large;">极大</a>\
  </div>\
    </div></td>\
    <td rowspan="2" class="td3"><div class="av_ spl i"><img src="http://b.bst.126.net/style/common/empty.gif"/></div></td>\
    <td class="td2"><div id="InsertOrderedListBtn${editorId}" class="com" title="数字列表"><div class="av_ olt i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div></td>\
    <td class="td2"><div id="InsertUnorderedListBtn${editorId}" class="com" title="符号列表"><div class="av_ ult i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div></td>\
    <td class="td2"><div id="IndentBtn${editorId}" class="com" title="增加缩进"><div class="av_ idt i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div></td>\
    <td class="td2"><div id="OutdentBtn${editorId}" class="com" title="减少缩进"><div class="av_ odt i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div></td>\
    <td rowspan="2" class="td3"><div class="av_ spl i"><img  src="http://b.bst.126.net/style/common/empty.gif"/></div></td>\
    <td rowspan="2" class="td1"><div id="ImageBtn${editorId}" class="com" title="添加图片" onclick="${objName}.addImg()"><div class="av_ ima i"><img class="bpic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div></td>\
    <td class="td2"><div id="TableBtn${editorId}" class="com" title="添加表格"><div class="av_ tbl i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div></td>\
    <td class="td2"><div id="LineBtn${editorId}" class="com" title="分隔线"><div class="av_ lne i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div></td>\
    <td class="td2"><div id="ClearFormatBtn${editorId}" class="com" title="清除格式"><div class="av_ fmt i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div></td>\
    <td rowspan="2" class="td3"><div class="av_ spl i"><img  src="http://b.bst.126.net/style/common/empty.gif"/></div></td>\
    <td>&nbsp;</td>\
    <td class="td6"><div class="menu">\
     <span id="func${editorId}"><a onclick="${objName}.switchToolbar();return false;" href="#">简单功能</a>&nbsp;&nbsp;|&nbsp;&nbsp;</span><span><a onclick="${objName}.goPreview();return false;" href="#">预览</a></span>\
    </div></td>\
  </tr>\
  <tr class="bottom">\
    <td class="td2"><div id="CopyBtn${editorId}" class="com" title="复制"><div class="av_ cpy i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div></td>\
    <td class="td2"><div id="BoldBtn${editorId}" class="com" title="加粗"><div class="av_ bld i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div></td>\
    <td class="td2"><div id="ItalicBtn${editorId}" class="com" title="斜体"><div class="av_ Ita i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div></td>\
    <td class="td2"><div id="UnderlineBtn${editorId}" class="com" title="下划线"><div class="av_ udl i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div></td>\
    <td class="td2"><div class="edt_relt">\
     <div id="ForeColorBtn${editorId}" class="com" title="字体颜色"><div class="av_ fco i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div>\
  <div id="ForeColorDiv${editorId}" style="display:none;position:absolute;z-index:100000;background:#FFF;"></div>\
 </div></td>\
    <td class="td2"><div class="edt_relt">\
     <div id="BackColorBtn${editorId}" class="com" title="背景颜色"><div class="av_ bco i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div>\
  <div id="BackColorDiv${editorId}"  style="display:none;position:absolute;z-index:100000;background:#FFF"></div>\
 </div></td>\
    <td class="td2"><div id="JustifyLeftBtn${editorId}" class="com" title="左对齐"><div class="av_ jtl i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div></td>\
    <td class="td2"><div id="JustifyCenterBtn${editorId}" class="com" title="居中对齐"><div class="av_ jtc i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div></td>\
    <td class="td2"><div id="JustifyRightBtn${editorId}" class="com" title="右对齐"><div class="av_ jtr i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div></td>\
    <td class="td2"><div id="ParagraphBtn${editorId}" class="com" title="段落化"><div class="av_ pra i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div></td>\
    <td class="td2"><div id="LinkBtn${editorId}" class="com" title="超链接"><div class="av_ lnk i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div></td>\
    <td class="td2"><div class="edt_relt">\
     <div id="PortraitBtn${editorId}" class="com" title="魔法表情"><div class="av_ fac i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div>\
  <div id="PortraitDiv${editorId}" class="edt_mgcf" style="display:none;"></div>\
 </div></td>\
    <td class="td2"><div id="MediaBtn${editorId}" class="com" title="插入多媒体"><div class="av_ mdi i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div></td>\
    <td class="td2"><div id="ShowCodeBtn${editorId}" class="com" title="显示HTML代码"><div class="av_ prv i"><img class="pic" src="http://b.bst.126.net/style/common/empty.gif"/></div></div></td>\
    <td>&nbsp;</td>\
  </tr>\
</table>\
<div class="disbBar" id="toolbarCover${editorId}" style="display:none;"></div>\
');
if(NetEase==undefined){
var NetEase={};
}
NetEase.CommentPublishAlbum=Class.create();
NetEase.CommentPublishAlbum.commentShowTemplate=null;
NetEase.CommentPublishAlbum.commentPubTemplate=null;
NetEase.CommentPublishAlbum.prototype={
initialize:function(oCommentArray,sParentId,iTotalCommentCount,sComShowElemId,sComPubElemId){
this._oOptions=Object.extend({
bCanClose:true,
bHasCancelBtn:false,
bNeedCheckLogin:false,
bNeedCheckRight:false,
bDefaultPubClose:false,
iAllowComment:0,
bSupportDeleteComment:false,
iPageSize:10,
iHostId:null,
sHostName:'匿名',
iVisitorId:null,
sVisitorName:'匿名',
sVisitorNickname:'匿名',
sVisitorAvatar:'',
sVisitorIP:'',
iEditorWidth:0,
iEditorHeight:286,
iEditorMaxLen:65535,
sLoginRedirect:'',
fnOpenCommentEffect:null,
fnAddComment:null,
oAddCommentParams:null,
fnAfterAddComment:null,
oAfterAddCommentParams:null,
fnDelComment:null,
oDelCommentParams:null,
fnAfterDelComment:null,
oAfterDelCommentParams:null,
fnMoreData:null,
fnCloseComments:null,
fnReportBad:null,
sObjName:null,
sUrlPrefix:'',
sCircleBaseUrl:'http://q.163.com',
fnCloseCommentDiv:null,
isHomeModule:false
},arguments[5]||{});
this._sParentId=sParentId;
this._sOrigParentId=sParentId;
this._oCommentArray=oCommentArray;
this._iTotalCommentCount=iTotalCommentCount;
this._sComShowElemId=sComShowElemId;
this._sCmPubElemId=sComPubElemId;
if(this._oOptions.iPageSize<=0)
this._oOptions.iPageSize=10;
this._bStatusNotLogin=false;
this._bStatusNoRight=false;
this._sDefaultVisitorAvatarUrl=Const.STDomain+'/style/common/stranger.gif';
this._iCurrPageIndex=1;
this._iTotalPageNumber=0;
this.htmleditor;
this._load();
return this;
},
_load:function(){
this._computePageNumber();
if(this._oOptions.bNeedCheckLogin){
if(UD.visitorRank<=-100){
this._bStatusNotLogin=true;
}else{
this._bStatusNotLogin=false;
}
}
if(this._oOptions.bNeedCheckRight){
if(UD.visitorRank>=this._oOptions.iAllowComment){
this._bStatusNoRight=false;
}else{
this._bStatusNoRight=true;
}
}
if(NetEase.CommentPublishAlbum.commentShowTemplate==null)
NetEase.CommentPublishAlbum.commentShowTemplate=createJSTAndParse("jst_global_comment_show",jst_global_comment_show);
if(NetEase.CommentPublishAlbum.commentPubTemplate==null)
NetEase.CommentPublishAlbum.commentPubTemplate=createJSTAndParse("jst_global_comment_pub",jst_global_comment_pub);
this.displayCommentArea();
},
reload:function(oCommentArray,sParentId,iTotalCommentCount,iAllowComment){
this._oCommentArray=oCommentArray;
if(!this._bStatusNoRight){
this.hideValidCodeImg(this._sOrigParentId);
this.htmleditor.emptyContent();
}
this._sParentId=sParentId;
this._oOptions.iAllowComment=iAllowComment;
this._iTotalCommentCount=iTotalCommentCount;
this._iCurrPageIndex=1;
this._computePageNumber();
this._setCommentShowArea();
Element.remove('comPubFix');
this._setCommentPubArea();
this._setHtmlEditor();
},
displayCommentArea:function(){
this._setCommentShowArea();
this._setCommentPubArea();
var disable=false;
if(this._bStatusNotLogin||this._bStatusNoRight)
disable=true;
if(!this._bStatusNoRight)
this._setHtmlEditor(disable);
if(this._oOptions.fnOpenCommentEffect!=null){
this._oOptions.fnOpenCommentEffect(this._sParentId,this._initEditor.bind(this));
}else{
if(this._oOptions.bDefaultPubClose==false){
this._blindDownComments(this._sCmPubElemId,this._initEditor.bind(this));
}
}
},
_blindDownComments:function(sElemId,fnInit){
var _oSucc={success:false};
$(sElemId).style.display="";
fnInit();
},
_setCommentShowArea:function(){
var _oData={coms:this._oCommentArray,parentId:this._sParentId,pageNum:this._iCurrPageIndex,totalPageNum:this._iTotalPageNumber,
comCount:this._iTotalCommentCount,canClose:this._oOptions.bCanClose,
containerObjName:this._oOptions.sObjName,noCommentRight:this._bStatusNoRight,
commentRange:this._oOptions.iPageSize,visitorAvatar:this._oOptions.sVisitorAvatar,defaultVisitorAvatarUrl:this._sDefaultVisitorAvatarUrl,
hostId:this._oOptions.iHostId,
visitorId:this._oOptions.iVisitorId,visitorName:this._oOptions.sVisitorName,hostName:this._oOptions.sHostName,
supportDeleteComment:this._oOptions.bSupportDeleteComment,prefix:this._oOptions.sUrlPrefix,
circleBaseUrl:this._oOptions.sCircleBaseUrl,isHomeModule:this._oOptions.isHomeModule};
var _sShowResult=NetEase.CommentPublishAlbum.commentShowTemplate.process(_oData);
var _oComShow=$(this._sComShowElemId);
if(Trim(_sShowResult)!=""){
_oComShow.innerHTML=_sShowResult;
_oComShow.style.display="";
}
else{
_oComShow.style.display="none";
}
},
_setCommentPubArea:function(){
var _bVisitorAvatarDefault=false;
if(this._oOptions.sVisitorAvatar.length<7||this._oOptions.sVisitorAvatar.substr(0,7)=="/style/"||this._oOptions.sVisitorAvatar=="-1000")
_bVisitorAvatarDefault=true;
var _sUserName;
if(this._oOptions.iVisitorId!=0)
_sUserName=this._oOptions.sVisitorNickname.replace(/[\u0000-\u001F]/g,'');
else
_sUserName="网易博友"+this._getLastIPPart(this._oOptions.sVisitorIP);
var _oData={parentId:this._sParentId,editorId:this._sParentId,hostId:this._oOptions.iHostId,
allowComment:this._oOptions.iAllowComment,needCheckLogin:this._oOptions.bNeedCheckLogin,needCheckRight:this._oOptions.bNeedCheckRight,
disabled:this._bStatusNotLogin||this._bStatusNoRight,notLogin:this._bStatusNotLogin,noCommentRight:this._bStatusNoRight,
canClose:this._oOptions.bCanClose,userName:_sUserName,
hasCancelBtn:this._oOptions.bHasCancelBtn,
containerObjName:this._oOptions.sObjName,fnOpenCommentEffect:this._oOptions.sLoginRedirect,
visitorAvatar:this._oOptions.sVisitorAvatar,hostName:this._oOptions.sHostName,visitorRank:UD.visitorRank,
visitorId:this._oOptions.iVisitorId,visitorName:this._oOptions.sVisitorName,visitorNickname:this._oOptions.sVisitorNickname,
editorMaxLen:this._oOptions.iEditorMaxLen,
defaultVisitorAvatarUrl:this._sDefaultVisitorAvatarUrl,visitorAvatarDefault:_bVisitorAvatarDefault,isHomeModule:this._oOptions.isHomeModule,isAudit:true};
var _sPubresult=jst_global_comment_pub.processUseCache(_oData);
$(this._sCmPubElemId).innerHTML=_sPubresult;
},
_setHtmlEditor:function(bDisable){
this.htmleditor=this._createAdvanceEditor();
if(UD.visitorRank<0){
if(!bDisable)
this._showValidCodeImg(this._sParentId);
}
},
_computePageNumber:function(){
this._iTotalPageNumber=parseInt(this._iTotalCommentCount/this._oOptions.iPageSize)+
((this._iTotalCommentCount%this._oOptions.iPageSize!=0)?1:0);
},
moveToPage:function(iPageIndex,noScroll){
if(this._oOptions.fnMoreData!=null){
if(iPageIndex<=0)
alert("页码不能小于等于0");
this._iCurrPageIndex=iPageIndex;
this._oOptions.fnMoreData(this._sParentId,this._oOptions.iPageSize,(iPageIndex-1)*this._oOptions.iPageSize,
this._postPageComment.bind(this));
if(noScroll==true){
Element.scrollTo("comShowHeader_"+this._sParentId);
}
}
},
_postPageComment:function(oCommentArray){
this._oCommentArray=oCommentArray;
this._setCommentShowArea();
},
closeComments:function(sParentId){
if(this._oOptions.fnCloseComments!=null){
this._oOptions.fnCloseComments(sParentId);
}
if(this._oOptions.fnCloseCommentDiv!=null){
this._oOptions.fnCloseCommentDiv(sParentId);
}
},
_disablePubBtn:function(sParentId,bDisable){
var _oPubbtn=$("$$_pubbtn"+sParentId);
if(bDisable){
_oPubbtn.disabled=true;
this._disabledFun=_oPubbtn.onclick;
_oPubbtn.onclick="";
}else{
if(this._disabledFun!=null)
_oPubbtn.onclick=this._disabledFun;
_oPubbtn.disabled=false;
this._disabledFun=null;
}
},
addComment:function(sParentId){
this._disablePubBtn(sParentId,true);
$("$$_comsubmithint"+sParentId)&&($("$$_comsubmithint"+sParentId).style.top="5px");
var _oUserName=$("username"+sParentId);
var _sUsrname=Trim(_oUserName.value);
if(_sUsrname==''){
UD.isAudit=true;
showInfo("$$_comsubmithint"+this._sParentId,UD.isAudit?"请输入姓名":"请输入昵称","info");
_oUserName.focus();
this._disablePubBtn(sParentId,false);
return false;
}
if(UD.visitorRank<=-100){
var _sValCode=$("valcode"+sParentId);
if(_sValCode==null){
showInfo("$$_comsubmithint"+this._sParentId,"请输入评论","info");
this._disablePubBtn(sParentId,false);
return false;
}else{
if($("valcode"+sParentId).value==""){
showInfo("$$_comsubmithint"+this._sParentId,"请输入验证码","info");
this._disablePubBtn(sParentId,false);
return false;
}else if($("valcode"+sParentId).value.length!=4){
showInfo("$$_comsubmithint"+this._sParentId,"验证码为4位","info");
this._disablePubBtn(sParentId,false);
return false;
}
}
}
var _sContent=this.htmleditor.getContent();
if(this.htmleditor.editor&&!this.htmleditor.editor.isFocused){
_sContent="";
}
if(isEmptyContent(_sContent)){
showInfo("$$_comsubmithint"+this._sParentId,"请输入评论","info");
this._disablePubBtn(sParentId,false);
return false;
}
if(this.htmleditor.IsExceedMaxLen()){
$("$$_comsubmithint"+sParentId)&&($("$$_comsubmithint"+sParentId).style.top="-53px");
showInfo("$$_comsubmithint"+this._sParentId,"输入内容超过最大字数"+this._oOptions.iEditorMaxLen+"，请重新编辑后提交","info");
this._disablePubBtn(sParentId,false);
return false;
}
if(this.sReplayData!=null){
_sContent=this.sReplayData+_sContent;
}
var _oNewComment=new Object();
_oNewComment.parentId=this._sParentId;
_oNewComment.publisherId=this._oOptions.iVisitorId;
_oNewComment.publisherName=this._oOptions.sVisitorName;
_oNewComment.content=_sContent;
_oNewComment.publishTime=new Date();
_oNewComment.publisherNickname=_oUserName.value;
_oNewComment.ip=this._oOptions.sVisitorIP;
var _oEmail=$("email"+sParentId);
var _sEmail="";
if(_oEmail){
_sEmail=Trim(_oEmail.value);
}
_oNewComment.publisherEmail=_sEmail;
_oNewComment.publisherUrl="";
_oNewComment.replyToUserId=this.sReplyToUserId;
_oNewComment.sReplyToUserName=this.sReplyToUserName;
_oNewComment.publisherAvatarUrl=this._oOptions.sVisitorAvatar;
if(this._oOptions.fnAddComment!=null){
if(this._oOptions.oAddCommentParams!=null){
this._oOptions.oAddCommentParams.valcodeid=sParentId;
}
this._oOptions.fnAddComment(_oNewComment,this._oOptions.oAddCommentParams,this._postAddComment.bind(this,sParentId));
}else{
this._disablePubBtn(sParentId,false);
}
},
_postAddComment:function(sParentId,oNewComment){
var errorType=0;
if(oNewComment!=null&&oNewComment.errorType>0){
errorType=oNewComment.errorType;
oNewComment=null;
}
if(UD.visitorRank<0){
if(oNewComment!=null){
this.hideValidCodeImg(sParentId);
}else{
this._genValidCodeImg(sParentId,false);
}
}
if(oNewComment==null){
if(errorType==0){
dwrlog('评论添加失败','error');
}
this._disablePubBtn(sParentId,false);
return;
}
if(oNewComment.spam>0){
alert("你在短时间内发布了过多的评论，评论受限。");
dwrlog('评论添加失败','error');
this._disablePubBtn(sParentId,false);
this.htmleditor.emptyContent();
return;
}
this.htmleditor.emptyContent();
this._iTotalCommentCount+=1;
this._computePageNumber();
if(this._iCurrPageIndex!=1){
this.moveToPage(1,false);
}
else{
var _oNewArray=[];
_oNewArray.push(oNewComment);
for(var i=0;i<this._oCommentArray.length;i++){
_oNewArray.push(this._oCommentArray[i]);
}
while(_oNewArray.length>this._oOptions.iPageSize){
_oNewArray.pop();
}
this._oCommentArray=_oNewArray;
this._setCommentShowArea();
}
this.sReplayData=null;
this.sReplyToUserId=null;
this.sReplyToUserName=null;
dwrlog('评论添加成功','ok');
this._disablePubBtn(sParentId,false);
if(this._oOptions.fnAfterAddComment!=null){
this._oOptions.fnAfterAddComment(oNewComment,this._oOptions.oAfterAddCommentParams);
}
},
_postAddRecommend:function(sParentId,oNewComment){
if(oNewComment.spam>0){
alert("你在短时间内发布了过多的评论，评论受限。");
dwrlog('评论添加失败','error');
this._disablePubBtn(sParentId,false);
this.htmleditor.emptyContent();
return;
}
this._iTotalCommentCount+=1;
this._computePageNumber();
if(this._iCurrPageIndex!=1){
this.moveToPage(1,false);
}
else{
var _oNewArray=[];
_oNewArray.push(oNewComment);
for(var i=0;i<this._oCommentArray.length;i++){
_oNewArray.push(this._oCommentArray[i]);
}
while(_oNewArray.length>this._oOptions.iPageSize){
_oNewArray.pop();
}
this._oCommentArray=_oNewArray;
this._setCommentShowArea();
}
this.sReplayData=null;
this.sReplyToUserId=null;
this.sReplyToUserName=null;
this._disablePubBtn(sParentId,false);
if(this._oOptions.fnAfterAddComment!=null){
this._oOptions.fnAfterAddComment(oNewComment,this._oOptions.oAfterAddCommentParams);
}
},
deleteComment:function(sCommentId){
if(this._oOptions.fnDelComment!=null){
this._oOptions.fnDelComment(sCommentId,this._oOptions.oDelCommentParams,this._postDelComment.bind(this));
}
},
_postDelComment:function(bSucc,sCommentId){
if(!bSucc)
return;
this._iTotalCommentCount-=1;
this._computePageNumber();
if(this._iCurrPageIndex>1&&this._oCommentArray.length<=1)
this._iCurrPageIndex--;
this.moveToPage(this._iCurrPageIndex,false);
dwrlog('评论删除成功','ok');
if(this._oOptions.fnAfterDelComment!=null){
this._oOptions.fnAfterDelComment(this._oOptions.oAfterDelCommentParams);
}
},
_initEditor:function(){
if(!this._bStatusNoRight){
var _oHtmlEditor=$("designEditor"+this._sParentId);
if(_oHtmlEditor!=null){
var _iWidth=$("designEditorDiv"+this._sParentId).offsetWidth;
if(_iWidth>0){
_oHtmlEditor.style.width=_iWidth+"px";
}
}
}
},
_refreshEditor:function(){
if(!this._bStatusNoRight){
var isDesignEditor=$("designEditor"+this._sParentId);
if(this.htmleditor!=null&&isDesignEditor){
var _oHtmlEditor=isDesignEditor;
if(_oHtmlEditor!=null){
_oHtmlEditor.style.width=0+"px";
$("editorWrap"+this._sParentId).style.width=0+"px";
var _iWidth=$("edt"+this._sParentId).offsetWidth;
if(_iWidth>0){
_oHtmlEditor.style.width=(_iWidth-2)+"px";
$("editorWrap"+this._sParentId).style.width=(_iWidth-3)+"px";
}
}
}else{
var _oPlainEditor=$("plainEditor"+this._sParentId);
if(_oPlainEditor!=null){
_oPlainEditor.style.width=0+"px";
var _iWidth=$("plainDiv"+this._sParentId).offsetWidth;
if(_iWidth>4){
_oPlainEditor.style.width=(_iWidth-4)+"px";
}
}
}
}
},
_getLastIPPart:function(sIP){
var _iIndex=sIP.lastIndexOf('.');
if(_iIndex>0)
return sIP.substr(_iIndex+1);
else
return"";
},
_showValidCodeImg:function(sParentId){
var _oPlaineditor=this.htmleditor.editor;
if(_oPlaineditor!=null){
if(isIE){
_oPlaineditor.attachEvent("onfocus",function(){
this._genValidCodeImg(sParentId,true);
}.bind(this));
}else{
_oPlaineditor.addEventListener("focus",function(){
this._genValidCodeImg(sParentId,true);
}.bind(this),false);
}
}
},
_genValidCodeImg:function(sParentId,bForce){
var _oCodeDiv=$("validCode"+sParentId);
if(bForce){
if(_oCodeDiv!=null&&_oCodeDiv.innerHTML==""){
_oCodeDiv.innerHTML=
'<label for="txtVC">验证码:&nbsp;</label><input type="text" class="bd01 g_f_focus g_c_input valid-input" value="" style="width:50px;" maxlength="4" id="valcode'+sParentId+'" />'+
'<img class="g_t_middle" style="margin-left:5px;" id="captchaimg${parentId}" alt="验证码" src="'+this._getCaptchaImgSrc(sParentId)+'" />';
_oCodeDiv.style.display="block";
}
}else{
if(_oCodeDiv!=null){
_oCodeDiv.innerHTML=
'<label for="txtVC">验证码:&nbsp;</label><input type="text" class="bd01 g_f_focus g_c_input valid-input" value="" style="width:50px;" maxlength="4" id="valcode'+sParentId+'" />'+
'<img class="g_t_middle" style="margin-left:5px;" id="captchaimg${parentId}" alt="验证码" src="'+this._getCaptchaImgSrc(sParentId)+'" />';
_oCodeDiv.style.display="block";
}
}
},
hideValidCodeImg:function(sParentId){
var _oCodeDiv=$("validCode"+sParentId);
if(_oCodeDiv!=null&&_oCodeDiv.innerHTML!=""){
_oCodeDiv.innerHTML="";
_oCodeDiv.style.display="none";
}
},
_getCaptchaImgSrc:function(sParentId){
var _iRandom=Math.floor(Math.random()*10001);
var _sId=(_iRandom+"_"+new Date().getTime()).toString();
var preUrl="/cap/captcha.jpgx?parentId=";
if(typeof window._$_is_in_album!='undefined'&&typeof UD!='undefined'&&UD.migStat==3){
preUrl="http://photo.163.com/photo/cap/captcha.jpgx?parentId=";
}
return preUrl+encodeURIComponent(sParentId)+"&"+_sId;
},
reply:function(sComId,bLogin,sName,vPara,sReplyToUserId,sReplyToUserName){
var sContent=$("comContent"+sComId).innerHTML;
var s=[];
s.push('<blockquote class="selitm bd01">');
if(bLogin){
s.push('<a class="c05" href="http://'+vPara+'/" target="_blank">'+sName.escapeHTML()+'</a><span class="c05 dot">：</span><br>');
}else{
s.push('<span class="c08">'+sName+'</span>');
if(vPara!=null&&vPara!=""){
vPara=Trim(vPara);
s.push('<span class="c09">('+vPara+')：</span><br>');
}else{
s.push('<span class="c08 dot">：</span><br>');
}
sReplyToUserId=null;
}
s.push('<span>'+sContent+'</span>');
s.push('</blockquote>');
this.sReplayData=s.join('');
this.sReplyToUserId=sReplyToUserId;
this.sReplyToUserName=sReplyToUserName;
new Effect.ScrollTo(this._sCmPubElemId);
this.htmleditor.focus();
},
_createAdvanceEditor:function(_afterLoadAdvanceEditor){
var _bFriend=false;
if(UD.visitorRank>=Const.Rank.Friend)
_bFriend=true;
this.htmleditor=new NECtrl.AdvancedEditor(this._sParentId,"edt"+this._sParentId,
{sEditorSrc:"/blank.html",iWidth:454,iHeight:this._oOptions.iEditorHeight,iMaxLen:this._oOptions.iEditorMaxLen,bSimpleEditor:true,bFriend:_bFriend,
sObjName:this._oOptions.sObjName+".htmleditor",bNewCommentEditor:true,fnAfterLoad:this._afterLoadAdvanceEditor.bind(this),
fnOnCommentFocus:this._fnOnCommentFocus.bind(this)});
return this.htmleditor;
},
_afterLoadAdvanceEditor:function(oParams){
var _emotion=$("_emotionDiv_"+this._sParentId);
if(_emotion&&$("PortraitBtn_s"+this._sParentId)){
_emotion.appendChild($("PortraitBtn_s"+this._sParentId));
_emotion.style.display="inline";
}
this._initEditor();
},
_fnOnCommentFocus:function(){
if(UD.visitorRank<0){
this._genValidCodeImg(this._sParentId,true);
}
}
}
