function check_event_quit(){if($('event_user_note').value.strip()==''){$('error_event_quit').innerHTML='请填写原因';}
else{$('event_user_quit_form').onsubmit();}}
function submit_ask_form(tp){$('search_tp').value=tp;$('search_ask_form').submit();}
function show_index_category_tags(id){Element.toggle('category_tags_'+id);if($('category_index_'+id).className=='c1'){$('category_index_'+id).className='c2';}
else{$('category_index_'+id).className='c1';}}
function show_fade_link(){new Marquee({element:"fade_link",data:[{message:"伸出母亲的手，玉树儿童捐助义卖活动",life:3,link:"/yushu"},{message:"注册妈妈晒 天天有惊喜！",life:3,link:"/activity/item8"},{message:"北京人民广播电台爱家频道《宝贝计划》",life:3,link:"/activity/item10"}]});}
function toggle_search(id){for(var i=1;i<4;i++){Element.hide('search_'+i);}
Element.show('search_'+id);}
function submit_search(){for(var i=1;i<4;i++){if($('search_tp_'+i).checked)
break;}
$('web_search_form'+i).submit();}
function show_today_time(){$('time_str').innerHTML=new Date().toLocaleString();setInterval("$('time_str').innerHTML=new Date().toLocaleString();",1000);$('time_week').innerHTML='星期'+'日一二三四五六'.charAt(new Date().getDay());}
function select_all_comments(all_check){var checkboxs=document.getElementsByClassName('form_checkbox');for(var i=0;i<checkboxs.length;i++){checkboxs[i].checked=all_check.checked;}}
function select_all_comments_form_link(id){all_check=$(id);all_check.checked=!all_check.checked;select_all_comments(all_check);}
function delete_comments(back_action){var comment_ids=new Array();var checkboxs=document.getElementsByClassName('form_checkbox');for(var i=0;i<checkboxs.length;i++){if(checkboxs[i].checked&&checkboxs[i].value!='checkbox'){comment_ids.push(checkboxs[i].value);}}
window.location='/home/delete_select_comments?back_action='+back_action+'&comment_ids='+comment_ids.join(',')}
function add_reply_to_comment(id,name){$('comment_content_'+id).value='回复@'+name+':';$('comment_content_'+id).focus();}
function select_send_gift(id){document.getElementsByClassName('picture current')[0].className='picture';$('send_gift_'+id).className='picture current'
$('gift_get_gift_id').value=id;}
function select_send_user(name){$('gift_get_user_name').value=name;scroll_to_gift_form();}
function scroll_to_gift_form(){$('gift_get_user_name').focus();$('gift_sent_title').scrollIntoView();}
function show_tab(id_pre,class_name,class_active,length,cursor){for(var i=1;i<=length;i++){$(id_pre+i).style.display="none";$(id_pre+i+'_t').className=class_name;}
$(id_pre+cursor).style.display="block";$(id_pre+cursor+'_t').className=class_active;}
var top_search_post_pmt="搜索话题、朋友...";var search_post_pmt="搜索关键字...";var dd_menu_tag_pmt="输入自定义话题";var search_text_post_pmt='输入关键字'
var video_pmt='请输入视频Flash网址(URL)'
function init_dd_menu_tag(){$('dd_menu_tag_name').onfocus=clear_dd_menu_tag_tip;$('dd_menu_tag_name').onblur=show_dd_menu_tag_tip;show_dd_menu_tag_tip();}
function clear_dd_menu_tag_tip(){clear_form_tip('dd_menu_tag_name',dd_menu_tag_pmt);}
function show_dd_menu_tag_tip(){show_form_tip('dd_menu_tag_name',dd_menu_tag_pmt);}
function init_search_post_form(){$('search_post_content').onfocus=clear_search_post_tip;$('search_post_content').onblur=show_search_post_tip;show_search_post_tip();}
function check_search_post_form(){clear_search_post_tip();return true;}
function clear_search_post_tip(){clear_form_tip('search_post_content',search_post_pmt);}
function show_search_post_tip(){show_form_tip('search_post_content',search_post_pmt);}
function init_top_search_post_form(){$('top_search_post_content').onfocus=clear_top_search_post_tip;$('top_search_post_content').onblur=show_top_search_post_tip;show_top_search_post_tip();}
function check_top_search_post_form(){clear_top_search_post_tip();return true;}
function clear_top_search_post_tip(){clear_form_tip('top_search_post_content',top_search_post_pmt);}
function show_top_search_post_tip(){show_form_tip('top_search_post_content',top_search_post_pmt);}
function init_search_text_post_form(){$('search_text_post_content').onfocus=clear_search_text_post_tip;$('search_text_post_content').onblur=show_search_text_post_tip;show_search_text_post_tip();}
function check_search_text_post_form(){clear_search_text_post_tip();return true;}
function clear_search_text_post_tip(){clear_form_tip('search_text_post_content',search_text_post_pmt);}
function show_search_text_post_tip(){show_form_tip('search_text_post_content',search_text_post_pmt);}
function clear_form_tip(id,pmt){if($(id).value==pmt){$(id).value="";}}
function show_form_tip(id,pmt){if(trim($(id).value)==""){$(id).value=pmt;}}
function insert_post_smiles(){if($('post_form_pic').style.display==""||($('post_form_video')&&$('post_form_video').style.display=="")){var otherIndex=Math.max(parseInt($('post_form_pic').style.zIndex),parseInt($('post_form_video')&&$('post_form_video').style.zIndex))||0;$('smiles_list').style.zIndex=parseInt(otherIndex)+1;}
else{$('smiles_list').style.zIndex=5;}
Element.toggle('smiles_list');}
function insert_post_logo(){if($('post_content')&&$('post_content').value==''){$('post_content').value='晒图片';}
Element.toggle('post_form_pic');if($('post_form_video'))
Element.hide('post_form_video');if($('smiles_list').style.display==""){var smileIndex=$('smiles_list').style.zIndex||0;$('post_form_pic').style.zIndex=parseInt(smileIndex)+1;}
else{$('post_form_pic').style.zIndex=5;}
if($('post_video_link'))
$('post_video_link').value='';}
function insert_post_video(){if($('post_content')&&$('post_content').value==''){$('post_content').value='晒视频';}
Element.toggle('post_form_video');Element.hide('post_form_pic');if($('smiles_list').style.display==""){var smileIndex=$('smiles_list').style.zIndex||0;$('post_form_video').style.zIndex=parseInt(smileIndex)+1;}
else{$('post_form_video').style.zIndex=5;}
$('post_logo').value='';$('post_video_link').value=video_pmt;}
function show_post_form_pmt(){fade_action_pmt('post_form_pmt',3);}
function fade_action_pmt(id,delay){new Effect.Fade(id,{delay:delay,duration:1,from:1,to:0});}
function check_post_form(){if(!check_content()){return false;}
if($("post_video_link").value==video_pmt)
$("post_video_link").value="";return true;}
function select_pmt_ignore_tag(){$('pmt_ignore_tag').value=(($('pmt_ignore_tag').value=='')?'1':'');}
function check_content(){try{var statusStr=$('post_content').value;if(!statusStr.strip()){alert("您没有输入晒品");return false;}
statusStr=trim(statusStr);var tag_name=statusStr.match(/\[(.+?)\]/);if(tag_name){if(tag_name[1]=='自定义话题'){alert('请输入自定义话题');return false;}
var len=getStringBytes(tag_name[1]);if(len<2){alert('自定义话题必须2个字以上');return false;}
if(('['+tag_name[1]+']')==statusStr){alert('请输入正文');return false;}}
return true;}
catch(e){}
return false;}
function check_video_url(){var videoUrl=$("post_video_link")&&$("post_video_link").value;if(videoUrl==""||videoUrl==video_pmt){$("post_video_link").value="";return true;}
else{videoUrl=(videoUrl||"").strip();var reFiveSix=new RegExp("^http://www.56.com/n_");var reQQ=new RegExp("(^http://static.video.qq.com/v1/res/qqplayerout.swf[?]{1}vid=)|(^^http://video.qq.com/v1/videopl)");var reSina=new RegExp("(^http://vhead.blog.sina.com.cn/player/)|(^http://p.you.video.sina.com.cn/)");var reTudou=new RegExp("(^http://www.tudou.com/v/)|(^http://www.tudou.com/l/)");var reYouku=new RegExp("(^http://player.youku.com/player.php/)|(^http://v.youku.com/v_show/)");var reYoutube=new RegExp("(^http://www.youtube.com/v/)|(^http://.*\.youtube\.com/watch[?]{1}v=)|(^http://youtube.com/watch[?]{1}v=)");var reku6=new RegExp("(^http://v.ku6.com/)|(^http://player.ku6.com/refer/)");if(reYouku.test(videoUrl)){if(isYoukuAddress(videoUrl)){var start=videoUrl.indexOf("id_",0);var end=videoUrl.indexOf(".html",0);var resl=videoUrl.substring(start+3,end);var resll=" http://player.youku.com/player.php/sid/"+resl+"/v.swf";$("post_video_link").value=resll;return true;}}
if(reku6.test(videoUrl)){if(isku6Address(videoUrl)){var start=videoUrl.indexOf("show/",0);var end=videoUrl.indexOf(".html",0);var resl=videoUrl.substring(start+5,end);var resll=" http://player.ku6.com/refer/"+resl+"/v.swf";$("post_video_link").value=resll;return true;}}
if(reFiveSix.test(videoUrl)||reQQ.test(videoUrl)||reSina.test(videoUrl)||reTudou.test(videoUrl)||reYouku.test(videoUrl)||reYoutube.test(videoUrl)||reku6.test(videoUrl)){return true;}
else{if(videoUrl.indexOf("http://www.56.com/")!=-1){alert("56网，请您贴上视频的flash地址,不是页面的地址。");}
else{alert("请输入视频flash地址，不是页面地址，支持视频来源:优酷、土豆、新浪、QQ、56网、酷6、Youtube");}
return false;}}}
function vvideo(obj){obj=document.getElementById(obj);var value=obj.value.strip();if(!value||value==video_pmt){alert("输入不能为空");obj.value="";return false;}
if(!/tudou|youku|sina|56|ku6/i.test(value)){alert("只能输入优酷、土豆、新浪、QQ、酷6、56上的视频");obj.value="";return false;};if(!/^http/i.test(value)||(!/\.swf/i.test(value)&&!/tudou/i.test(value))||(!/\.swf/i.test(value)&&!/www\.tudou\.com\/[lv]{1}/i.test(value))){alert("请输入视频flash地址，不是页面地址，支持视频来源:优酷、土豆、新浪、QQ、56网、酷6");obj.value="";return false;}
Element.hide('post_form_video');return true;}
function isYoukuAddress(s){var patrn=/v\.youku\.com\/v_show\/id_([^\.]*).html/;if(patrn.exec(s))
return true;return false}
function isku6Address(s){var patrn=/v\.ku6\.com\/show\/[a-zA-Z0-9,._!{}\?=&%#@;*:\+\-\|\/~$\^]*(\.html)/;if(patrn.exec(s))
return true;return false}
function IsURL(str_url){var re=new RegExp("^http:\/\/.{0,93}");if(re.test(str_url)){return(true);}
else{return(false);}
return true;}
function trim(str){var i=0;var len=str.length;if(str=="")
return(str);j=len-1;flagbegin=true;flagend=true;while(flagbegin==true&&i<len){if(str.charAt(i)==" "){i=i+1;flagbegin=true;}
else{flagbegin=false;}}
while(flagend==true&&j>=0){if(str.charAt(j)==" "){j=j-1;flagend=true;}
else{flagend=false;}}
if(i>j)
return("")
trimstr=str.substring(i,j+1);return trimstr;}
function select_hidden_tag_id(id,link,class_name){currents=document.getElementsByClassName(class_name+' current');if(currents.length>0){currents[0].className=class_name;}
$(class_name).value=id;link.className=class_name+' current';}
function show_custom_tags(){Element.show('custom_tags_layer');}
function hide_custom_tags(){Element.hide('custom_tags_layer');}
function select_custom_tags(){var tag_name='自定义话题';select_sys_tag('',$('custom_tags'));hide_custom_tags();$('post_content').value='['+tag_name+']'+$('post_content').value.replace(/\[(.+?)\]/,'');searchKeyWords(tag_name,$('post_content'));}
function insert_sys_tag(tag_id,tag_name,link){$('post_content').value='['+tag_name+']'+$('post_content').value.replace(/\[(.+?)\]/,'');select_sys_tag(tag_id,link);if($('custom_tags_layer').style.display!='none'){hide_custom_tags();}
if(tag_id==''){searchKeyWords(tag_name,$('post_content'));}}
function select_sys_tag(tag_id,link){currents=document.getElementsByClassName('sys_tag current');if(currents.length>0){currents[0].className='sys_tag';}
link.className='sys_tag current';$('post_tag_id').value=tag_id;}
function searchKeyWords(keyWord,txt){var str="";var found=false;if(str==""||(found&&str.indexOf(keyWord)<0)){str=txt.value;}
if(str.indexOf(keyWord)>=0){var index0=str.indexOf(keyWord);var index1=keyWord.length;if(Prototype.Browser.IE){var rng=txt.createTextRange();rng.collapse(true);rng.moveStart("character",index0);rng.moveEnd("character",index1);rng.select();str=str.replace(keyWord,String(Math.pow(10,index1)-1));found=true;}
else{txt.setSelectionRange(index0,index0+index1)}
txt.focus();}}
function show_big_post_logo(id){Element.hide('post_logo_'+id);Element.show('post_big_logo_'+id);}
function hide_big_post_logo(id){Element.show('post_logo_'+id);Element.hide('post_big_logo_'+id);}
var post_images={};function rotate_post_logo(id){post_images[id]=post_images[id]||{};post_images[id]._left=post_images[id]._left||0;post_images[id]._left++;rotate_picture(id,-90,null,450);}
function rotate_picture(id,angle,callback,maxWidth){var p=$('post_picture_'+id);p.angle=((p.angle==undefined?0:p.angle)+angle)%360;if(p.angle>=0){var rotation=Math.PI*p.angle/180}
else{var rotation=Math.PI*(360+p.angle)/180}
var costheta=Math.cos(rotation);var sintheta=Math.sin(rotation);if(document.all&&!window.opera){var imgID=id;var canvas=document.createElement("img");canvas.src=p.src;canvas.height=p.height;canvas.width=p.width;if(!post_images[imgID]._initWidth){post_images[imgID]._initWidth=canvas.width;post_images[imgID]._initHeight=canvas.height}
if(canvas.height>maxWidth+8){canvas._w1=canvas.width;canvas._h1=canvas.height;canvas.height=maxWidth-4;canvas.width=(canvas._w1*canvas.height)/canvas._h1}
canvas.style.filter="progid:DXImageTransform.Microsoft.Matrix(M11="+costheta+",M12="+(-sintheta)+",M21="+sintheta+",M22="+costheta+",SizingMethod='auto expand')";setTimeout(function(){var left=post_images[imgID]._left,right=post_images[imgID]._right;if(right%2==0||left%2==0||Math.abs(right-left)%2==0){canvas.width=post_images[imgID]._initWidth-4;canvas.height=post_images[imgID]._initHeight-4}
if((left===1&&!right)||(!left&&right===1)){post_images[imgID]._width=canvas.width;post_images[imgID]._height=canvas.height}
if(right>0&&left>0&&Math.abs(right-left)%2!=0){canvas.width=post_images[imgID]._width-4;canvas.height=post_images[imgID]._height-4}},0);}
else{var canvas=document.createElement("canvas");if(!p.oImage){canvas.oImage=p}
else{canvas.oImage=p.oImage}
canvas.style.width=canvas.width=Math.abs(costheta*canvas.oImage.width)+Math.abs(sintheta*canvas.oImage.height);canvas.style.height=canvas.height=Math.abs(costheta*canvas.oImage.height)+Math.abs(sintheta*canvas.oImage.width);if(canvas.width>maxWidth){canvas.style.width=maxWidth+"px"}
var context=canvas.getContext("2d");context.save();if(rotation<=Math.PI/2){context.translate(sintheta*canvas.oImage.height,0)}
else{if(rotation<=Math.PI){context.translate(canvas.width,-costheta*canvas.oImage.height)}
else{if(rotation<=1.5*Math.PI){context.translate(-costheta*canvas.oImage.width,canvas.height)}
else{context.translate(0,-sintheta*canvas.oImage.width)}}}
context.rotate(rotation);try{context.drawImage(canvas.oImage,0,0,canvas.oImage.width,canvas.oImage.height)}
catch(e){}
context.restore()}
canvas.id=p.id;canvas.angle=p.angle;p.parentNode.replaceChild(canvas,p);if(callback&&typeof callback==="function"){callback(canvas)}}
function show_logo_previews(){$(window).load(function(){var width=140;var x=($('#large_logo').width()-width)/2;var y=($('#large_logo').height()-width)/2;if(x<0||y<0){return;}
$('#large_logo').imgAreaSelect({minWidth:width,minHeight:width,aspectRatio:'1:1',x1:x,y1:y,x2:x+width,y2:y+width,handles:true,onSelectChange:logo_previews,onSelectBegin:logo_previews});});}
function show_kid_logo_previews(){$(window).load(function(){var width=140;var x=($('#large_logo').width()-width)/2;var y=($('#large_logo').height()-width)/2;if(x<0||y<0){return;}
$('#large_logo').imgAreaSelect({minWidth:width,minHeight:width,aspectRatio:'1:1',x1:x,y1:y,x2:x+width,y2:y+width,handles:true,onSelectChange:kid_logo_previews,onSelectBegin:kid_logo_previews});});}
function logo_previews(img,selection){show_preview(140,selection.width,selection.x1,selection.y1);show_preview(48,selection.width,selection.x1,selection.y1);show_preview(30,selection.width,selection.x1,selection.y1);}
function kid_logo_previews(img,selection){show_preview(140,selection.width,selection.x1,selection.y1);show_preview(75,selection.width,selection.x1,selection.y1);show_preview(30,selection.width,selection.x1,selection.y1);}
function show_preview(w,size,x,y){var scale=w/size;$('#logo'+w).css({width:Math.round(scale*$('#large_logo').width())+'px',height:Math.round(scale*$('#large_logo').height())+'px',marginLeft:'-'+Math.round(scale*x)+'px',marginTop:'-'+Math.round(scale*y)+'px'});$('input#logo_size').val(size);$('input#logo_left').val(x);$('input#logo_top').val(y);}
function show_page_picture_preview(width,height){$(window).load(function(){var t_width=width;var t_height=height;var m_width=$('#large_logo').width();var m_height=$('#large_logo').height();if(width>m_width){t_width=m_width;}
if(height>m_height){t_height=m_height;}
var x=(m_width-t_width)/2;var y=(m_height-t_height)/2;if(x<0||y<0){return;}
$('#large_logo').imgAreaSelect({minWidth:t_width,minHeight:t_height,x1:x,y1:y,x2:x+t_width,y2:y+t_height,aspectRatio:t_width+':'+t_height,handles:true,onSelectChange:show_picture_preview,onSelectBegin:show_picture_preview});});}
function show_picture_preview(img,selection){$('input#logo_width').val(selection.width);$('input#logo_height').val(selection.height);$('input#logo_left').val(selection.x1);$('input#logo_top').val(selection.y1);}
var copytoclip=1;function copy_to_clipboard(theField,isalert){var tempval=$(theField);if(navigator.appVersion.match(/\bMSIE\b/)){tempval.select();if(copytoclip==1){therange=tempval.createTextRange();therange.execCommand("Copy");if(isalert!=false)
alert("复制成功。现在您可以粘贴（Ctrl+v）这个地址发送给朋友。");}
return;}
else{alert("您使用的浏览器不支持此复制功能，请使用Ctrl+C或鼠标右键。");tempval.select();}}
function show_signup_kids(id){Element.hide('signup_kids_0');Element.hide('signup_kids_1');Element.hide('signup_kids_2');Element.hide('signup_kids_3');if(id==-1){Element.hide('signup_hide_age');}
else{Element.show('signup_kids_'+id);Element.show('signup_hide_age');}
if(id==1&&$('user_signup_kids_count').value>1){return;}
$('user_signup_kids_count').value=id;}
function show_signup_more_kids(id){Element.show('signup_kids_'+id);$('user_signup_kids_count').value=id;}
function hide_signup_more_kids(id){Element.hide('signup_kids_'+id);$('user_signup_kids_count').value=id-1;}
function show_kid_form(id){Element.show('user_kid_'+id);Element.hide('user_kid_'+id+'_button');Element.show('user_kids_button');}
function show_post_expand(action_name,post_id){var div_id='post_expand_'+post_id;if($(div_id).className==action_name){$(div_id).className='';Element.hide(div_id);}
else{new Ajax.Updater(div_id,'/ajax/'+action_name+'/'+post_id,{asynchronous:true,evalScripts:true});$(div_id).className=action_name;Element.show(div_id);}}
function add_favorite(url,text){if(document.all){window.external.addFavorite(url,text);}
else{if(window.sidebar){window.sidebar.addPanel(text,url,"");}}
return false;};function show_loadding(div,message){if(!message)
message='正在加载...'
$(div).innerHTML='<img src="/images/icons/load.gif"/><span class="load_pmt">'+message+'</span>';}
function trim(str){var i=0;var len=str.length;if(str=="")
return(str);j=len-1;flagbegin=true;flagend=true;while(flagbegin==true&&i<len){if(str.charAt(i)==" "){i=i+1;flagbegin=true;}
else{flagbegin=false;}}
while(flagend==true&&j>=0){if(str.charAt(j)==" "){j=j-1;flagend=true;}
else{flagend=false;}}
if(i>j)
return("")
trimstr=str.substring(i,j+1);return trimstr;}
function getStatusTextCharLengthMax(value){return 210;}
function getStringBytes(value){if(value==null)
return 0;var len=0;for(var i=0;i<value.length;i++){len++;}
return len;}
function updateStatusTextCharCounter(obj,text_pmt){var len_max=210;var charCountLeftIndicator=$(text_pmt);var len=getStringBytes(obj.value);var len_remain=len_max-len;charCountLeftIndicator.innerHTML=len_remain;if(len_remain>=20){charCountLeftIndicator.style.color="#D3821A";}
else{if(len_remain>=10){charCountLeftIndicator.style.color="#b30800";}
else{charCountLeftIndicator.style.color="red";}}
hideddrivetip();};function updateStatusTextCharCounter(obj,text_pmt){var len_max=210;var charCountLeftIndicator=$(text_pmt);var len=getStringBytes(obj.value);var len_remain=len_max-len;charCountLeftIndicator.innerHTML=len_remain;if(len_remain<0){charCountLeftIndicator.innerHTML=0-len_remain;charCountLeftIndicator.previousSibling.data="已超出";charCountLeftIndicator.parentNode.style.color="red";}else{charCountLeftIndicator.innerHTML=len_remain;charCountLeftIndicator.previousSibling.data="还可以输入";charCountLeftIndicator.parentNode.style.color="#008800";}
hideddrivetip();};function updateStatusTextContent(obj){updateTextContent(obj);obj.style.height=obj.scrollHeight+'px';}
function updateTextContent(obj){var len_max=210;var str=obj.value;var len=getStringBytes(str);if(len>len_max){obj.value=str.substr(0,len_max);}}
function init_platform_combos(){window.dhx_globalImgPath="/javascripts/combo/imgs/";}
function show_platform_combos(){dhtmlx.skin="mama_pink";var age=dhtmlXComboFromSelect("search_post_age_id");age.setSize(88);age.readonly(1);}
var offsetfromcursorX=12;var offsetfromcursorY=10;var offsetdivfrompointerX=10;var offsetdivfrompointerY=14;document.write('<div id="dhtmltooltip"></div>');document.write('<img id="dhtmlpointer" src="/images/icons/tip_arrow.gif">');var ie=document.all;var ns6=document.getElementById&&!document.all;var enabletip=false;if(ie||ns6)
var tipobj=document.all?document.all["dhtmltooltip"]:document.getElementById?document.getElementById("dhtmltooltip"):"";var pointerobj=document.all?document.all["dhtmlpointer"]:document.getElementById?document.getElementById("dhtmlpointer"):"";function ietruebody(){return(document.compatMode&&document.compatMode!="BackCompat")?document.documentElement:document.body;}
function ddrivetip(thetext,thewidth,thecolor){if(ns6||ie){if(typeof thewidth!="undefined")
tipobj.style.width=thewidth+"px";if(typeof thecolor!="undefined"&&thecolor!="")
tipobj.style.backgroundColor=thecolor;tipobj.innerHTML=thetext;enabletip=true;return false;}}
function positiontip(e){if(enable_dd_menu&&dd_menu_container!=''){Position.clone(dd_menu_container,dd_menu_obj,{setWidth:false,setHeight:false});var positionX=parseInt(dd_menu_obj.style.left);var positionY=parseInt(dd_menu_obj.style.top);dd_menu_obj.style.top=(positionY+22)+'px';var curX=(ns6)?e.pageX:event.clientX+ietruebody().scrollLeft;var curY=(ns6)?e.pageY:event.clientY+ietruebody().scrollTop;if(curX<positionX||curY<positionY||curX>(positionX+250)||curY>(positionY+250)){hide_dd_menu();return;}
dd_menu_obj.style.visibility="visible";}
if(enabletip){var nondefaultpos=false;var curX=(ns6)?e.pageX:event.clientX+ietruebody().scrollLeft;var curY=(ns6)?e.pageY:event.clientY+ietruebody().scrollTop;var winwidth=ie&&!window.opera?ietruebody().clientWidth:window.innerWidth-20;var winheight=ie&&!window.opera?ietruebody().clientHeight:window.innerHeight-20;var rightedge=ie&&!window.opera?winwidth-event.clientX-offsetfromcursorX:winwidth-e.clientX-offsetfromcursorX;var bottomedge=ie&&!window.opera?winheight-event.clientY-offsetfromcursorY:winheight-e.clientY-offsetfromcursorY;var leftedge=(offsetfromcursorX<0)?offsetfromcursorX*(-1):-1000;if(rightedge<tipobj.offsetWidth){tipobj.style.left=curX-tipobj.offsetWidth+"px";nondefaultpos=true;}
else
if(curX<leftedge)
tipobj.style.left="5px";else{tipobj.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px";pointerobj.style.left=curX+offsetfromcursorX+"px";}
if(bottomedge<tipobj.offsetHeight){tipobj.style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px";nondefaultpos=true;}
else{tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px";pointerobj.style.top=curY+offsetfromcursorY+"px";}
tipobj.style.visibility="visible";if(!nondefaultpos)
pointerobj.style.visibility="visible";else
pointerobj.style.visibility="hidden";}}
function hideddrivetip(){if(ns6||ie){enabletip=false;tipobj.style.visibility="hidden";pointerobj.style.visibility="hidden";tipobj.style.left="-1000px";tipobj.style.backgroundColor='';tipobj.style.width='';}}
var ddrivetips_array=['tip_follow_users','tip_fans_users','tip_my_posts','tip_toggle_question','tip_toggle_share','post_content','tip_post_logo','tip_post_video'];var is_init_tips=false;function show_ddrivetip(obj){if(!is_init_tips)
return;var id=obj.id;if(id=='tip_follow_users'){ddrivetip('我对哪些人感兴趣，可以直接关注她！无须得到对方确认，我就是她粉丝啦！可以及时看到她的晒品！');}
if(id=='tip_fans_users'){ddrivetip('哪些人对我感兴趣，可以关注我成为我的粉丝！这样，他们会及时看到我的晒品呢。每增加1个粉丝获1个积分。');}
if(id=='tip_my_posts'){ddrivetip('我晒出来的东东，关联的博客，发布的提问，都是我的晒品啦。关注我的人将及时分享它们：）');}
if(id=='tip_toggle_question'){ddrivetip('有一肚子疑问？来这里提问吧！悬赏积分，让其他有经验的妈妈爸爸快点帮帮我！回答有机会获得悬赏积分。');}
if(id=='tip_toggle_share'){ddrivetip('在输入框内写出我想晒的：晒宝贝晒经验自由晒？都可以！');}
if(id=='post_content'&&$('post_content').value==''&&!$('post_score')){ddrivetip('在输入框内写出我想晒的：晒宝贝晒经验自由晒？都可以！');}
if(id=='post_content'&&$('post_content').value==''&&$('post_score')){ddrivetip('有一肚子疑问？来这里提问吧！悬赏积分，让其他有经验的妈妈爸爸快点帮帮我！回答有机会获得悬赏积分。');}
if(id=='post_content'&&$('post_content').value==''&&$('spot_name')){ddrivetip('适宜孩子的地点：饮食？玩乐？出行？教育？晒出来，大家分享，大家受益！');}
if(id=='tip_post_logo'){ddrivetip('上传我喜欢的图片！支持jpg、jpeg、png、gif、bmp 格式，大小不超过5M');}
if(id=='tip_post_video'){ddrivetip('输入我发布于优酷、土豆、新浪、QQ、Youtube、酷6、56网的视频flash地址，即可插入视频！');}}
function init_ddrivetip(id){if($(id)){$(id).onmouseout=hideddrivetip;}}
document.onmousemove=positiontip;Event.observe(window,"load",function(){for(var i=0;i<ddrivetips_array.length;i++){init_ddrivetip(ddrivetips_array[i]);}
is_init_tips=true;});document.write('<ul id="dd_menu"></ul>');var enable_dd_menu=false;var dd_menu_container='';var dd_menu_id;if(ie||ns6)
var dd_menu_obj=document.all?document.all["dd_menu"]:document.getElementById?document.getElementById("dd_menu"):"";function dd_menu(obj,tp,id){if(ns6||ie){dd_menu_obj.innerHTML=$('dd_menu_'+tp+'_ids').innerHTML;if(tp=='tag'){dd_menu_obj.innerHTML+='<li class="submenu" onmouseover="this.className=\'submenu sfhover\';" onmouseout="this.className=\'submenu\';">'+'<a href="javascript:void(0)">[自定义]</a><ul id="tag_input"><li><input id="dd_menu_tag_name" class="name" value="" type="text"/></li>'+'<li class="button_search"><button class="button_submit_s" type="submit" onclick="dd_menu_create_tag()">确定</button></li></ul></li>';init_dd_menu_tag();}
enable_dd_menu=true;dd_menu_container=obj;dd_menu_id=id;return false;}}
function hide_dd_menu(){if(ns6||ie){enable_dd_menu=false;dd_menu_container='';dd_menu_obj.style.visibility="hidden";dd_menu_obj.style.left="-9999px";dd_menu_obj.style.backgroundColor='';dd_menu_obj.style.width='';}}
function dd_menu_update_age_id(age_id){hide_dd_menu();new Ajax.Updater('dd_menu_age_link_'+dd_menu_id,'/ajax/dd_menu_update_post/'+dd_menu_id,{asynchronous:true,evalScripts:true,parameters:"age_id="+age_id});}
function dd_menu_update_tag_id(tag_id){hide_dd_menu();new Ajax.Updater('dd_menu_tag_link_'+dd_menu_id,'/ajax/dd_menu_update_post/'+dd_menu_id,{asynchronous:true,evalScripts:true,parameters:"tag_id="+tag_id});}
function dd_menu_create_tag(){clear_dd_menu_tag_tip();var tag_name=$('dd_menu_tag_name').value;if(trim(tag_name)==''){alert('请输入自定义话题');return false;}
var len=getStringBytes(tag_name);if(len<2){alert('自定义话题必须2个字以上');return false;}
hide_dd_menu();new Ajax.Updater('dd_menu_tag_link_'+dd_menu_id,'/ajax/dd_menu_update_post/'+dd_menu_id,{asynchronous:true,evalScripts:true,parameters:"tag_name="+trim(tag_name)});}
function insert_face(insertStr){var obj=$('post_content');if(document.all){obj.focus();var range=document.selection.createRange();range.text=insertStr;}
else{if(obj.setSelectionRange){var rangeStart=obj.selectionStart;var rangeEnd=obj.selectionEnd;var temp1=obj.value.substring(0,rangeStart);var temp2=obj.value.substring(rangeEnd);obj.value=temp1+insertStr+temp2;}}
Element.hide('smiles_list');}
function init_upload_tools(book,uploadid,uploaduid){var upload;upload=new SWFUpload({upload_url:"/books/upload_pictures",post_params:{"book":book,"uploadid":uploadid,"uploaduid":uploaduid},file_size_limit:"5 MB",file_types:"*.jpg;*.png;*.gif;*.jpeg",file_types_description:"上传图片",file_upload_limit:"20",file_queue_limit:"0",file_dialog_start_handler:fileDialogStart,file_queued_handler:fileQueued,file_queue_error_handler:fileQueueError,file_dialog_complete_handler:complete_file_dialog_complete,upload_start_handler:uploadStart,upload_progress_handler:uploadProgress,upload_error_handler:uploadError,upload_success_handler:uploadSuccess,upload_complete_handler:uploadComplete,queue_complete_handler:complete_upload_page_pictures,button_image_url:"/javascripts/swfupload/button.png",button_placeholder_id:"spanButtonPlaceholder",button_width:101,button_height:22,flash_url:"/javascripts/swfupload/swfupload.swf",custom_settings:{progressTarget:"fsUploadProgress",cancelButtonId:"btnCancel"},debug:false});}
function complete_file_dialog_complete(files_num,files_queue_num){try{if(this.getStats().files_queued>0){document.getElementById(this.customSettings.cancelButtonId).disabled=false;}
if(files_queue_num+parseInt($('book_select_posts_count').innerHTML)>66){alert('对不起！目前宝贝图书最多只能制作66页！');}
else{this.startUpload();}}
catch(ex){this.debug(ex);}}
function complete_upload_page_pictures(){window.location='/books/import_confirm/'+$('user_book_id').value;}
function save_book_pages_sort(){var book_pages=document.getElementsByClassName('book_sort');var book_page_ids=new Array();for(var i=0;i<book_pages.length;i++){book_page_ids.push(book_pages[i].id);}
$('book_pages_sort').value=book_page_ids.join(',');$('book_pages_sort_form').submit();}
function init_book_pages_order(){Sortable.create('user_book',{tag:'li',only:'book_sort',constraint:false,handle:'handle'});}
function edit_page_text(id){Element.hide('page_content'+id);Element.show('page_text_area'+id);Element.hide('page_edit_button'+id);Element.show('page_save_button'+id);}
function cancel_page_text(id){Element.show('page_content'+id);Element.hide('page_text_area'+id);Element.show('page_edit_button'+id);Element.hide('page_save_button'+id);}
function save_page_text(id){$('page_text_form'+id).onsubmit();}
function select_rate_star(post_id,id){new Ajax.Updater('post_rate_view_'+post_id,'/ajax/select_rate_star/'+post_id+'?rate='+id,{asynchronous:true,evalScripts:true});}
function show_rate_star(post_id,id){var rate_star_words=['很差','较差','还行','推荐','力荐'];for(var i=1;i<=id;i++){$('rate_star_'+post_id+'_'+i).src='/images/event/sth.gif';}
$('rate_word_'+post_id).innerHTML=rate_star_words[id-1];}
function hide_rate_star(post_id,id){for(var i=1;i<=5;i++){$('rate_star_'+post_id+'_'+i).src='/images/event/nst.gif';}}
function select_req(c){var sc=document.getElementById(c);var selects=sc.getElementsByTagName("select");var errarr=[];for(var i=0,l=selects.length;i<l;i++){var select=selects[i];if(!select[select.selectedIndex].value){errarr.push(select);}}
if(errarr.length>0){Element.addClassName(sc,"error");TooltipManager.addTooltip(sc,"该项是必选项");return false;}
else{sc.onmouseout=sc.onmouseover=null;Element.removeClassName(sc,"error");return true;}}