/*
 * Chatbox menu item
 */

jGo.fcchat_toolbar.chatbox = {};

//Chatbox style template
jGo.fcchat_toolbar.chatbox.style={
	menu_item:{
		width:140,
		icon: FCChatConfig.dir + "current_skin/bubblechat.png",
		icon_css:"",
		text:jGo.fcchat_toolbar.style.toolbar_item.text,
		buttons:jGo.fcchat_toolbar.style.toolbar_item.buttons,
		padding_left:7,
		padding_top:jGo.fcchat_toolbar.style.toolbar_item.chatcenter_layout.info_box.padding_top
	},
	dialog_box:{
		width:(jGo.mobile?300:FCChatConfig.chatbox.dialog_width),
		height:343,
		background_color:"#fff",
		title_box_css:jGo.fcchat_toolbar.style.dialog_box.title_box_css,
		userlist_box_css:"top:40px;left:0px;height:40px;border-top:1px solid #cccccc;border-bottom:1px dotted #444444;-moz-overflow-scrolling: touch;-webkit-overflow-scrolling: touch;overflow-scrolling: touch;height:40px;border-top:1px solid #cccccc;border-bottom:1px dotted #444444;",
		tab_cover_css:"top: 52px;left:"+(jGo.mobile?245:FCChatConfig.chatbox.dialog_width-70)+"px;width:70px;height:60px;",
		up_tab_css:"top: 92px;left:"+(jGo.mobile?265:FCChatConfig.chatbox.dialog_width-50)+"px",
		down_tab_css:"top: 105px;left:"+(jGo.mobile?265:FCChatConfig.chatbox.dialog_width-50)+"px",
		view_msg_box_css:"top:82px;left:0px;height:200px;padding-top:4px;-moz-overflow-scrolling: touch;-webkit-overflow-scrolling: touch;overflow-scrolling: touch;",
		send_msg_box_css:"top:286px;left:0px;height:57px;border-top:1px dotted #444444;",
		input_css:"height:18px !important;background-color:white !important;border:1px solid #2E9FFF !important;color:#44444 !important;",
		text:jGo.fcchat_toolbar.style.dialog_box.text
	},
	infobox_menu:{
		position:{
			left:null,
			top:null,
			offsetLeft:-80,
			offsetTop:30
		},
		css:{
			width:"250px",
			height:"250px",
			"font-size":"12px",
			"-webkit-box-shadow": "1px 1px 3px 1px rgba(0,0,0,0.3)",
			"box-shadow": "0px 0px 3px 1px rgba(0,0,0,0.3)",
			"background-color":jGo.util.getCSSProp("jGo.fcchat_toolbar.style.dialog_box.css","background-color"),
			border:"1px solid gray"
		},
		menu_item:{
			max_title_length:300,
			hide_icon:{
				css:"color:#444444;font-stretch:wider;font-size:16px;font-weight:bold;text-decoration:none"
			}
		}
	}
};

(function(){var i=jGo.$;var j=jGo.config.max_z_index-100;var l;var m;var o=jGo.fcchat_toolbar.chatbox.style;var q="href='javascript:fc_chat.";var r=jGo.mobile;var t;var u="background-color:#aaaaaa";var v="float:right;margin-right:7px;"+o.dialog_box.text.link_css+";text-decoration:none;font-weight:bold;font-stretch:wider;";var w=o.dialog_box.text;var x=0;var y=0;var z;var A;var B="filter:alpha(opacity=60); -moz-opacity:.60; opacity:.60;";var C=B+";cursor:default";var D=0;function EN(a){var n=parseInt(a);return(n==null||isNaN(n)?0:n)};this.close_disc=function(){if(y){y=0;var a="00002z"+y;fc_chat.sendMsg(a,1)}};this.enable_disc=function(){};this.disable_disc=function(){i('div.fc_disc_button').html(P())};this.enable_disc_mobile=function(){i('span.fc_disc_button').html(Q())};this.disable_disc_mobile=function(){i('span.fc_disc_button').html(R())};this.click_tab=function(e){if(r||e.target.getAttribute('id')=='fc_disc_up'&&D==1||e.target.getAttribute('id')=='fc_disc_down'&&D==0){I()}};this.reset_disc=function(){i("#fc_page_chat").html(J());i("#fc_disc_userlist").html("")};var E=function(a){A=a;X();i(document.body).css("background-color",jGo.fcchat_toolbar.chatbox.style.dialog_box.background_color).append(i("#fc_page_discussion_dialog").css({"position":"absolute","top":"0px","left":"0px"}))};var F=function(k){if(i("#fc_page_discussion_dialog").css("display")=="none"){i('#fc_open_full_chat').html((FCChatConfig.chatcenter_layout==1&&window['fc_add_chatcenter_button']!=true?t(415,'Open MsgCenter'):t(416,'Open ChatCenter')));fc_chat.blog_exit_room();i('div.fc_disc_button').html(P());i("#fc_page_discussion_dialog").css("display","block");y=1;i(A).css("display","none")}else{i('#fc_open_full_chat').html((FCChatConfig.chatcenter_layout==1&&window['fc_add_chatcenter_button']!=true?t(475,'Close MsgCenter'):t(476,'Close ChatCenter')));i('div.fc_disc_button').html(O());i("#fc_page_discussion_dialog").css("display","none");y=0;i(A).css("display","block")}if(!k){fc_chat.tgl_disc();M()}};var G=function(){return y};var H=function(k,a){var b=FCChatConfig.chatbox.layout.mode;var c=k+'='+a+'px';if(!(b==1||(b==2&&o.dialog_box.width<FCChatConfig.chatbox.layout.auto_detect_width_transition))){i('#fc_disc_userlist_wrapper').css('height',c);i('#fc_tab_cover').css('top',c);i('#fc_disc_up').css('top',c);i('#fc_disc_down').css('top',c)}else{D=1;I()}i('#fc_page_discussion_dialog').css('height',c);i('#fc_send_page_chat').css('top',c);i('#fc_page_chat_wrapper').css('height',c);var e={};e.type='man_resize';fc_ex.mouseEvents(e)};var I=function(){var a=i('#fc_disc_userlist_wrapper');var b=i('#fc_page_chat_wrapper');var c=i('#fc_tab_cover');var d=i('#fc_disc_up');var e=i('#fc_disc_down');var f=a.height()+b.height()+2;var g=EN(a.css("top"));var h;if(D){a.css({height:"40px"});g=g+42;h=f-42;D=0}else{a.css({height:(f-42)+"px"});g=g+f-40;h=40;D=1}b.css({height:h+"px",top:g+"px"});c.css({top:(g-30)+"px"});d.css({top:(g-10)+"px"});e.css({top:(g+3)+"px"})};var J=function(){return"<div style='margin-bottom:2px' id='fc_disc_pghdr'><span style='"+w.info+"'>"+z.chatroom_text+"</span><span style='margin-left:10px;"+w.info+"' id='fc_disc_pg'></span></div>"+"<span id='fc_page_chat_loading' style='"+w.info+"'>"+t(120,'Loading Chat...Please Wait...')+"</span>"};var K=function(a){return'<a style="font-weight:bold;'+w.secondary_link_css+';text-decoration:none"'+'href="javascript:void" onclick="fc_chat.cDisc();return false">&laquo;&laquo; '+t(456,"More")+'</a>&nbsp;<span style="'+w.info+'">('+a+')</span>'};jGo._['menu.pg_info']=function(a,s,b){s=i.extend(true,{},jGo.fcchat_toolbar.chatbox.style.infobox_menu);var c=a.createWidget('DefaultMenu',[s,L(),null,i(b),p=i(document.body),(a.getexp6()||(r)?0:1),r]);return c};var L=function(){var a=t(464,'Not Specified');var b=FCChatConfig.blog?window.parent.document.title:document.title;if(b>o.infobox_menu.menu_item.max_title_length){b=b.substring(0,o.infobox_menu.menu_item.max_title_length)+'...'}if(!z.use_page_title||b==''){b=a}if(z.topic){b=z.topic}var c="<b>"+t(465,'Description')+":</b> "+a;if(z.desc){c=z.desc}return"<div style='padding:15px'>"+"<span style='"+w.info+"'><b>"+t(466,'Topic')+":</b> "+b+"<br><br>"+c+"</span></div>"};var M=function(){var a="00002z"+y;fc_chat.sendMsg(a,1)};var N=function(){return"<span class='fc_disc_count fc_info_text' style='"+o.menu_item.text.info_css+"'>("+fc_chat.discC+")</span>"};var O=function(){return"<a style='text-decoration:none;' href='javascript:jGo.fcchat_toolbar.chatbox.toggle_blogchat()'>"+(o.menu_item.icon!=''?"<img style='display:block;position:absolute;top:"+(jGo.fcchat_toolbar.style.icons_16px.top)+"px; left: "+o.menu_item.padding_left+"px;width:16px;height:16px;"+o.menu_item.icon_css+"' src='"+o.menu_item.icon+"'>":"")+"<div id='jGo_disc_txt_inner' style='position:absolute;top:0px;left:"+(o.menu_item.icon!=''?24:10)+"px;width:"+(o.menu_item.width-(o.menu_item.icon!=''?28:7))+"px;padding-top:"+(o.menu_item.padding_top+fc_chat.get_ie_offset())+"px;"+jGo.fcchat_toolbar.style.text+";"+o.menu_item.buttons.states.link_css+";'>"+(FCChatConfig.blog&&r&&jGo.blogdim.width<400?'':z.button_text)+" "+N()+"</div>"+"</a>"};var P=function(){return"<a style='text-decoration:none;cursor:default;' href='javascript:void(0)'>"+(o.menu_item.icon!=''?"<img style='display:block;position:absolute;top:"+(jGo.fcchat_toolbar.style.icons_16px.top)+"px; left: "+o.menu_item.padding_left+"px;width:16px;height:16px;"+o.menu_item.icon_css+"' src='"+o.menu_item.icon+"'>":"")+"<div id='jGo_disc_txt_inner' style='position:absolute;top:0px;left:"+(o.menu_item.icon!=''?24:10)+"px;width:"+(o.menu_item.width-(o.menu_item.icon!=''?28:7))+"px;padding-top:"+(o.menu_item.padding_top+fc_chat.get_ie_offset())+"px;"+jGo.fcchat_toolbar.style.text+";"+o.menu_item.buttons.states.disabled_css+";'>"+(FCChatConfig.blog&&r&&jGo.blogdim.width<400?'':z.button_text)+" "+N()+"</div>"+"</a>"};var Q=function(){return"<a style='text-decoration:none;' href='javascript:jGo.fcchat_toolbar.chatbox.tgl_dialog()'>"+(o.menu_item.icon!=''?"<img style='width:16px;height:16px;"+o.menu_item.icon_css+"' src='"+o.menu_item.icon+"'>":"")+"&nbsp;&nbsp;<span id='jGo_disc_txt_inner' style='"+jGo.fcchat_toolbar.style.text+";"+o.menu_item.buttons.states.link_css+";'>"+(FCChatConfig.blog&&r&&jGo.blogdim.width<400?'':z.button_text)+" "+N()+"</span>"+"</a>"};var R=function(){return"<a style='text-decoration:none;cursor:default;' href='javascript:void(0)'>"+(o.menu_item.icon!=''?"<img style='width:16px;height:16px;"+o.menu_item.icon_css+"' src='"+o.menu_item.icon+"'>":"")+"&nbsp;&nbsp;<span id='jGo_disc_txt_inner' style='"+jGo.fcchat_toolbar.style.text+";"+o.menu_item.buttons.states.disabled_css+";'>"+(FCChatConfig.blog&&r&&jGo.blogdim.width<400?'':z.button_text)+" "+N()+"</span>"+"</a>"};var S=function(a,k){if(!FCChatConfig.blog){jGo.hooks.addHook(a+'_close_dialogs','close_disc',this,'close_disc')}jGo.hooks.addHook('fcchat_enable_toolbar_fn','enable_toolbar_disc',this,'enable_disc'+(k?'_mobile':''));jGo.hooks.addHook('fcchat_disable_toolbar_fn','disable_toolbar_disc',this,'disable_disc'+(k?'_mobile':''));jGo.hooks.addHook('fcchat_reset_vars','reset_disc_chat',this,'reset_disc');t=fc_chat.textSetter;l=FCChatConfig.dir;z=fc_chat.chat_params;m=l+"current_skin/";o.dialog_box.width=fc_chat.chat_window_width;o.dialog_box.height=fc_chat.chat_window_height;var b=FCChatConfig.chatbox.layout.mode;if(b==1||(b==2&&o.dialog_box.width<FCChatConfig.chatbox.layout.auto_detect_width_transition)){o.dialog_box.userlist_box_css+="height:80px;width:"+o.dialog_box.width+"px;";o.dialog_box.view_msg_box_css+="top:122px;left:0px;height:"+(o.dialog_box.height-183)+"px;";o.dialog_box.send_msg_box_css+="top:"+(o.dialog_box.height-57)+"px;";o.dialog_box.input_css+=";width:"+(o.dialog_box.width-(r?30:20))+"px !important";o.dialog_box.tab_cover_css="top: 92px;left:"+(o.dialog_box.width-(jGo.mobile?60:70))+"px;";o.dialog_box.up_tab_css="top: 112px;left:"+(o.dialog_box.width-(jGo.mobile?40:50))+"px";o.dialog_box.down_tab_css="top: 125px;left:"+(o.dialog_box.width-(jGo.mobile?40:50))+"px"}else{o.dialog_box.userlist_box_css+=";border-bottom:0px dotted #444444;border-left:1px dotted #444444;width:250px;left:"+(o.dialog_box.width-250)+"px;height:"+(o.dialog_box.height-40)+"px;";o.dialog_box.view_msg_box_css+="top:41px;left:0px;width:"+(o.dialog_box.width-250)+"px;height:"+(o.dialog_box.height-101)+"px;";o.dialog_box.send_msg_box_css+=";width:"+(o.dialog_box.width-250)+"px;top:"+(o.dialog_box.height-57)+"px;";o.dialog_box.input_css+=";width:"+(o.dialog_box.width-250-(r?30:20))+"px !important";o.dialog_box.tab_cover_css="display:none;top: 92px;left:"+(o.dialog_box.width-(jGo.mobile?60:70))+"px;";o.dialog_box.up_tab_css="display:none;top: 112px;left:"+(o.dialog_box.width-(jGo.mobile?40:50))+"px";o.dialog_box.down_tab_css="display:none;top: 125px;left:"+(o.dialog_box.width-(jGo.mobile?40:50))+"px"}};jGo.fcchat_toolbar.chatbox.create=function(a){S(a);return T()};jGo.fcchat_toolbar.chatbox.create_mobile_layout=function(a){S(a,1);return R()};jGo.fcchat_toolbar.chatbox.create_dialogs=function(){return U()};jGo.fcchat_toolbar.chatbox.append_dialogs=function(a){return W(a)};jGo.fcchat_toolbar.chatbox.tgl_dialog=function(){return X()};jGo.fcchat_toolbar.chatbox.set_more_msgs=function(a){return K(a)};jGo.fcchat_toolbar.chatbox.open_blogchat=function(a){return E(a)};jGo.fcchat_toolbar.chatbox.toggle_blogchat=function(k){return F(k)};jGo.fcchat_toolbar.chatbox.get_toggle=function(){return G()};jGo.fcchat_toolbar.chatbox.move_iframe=function(k,a){return H(k,a)};var T=function(){return"<div class='fc_disc_button' style='position: absolute;width:"+o.menu_item.width+"px;top:0px;left:0px;'>"+P()+"</div>"};var U=function(){dialog="<div class='jGo_app jGo_myapp jGo_em "+(FCChatConfig.blog?"":"jgo_dialog")+"' id='fc_page_discussion_dialog' style='position:absolute;display: none;visibility: visible;background-color:transparent;text-align:left;height:"+o.dialog_box.height+"px;width:"+o.dialog_box.width+"px;top: 0px; left:0px; z-index:"+(FCChatConfig.blog?0:j)+";overflow:hidden;'>"+"</div>";return dialog};var V=function(){if(x==0){var a="<div id='fc_page_disc_title' style='position:absolute;width:"+o.dialog_box.width+"px;"+o.dialog_box.title_box_css+";overflow:hidden'><div style='padding:7px;'><span style='"+o.dialog_box.text.title_css+"'>"+(z.title_text)+"</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+"<a style='"+o.dialog_box.text.link_css+"' HREF='javascript:void(0)' onclick=\"return fc_chat.toggleMenu(this,"+fc_chat.uid+",'pg_info');\">"+t(467,'Info')+"</a>&nbsp;&nbsp;&nbsp;"+"<a style='"+o.dialog_box.text.link_css+"' HREF='javascript:void' id='fc_bc_options' class='fc_options_a' onClick='fc_chat.tgl_options();return false'><img align=absmiddle src='"+m+"gear_button.png'></a>&nbsp;&nbsp;&nbsp;"+"<a style='"+o.dialog_box.text.link_css+"' "+q+"clr_disc()'>"+t(273,'Clear')+"</a>&nbsp;&nbsp;&nbsp;"+"<a style='"+o.dialog_box.text.link_css+"' "+(fc_chat.ociw?"onclick='fc_chat.openPopup();' target=_blank href='"+fc_chat.full_page_url+"'>":"HREF='javascript:void(0)' onclick=\"jGo.fcchat_toolbar.chatbox.toggle_blogchat();\">")+(FCChatConfig.chatcenter_layout==1&&window['fc_add_chatcenter_button']!=true?t(388,'MsgCenter'):t(151,'ChatCenter'))+"</a>&nbsp;&nbsp;&nbsp;"+(FCChatConfig.chatbox.resize.enable?"<a style='"+o.dialog_box.text.link_css+"' onClick='fc_chat.resize_blogchat(\"+\");return false'><img align=absmiddle src='"+m+"arrow-shift-down.png'></a>&nbsp;&nbsp;&nbsp;"+"<a style='"+o.dialog_box.text.link_css+"' onClick='fc_chat.resize_blogchat(\"-\");return false'><img align=absmiddle src='"+m+"arrow-shift-up.png'></a>":"")+"</div></div>"+"<div id='fc_disc_userlist_wrapper' style='position:absolute;"+o.dialog_box.userlist_box_css+";overflow:auto'><div id='fc_disc_userlist' style='padding:3px;overflow:auto;overflow-x:hidden;"+o.dialog_box.text.css+"'>"+"</div></div>"+"<div id='fc_tab_cover' style='position: absolute;"+o.dialog_box.tab_cover_css+";'></div>"+"<div id='fc_disc_up' class='fc_drag_disc' style='position: absolute;"+o.dialog_box.up_tab_css+";background-image: url("+m+"chatelems1.gif); background-repeat: no-repeat; FONT-SIZE: 1pt; width: 15px; height:7px; background-position: -99px -137px;cursor:pointer;'></div>"+"<div class='fc_d8' id='fc_page_chat_wrapper' style='position:absolute;width:"+o.dialog_box.width+"px;"+o.dialog_box.view_msg_box_css+"overflow:auto'><div id='fc_page_chat' style='padding:3px;overflow:auto;line-height:1'>"+J()+"</div></div>"+"<div id='fc_disc_down' class='fc_drag_disc' style='position: absolute;"+o.dialog_box.down_tab_css+";;background-image: url("+m+"chatelems1.gif); background-repeat: no-repeat; FONT-SIZE: 1pt; width: 15px; height:7px; background-position: -119px -137px;cursor:pointer;'></div>"+"<div id='fc_send_page_chat' style='position:absolute;width:"+o.dialog_box.width+"px;"+o.dialog_box.send_msg_box_css+";overflow:hidden'>"+"<div style='height:16px;padding:6px'>"+(z.topic_closed||z.lock_all_discussions?"<span style='font-wieght:bold;"+o.dialog_box.text.info+"'>"+t(468,'This chat topic is closed')+"</span>":"<a id='fc_bld' style='margin-left:1px' href=\"javascript:fc_chat.insertTags(\'"+t(37)+"\',\'"+t(37)+"\',\' "+t(23)+" \',4);\" border=0>"+"<img title='"+t(23)+"' style='"+u+"' id='fc_e_bld' src='"+m+"text_bold.png'>"+"</a>"+"<a id='fc_it' style='margin-left:1px' href=\"javascript:fc_chat.insertTags(\'"+t(38)+"\',\'"+t(38)+"\',\' "+t(24)+" \',4);\" border=0>"+"<img title='"+t(24)+"' style='"+u+"' id='fc_e_it' src='"+m+"text_italic.png'>"+"</a>"+"<a id='fc_uln' style='margin-left:1px' href=\"javascript:fc_chat.insertTags(\'"+t(39)+"\',\'"+t(39)+"\',\' "+t(25)+" \',4);\" border=0>"+"<img title='"+t(25)+"' style='"+u+"' id='fc_e_uln' src='"+m+"text_underline.png'>"+"</a>"+"<a id='fc_img' style='margin-left:2px' href=\"javascript:fc_chat.insertTags(\'[[\',\']]\',\'"+t(36)+"\',4);\" border=0>"+"<img title='"+t(26)+"' id='fc_e_img' src='"+m+"image_1.png'>"+"</a>"+"<a class='fc_tools_a' style='margin-left:2px' href=\"javascript:fc_chat.tgl_tools(0,"+FCChatConfig.styles.chat_window.main_panel.tools_panel.smileys.width+","+FCChatConfig.styles.chat_window.main_panel.tools_panel.smileys.height+",4)\">"+"<img id='fc_e_sml3' src='"+m+"emoticon_smile.png'>"+"</a>"+(FCChatConfig.upload_images_enabled?"<a id='fc_imgu' style='margin-left:2px;' href=\"javascript:fc_chat.launch_uploads();\">"+"<img title='"+t(27)+"'src='"+m+"upload_image.png'>"+"</a>":"")+(FCChatConfig.change_avatar?"<a id='fc_avu' style='margin-left:2px;' href=\"javascript:fc_chat.launch_avatar();\">"+"<img title='"+t(29)+"'src='"+m+"add_avatar.png'>"+"</a>":"")+(FCChatConfig.transliteration_enabled?"<a  id='fc_trlit' style='margin-left:2px;' "+q+"open_trlit()'>"+"<img title='"+t(304,"Type in your language")+"' src='"+m+"google_transliteration.png'>"+"</a>":"")+"<a title='"+t(295,"doodlepad")+"' id='fc_note' style='margin-left:2px' "+q+"note(1)'>"+"<img src='"+m+"pencil.png'>"+"</a>"+"<a title='"+t(311,"Share a document")+"' id='fc_doc' style='margin-left:2px;' "+q+"doc(2)'>"+"<img src='"+m+"document.png'>"+"</a>"+"<a id='fc_vid' style='margin-left:1px"+(fc_chat.vidAcc>1?"":C)+"' "+q+"launchVideoChat(0)'>"+"<img title='"+t(31)+(fc_chat.vidAcc>1?'':' '+t(32))+"' id='fc_e_vid' src='"+m+"webcam.png'>"+"</a>"+" <input id='fc_sendpagechat' class='fc_input' onKeyPress='fc_chat.oKD(event)' onKeyDown='fc_chat.oKD2(event)' type=text style='"+o.dialog_box.input_css+"'><br>")+"</div></div>";i("#fc_page_discussion_dialog").css("background-color",jGo.fcchat_toolbar.chatbox.style.dialog_box.background_color).html(a);fc_chat.c_px(null,fc_chat.getPx(),8);i('div.fc_drag_disc').bind('click',this.click_tab);if(r)i('#fc_sendpagechat').css('font-size','16px');x=1}};var W=function(a){i(document.body).append(a)};var X=function(){if(!fc_chat.get('login_lock')&&!fc_chat.get('l')){fc_chat.rescale();y=jGo.fcchat_toolbar.control.toggle_dialog(i("#fc_page_discussion_dialog"),Y,V,200,(FCChatConfig.blog?1:0));fc_chat.tgl_disc();M()}};var Y=function(){jGo.fcchat_toolbar.control.position_dialog(i("#fc_page_discussion_dialog"),EN(i("#fc_chatbox_toolbar_item").css("left")),o.dialog_box.width,o.dialog_box.height*(jGo._['scalefactor']||1),1)}})();

//Class Initialization
if(jGo.scripts)jGo.scripts.onLoad('chatbox.js');