document.domain = "maegu.com";
var db;
var general_trans_flag = 'true';
var chat_trans_flag = 'true';
var protocol = "http://";
var protocol_ssl = "https://";
var maegu_url = protocol+"www.maegu.com";
//var protocol_ssl_maegu = "https://www.maegu.com/";
var protocol_ssl_maegu = "http://www.maegu.com/";
var m_member_error_display;
var m_current_location;
var m_current_latlng;
var m_modify_criteria;
var m_modify_sort;
var m_friend_members;
var m_all;
var m_result;
var m_members;
var m_username;
var m_eng_name;
var m_name;
var m_nation;
var m_nationality;
var m_language;
var m_location;
var m_location_detail;
var m_mobile;
var m_email;
var m_confirm_delete;
var editor = "#cmt";
var editor_trans = "#editor_trans";
var trans_verify = "#trans_verify1";
var url = "#url";
var src = "";
var count = 0;
var original_cmt;
var dictionary_flag = "no";
var please_wait = null;
var lngName = [];
var language_custom = [];
var kmj = 0;
var setInterval_id = [];
var mobile = false;
var timer_chat;
var timer_ad;
//var timer_search;
var save_cmt_code = '';
var selected = 0;
var latitude;
var longitude;
var address = '';
var source_list = [];
var kk = 0;
var sms_send_flag = "no";
var flag_code = "";
var flag_name = "";
var flag = '';
var temp_word_source = "";
var temp_word_dest = "";
var requester;
var mouseX = 0;
var mouseY = 0;
var mouseX1 = 0;
var mouseY1 = 0;
var requester2;
var country_code = '';
var send_window = null;
var flag_caret = 'off';
var selected_id = "#cmt";
var input_code_select = '';
var word = '';
var fontSize_zoom = '';
var ui_value = '';
var content = '';
var toggle_flag = false;
var country_flag_url = maegu_url+"/common/image/country_flag/";
var noimage_url = maegu_url+"/common/image/profile/noimage1.png" + "?date=" + new Date().getTime();
var profile_image_url = maegu_url+"/common/image/profile/";
var profile_image_thumb_url = maegu_url+"/common/image/profile/thumb/";
var select_search_classify = '';
var obj_tabs;
var obj_tabs_chat;
var obj_tabs_pr;
var obj_tabs_search;
var login_status_on_image_path = maegu_url+"/common/image/bullet_online.png";
var login_status_off_image_path = maegu_url+"/common/image/bullet_offline.png";
var user_status_image_path = maegu_url+"/common/image/tag.png" + "?date=" + new Date().getTime();
var current_location_image_path = maegu_url+"/common/image/current_position.png";
var count_chat_square_display = 0;
var win_id;
var myScroll;
var myScroll_private;
var CHANNEL_GENERAL = 'maegu_general';
var CHANNEL_LOGIN = 'maegu_login';
var CHANNEL_CHAT = 'maegu_chat';
var NICK_REGEX = /^[a-z0-9\-_]{2,20}$/i;
var chat_my_pubid = '';
var mypipe = '';
var tts_element = '';
var title = '';
var window_new_width = '';
var window_new_height = '';
var show_transition = '';//창 나타날 때 효과
var hide_transition = '';//창 사라질 때 효과
var result_address = '';
var apple = '';
var pr_classify = "pr_a";
var script1 = false;
var modify_profile_js_flag = 0;
var main_ad_timeId = ""; // 메인 광고의 타이머
var pr_ad_timeId = ""; // PR 광고의 타이머
var main_ad_no = 1000000000000; // 메인 광고의 플래그값
var first_app_flag = 0; //app_load가 처음 여부 플래값
var flag_third_party_api = false; //공유 api 처음 여부 플래그값
var maegu_share_url = protocol+"www.maegu.com";
var share_image = [];
share_image['ko'] = "http://www.maegu.com/common/image/screenshot_maegu_ko.jpg";
share_image['en'] = "http://www.maegu.com/common/image/screenshot_maegu_en.jpg";
var api_msg = [];
/*
api_msg['ko'] = "[매구]\n\n구글, 네이버, 페이스북, 트위터, 카카오톡, 라인, 음성 통역 채팅, SNS...\n이 모든 것을 \"한방\"에 끝!";
api_msg['en'] = "[MaeGu]\n\nLet's chat freely with friends around the world without language barriers, in the MaeGu's world!";
*/
/*
api_msg['ko'] = "[[ 매구정음 ]]\n\n나라말이 서로 달라 문자끼리 서로 맞지 아니할세.\n\n이런 이유로 외국인과 말을 하고자 하여도 언어 장벽으로 인하여 대화 나누기가 힘드니라.\n\n내 이를 어여삐 여겨 음성 번역 채팅 플랫폼을 만드노니.\n\n전세계인으로 하여금 사용법을 쉬이 익혀 소통하게 하고자 할 따름이니라.\n\n- 매구데이 -\n";
api_msg['en'] = "[[ MaeGu Jeongeum ]]\n\nBecause the speech of this country is different from that of each other, it does not match the other letters.\n\nTherefore, even if the ignorant want to communicate, many of them cannot state their concerns due to a language barrier.\n\nSaddened by this, I have voice translation chatting platform newly made.\n\nIt is my wish that all the people may easily learn how to use and that be convenient for daily use.\n\n- MaeGu Day -\n";
*/
/*
api_msg['ko'] = "[매구]\n\n구글, 네이버, 페이스북, 트위터, 카카오톡, 라인, 음성 통역 채팅, SNS...\n이 모든 것을 \"한방\"에 끝!\n\n스마트폰,스마트TV,태블릿,PC,노트북...기종에 상관없이 사이트에 접속해서 편리하게 사용하실 수 있습니다.";
api_msg['en'] = "[MaeGu]\n\nGoogle, Facebook, Twitter, WhatsApp, WeChat, Line, Kakaotalk, Voice translator chat, SNS...\n\"MaeGu\" Can Do Them All \"at a stroke\", HanBang!";
*/
api_msg['ko'] = "[매구]\n다국어 번역검색\n실시간 통역채팅\n\n매구는 다국어 번역 검색, 웹사이트 번역, 실시간 통역 채팅을 하실 수 있는 사이트입니다!\n\n이제 별도의 다운로드 없이 PC,노트북,태블릿,스마트폰,스마트TV...기종과 관계없이 매구 사이트에 접속만 하시면 편리하게 사용하실 수 있습니다.\n\n[매구 사이트]\nwww.maegu.com\n\n[매구 사용법 동영상]\nmm.maegu.com\n";
api_msg['en'] = "[MaeGu]\nMultilingual translation searching\nReal time interpretation chatting\n\nMaeGu is a site you can do multilingual translation searching, website translation, real time interpretation chatting!\n\nNow, with no downloading, PC, laptop, tablet, smartphone, smartTV...regardless of the device type, if you only have access to MaeGu, you can use it conveniently.\n\n[MaeGu site]\nwww.maegu.com\n\n[MaeGu manual VOD]\nmm.maegu.com\n";
var dictionary = new Array();//1차원 배열 선언
/* 한국의 경우 사전 url 정의 */
dictionary['ko'] = new Array();//dictionary['ko']에 대한 2차원 배열 선언
dictionary['ko']['p'] = new Array();//dictionary['ko']['p']에 대한 3차원 배열 선언
dictionary['ko']['m'] = new Array();//dictionary['ko']['m']에 대한 3차원 배열 선언
dictionary['ko']['p']['home'] = "http://dic.naver.com";
dictionary['ko']['p']['ko'] = "http://krdic.naver.com/search.nhn?dic_where=krdic&query=";
dictionary['ko']['p']['en'] = "http://endic.naver.com/search.nhn?sLn=kr&isOnlyViewEE=N&query=";
dictionary['ko']['p']['ja'] = "http://jpdic.naver.com/search.nhn?ie=utf8&query=";
dictionary['ko']['p']['zh'] = "http://cndic.naver.com/search/all?q=";
dictionary['ko']['p']['zh-TW'] = "http://cndic.naver.com/search/all?q=";
dictionary['ko']['p']['fr'] = "http://frdic.naver.com/search.nhn?query=";
dictionary['ko']['p']['es'] = "http://spdic.naver.com/search.nhn?query=";
dictionary['ko']['p']['de'] = "http://dedic.naver.com/#search/all/q=";
dictionary['ko']['p']['vi'] = "http://vndic.naver.com/search.nhn?query=";
dictionary['ko']['p']['ru'] = "http://rudic.naver.com/#search/";
dictionary['ko']['p']['la'] = "http://ladic.naver.com/#search/";
dictionary['ko']['p']['pt'] = "http://ptdic.naver.com/#search/";
dictionary['ko']['p']['mn'] = "http://mndic.naver.com/#search/";
dictionary['ko']['p']['id'] = "http://iddic.naver.com/#search/";
dictionary['ko']['p']['tr'] = "http://trdic.naver.com/#search/";
dictionary['ko']['p']['km'] = "http://khdic.naver.com/#search/";
dictionary['ko']['p']['uk'] = "http://uadic.naver.com/#search/";
dictionary['ko']['p']['sq'] = "http://aldic.naver.com/#search/";
dictionary['ko']['m']['home'] = "http://m.dic.naver.com";
dictionary['ko']['m']['ko'] = "http://m.krdic.naver.com/search.nhn?dic_where=krdic&query=";
dictionary['ko']['m']['en'] = "http://m.endic.naver.com/search.nhn?sLn=kr&isOnlyViewEE=N&query=";
dictionary['ko']['m']['ja'] = "http://m.jpdic.naver.com/search.nhn?ie=utf8&query=";
dictionary['ko']['m']['zh'] = "http://m.cndic.naver.com/search/all?q=";
dictionary['ko']['m']['fr'] = "http://m.frdic.naver.com/search.nhn?query=";
dictionary['ko']['m']['es'] = "http://m.spdic.naver.com/search.nhn?query=";
dictionary['ko']['m']['de'] = "http://m.dedic.naver.com/#search/all/q=";
dictionary['ko']['m']['vi'] = "http://m.vndic.naver.com/search.nhn?query=";
dictionary['ko']['m']['ru'] = "http://m.rudic.naver.com/#search/";
dictionary['ko']['m']['la'] = "http://m.ladic.naver.com/#search/";
dictionary['ko']['m']['pt'] = "http://m.ptdic.naver.com/#search/";
dictionary['ko']['m']['mn'] = "http://m.mndic.naver.com/#search/";
dictionary['ko']['m']['id'] = "http://m.iddic.naver.com/#search/";
dictionary['ko']['m']['tr'] = "http://m.trdic.naver.com/#search/";
dictionary['ko']['m']['km'] = "http://m.khdic.naver.com/#search/";
dictionary['ko']['m']['uk'] = "http://m.uadic.naver.com/#search/";
dictionary['ko']['m']['sq'] = "http://m.aldic.naver.com/#search/";
/* 일본의 경우 사전 url 정의 */
dictionary['ja'] = new Array();
dictionary['ja']['p'] = new Array();
dictionary['ja']['m'] = new Array();
dictionary['ja']['p']['home'] = "http://dic.search.yahoo.co.jp";
dictionary['ja']['p']['ja'] = "http://dic.search.yahoo.co.jp/search?p=";
dictionary['ja']['p']['en'] = "http://dic.search.yahoo.co.jp/search?p=";
dictionary['ja']['m']['home'] = "http://dic.search.yahoo.co.jp/";
dictionary['ja']['m']['ja'] = "http://dic.search.yahoo.co.jp/search?p=";
dictionary['ja']['m']['en'] = "http://dic.search.yahoo.co.jp/search?p=";
/* 중국(간체)의 경우 사전 url 정의 */
dictionary['zh'] = new Array();
dictionary['zh']['p'] = new Array();
dictionary['zh']['m'] = new Array();
dictionary['zh']['p']['home'] = "http://www.iciba.com";
dictionary['zh']['p']['zh'] = "http://www.iciba.com/";
dictionary['zh']['p']['en'] = "http://www.iciba.com/";
dictionary['zh']['m']['home'] = "http://wap.iciba.com";
dictionary['zh']['m']['zh'] = "http://wap.iciba.com/cword/";
dictionary['zh']['m']['en'] = "http://wap.iciba.com/cword/";
/* 중국인(번체)의 경우 사전 url 정의
dictionary['zh-TW'] = new Array();
dictionary['zh-TW']['p'] = new Array();
dictionary['zh-TW']['m'] = new Array();
dictionary['zh-TW']['p']['home'] = "http://www.iciba.com";
dictionary['zh-TW']['p']['zh-TW'] = "http://www.iciba.com/";
dictionary['zh-TW']['m']['home'] = "http://wap.iciba.com";
dictionary['zh-TW']['m']['zh-TW'] = "http://wap.iciba.com/cword/";
*/
/*
var geocoder;
var map;
var infowindow = new google.maps.InfoWindow();
var marker;
*/
//google.setOnLoadCallback(lngcode_define);
//google.maps.event.addDomListener(window, 'load', google_map_init);
$.support.cors = true;
$.fn._on = $.fn.on;
$.fn.on = function(eventName, handler){
if(event == "click"){
if(mobile_device){
event = "touchend";
}else{
event = "click";
}
}
this._on(eventName, handler);
};
$.fn.reflow = function() {
/*
컨텐츠가 변경되었는데 레이아웃이 새로 잡히지 않는 경우
이는 모바일뿐만 아니라 데스크톱에서도 종종 목격되는 현상이다.
좀 괴상한 방법이지만, 브라우저의 버그를 우회하기 위해 다음과 같은 무의미한 감추기/보이기 및, 강제 위치 재계산을 위한 쓸모 없는 참조가 필요하다.
*/
this.hide();
this.each(function() {
this.offsetWidth;
this.offsetHeight;
});
this.show();
return this;
};
$.fn.scrollBottom = function () {
var last = $(this).attr('scrollHeight') - $(this).attr('clientHeight');
return $(this).scrollTop(last)
};
APE.Config.scripts = [APE.Config.baseUrl + '/Build/uncompressed/apeCoreSession.js'];
client = new APE.Client();
//단축 메뉴 실행되지 않도록 함
document.oncontextmenu = function () {
return false;
};
$(window).bind('resize', function () {
//css_setting();
});
/*
$(window).bind('load', function () {
}, false);
*/
$(window).bind("keydown mousedown touchstart",function() {
$("#tts_object").attr("src","common/tools/tts/mute.mp3");
$("#tts_object").load();//모바일 기기는 이 부분을 활성화, PC는 이 부분을 비활성화
/*
setTimeout(function() {
$("#tts_object").attr("src","common/tools/tts/mute.mp3");
$("#tts_object").load();//모바일 기기는 이 부분을 활성화, PC는 이 부분을 비활성화
}, 0);
*/
$(window).unbind("keydown mousedown touchstart");
});
$(window).bind('load', function () {
$("#go_interpret").live("click", function () {
//location.href = "interpreter/index.html";
if("") {
location.replace("interpreter/");
}
else {
member_error_display();
}
});
$.ajaxSetup({
complete: function (e) {
//console.clear();
}
});
$("#layout_content").show();
//주소표시줄을 위로 밀어버림
setTimeout(function () {
window.scrollTo(0,$("#logo").height());
//$(window).scrollTop();
}, 1000);
mobile_device = mobile_check();
browser_check();
get_language_code_from_browser();
get_country_code_from_ip();
setInnerTextProperty();
if("") {
activateSending();
init_ape();
}
tab_load();
setTimeout(function() {
selected = $('#tabs > ul > li > a').index($('[href="#'+''+'"]'));
$('#tabs ul li:eq('+selected+') a').trigger("click");//alert($('#tabs ul li:eq(0) a').attr('href'));
},500);
lngcode_define();
init_setting_common();
main_ad_run();//메인광고
//pr_ad_run();//라인광고
$(".btn_pr_classify[classify=pr_1] img").trigger("click");
$(".btn_pr_classify[classify=pr_1] img").addClass('border_menu');
})
/*** 사용자 정의 함수 (모바일/PC 분리되었던 것 통합) 시작 ***/
function fm_optimizeInput() {
$("input[placeholder],textarea[placeholder]").each(function () {
var tmpText = $(this).attr("placeholder");
if (tmpText != "") {
$(this).attr("placeholder", "").attr("placeholder", tmpText)
}
})
}
function view_dictionary() {
var url = '';
var message = '';
var language = '';
var device = '';
if(mobile_device) {
device = 'm';
}
else {
device = 'p';
}
if (flag_caret == "off") {
message = $(selected_id).val();
}
else {
message = $(selected_id).caret().text;
}
message = trans_item_selection();
//language = selected_language(selected_id);
language = selected_language("#editor_trans");
if(!dictionary[Real_language]) {
$("#search_button_Wikipedia").trigger("click");return false;
}
if (message == '') {
if(dictionary[Real_language][device]['home']) {
url = dictionary[Real_language][device]['home'];
window.open(url, "dic_win1");
}
else {
$("#search_button_Wikipedia").trigger("click");return false;
}
}
else {
if(dictionary[Real_language][device][language]) {
url = dictionary[Real_language][device][language]+encodeURIComponent(message);
window.open(url, "dic_win1");
}
else {
$("#search_button_Wikipedia").trigger("click");return false;
}
}
}
function google_translation() {
var a = $(editor);
if (flag_caret == "off") {
var text = a.val()
}
else {
var text = $(a).caret().text
}
if(mobile_device) {
var url = protocol_ssl+"translate.google.com/m/translate?vi=m&hl=" + $("#input_code").val() + "&sl=" + $("#input_code").val() + "&tl=" + $("#src2").val() + "&q=" + encodeURIComponent(text);
}
else {
var url = protocol_ssl+"translate.google.com/?hl=" + $("#input_code").val() + "" + $("#input_code").val() + "|" + $("#src2").val() + "|" + encodeURIComponent(text);
}
var google_translation = window.open(url, "google_translation");
google_translation.focus()
}
function google_translation_chat(object) {
if(mobile_device) {
var url = protocol_ssl+"translate.google.com/m/translate?vi=m&hl=" + Real_language + "&sl=" + object.attr('view_code') + "&tl=" + Real_language + "&q=" + encodeURIComponent(object.attr('message'));
}
else {
var url = protocol_ssl+"translate.google.com/?hl=" + Real_language + "" + object.attr('view_code') + "|" + Real_language + "|" + encodeURIComponent(object.attr('message'));
}
var google_translation = window.open(url, "google_translation");
google_translation.focus();
}
function tts_play(word, code) {//채팅창의 대화내용 클릭시
if (word) {
//var url = "common/tools/tts/mute.mp3";
//$("audio").attr("src",url);
//$("#tts_mute").trigger("click");
//$("audio").load();//모바일 기기는 이 부분을 활성화, PC는 이 부분을 비활성화
setTimeout(function() {
var words = word.toLowerCase();
var protocol = "http://";
$.ajax({
type: 'POST',
cache:false,
url: "common/tools/tts/tts_play.php",
data: {
'code' : code,
'words' : words,
'protocol' : protocol
},
success:function(result) {
if(result) {
var url = "common/tools/tts/"+result+"?temp="+Math.random();
$("#tts_object").attr("src",url);
$("#tts_object").load();
}
}
});
}, 0);
}
}
function tts_play_menu() {//툴바의 tts버튼 클릭시
if (flag_caret == "off") {
var word = $(selected_id).val()
}
else {
var word = $(selected_id).caret().text
}
if (word) {
if (selected_id == editor || selected_id == trans_verify) {
var code = $("#input_code").val() == 'auto' ? $("#input_code1").val() : $("#input_code").val()
}
else {
var code = $("#src2").val()
}
//var words = escape(encodeURIComponent(word.toLowerCase()));
var words = word.toLowerCase();
setTimeout(function() {
var words = word.toLowerCase();
var protocol = "http://";
$.ajax({
type: 'POST',
cache:false,
url: "common/tools/tts/tts_play.php",
data: {
'code' : code,
'words' : words,
'protocol' : protocol
},
success:function(result) {
if(result) {
var url = "common/tools/tts/"+result+"?temp="+Math.random();
$("#tts_object").attr("src",url);
$("#tts_object").load();
}
}
});
}, 0);
}
else {
alert($("#error_empty_tts").html());
}
}
function pulsate(channel, sender, reciever, message_view) {
var options = {};
var selectedEffect = 'highlight';
$("#dialog").text(message_view);
$("#dialog").dialog({
width: 200,
height: 150,
title: sender,
resizable: false,
open: function( event, ui ) {
$(this).scrollTop(0);
},
position: ['center', 'middle']
}).parent().show(selectedEffect, options, 1000, callback);
function callback() {
setTimeout(function () {
$("#dialog").parent().fadeOut()
}, 5000)
};
var notify_url = "common/sound/fox.mp3";
if(mobile_device) {
tts_element.src = notify_url;
tts_element.volume = 1;
tts_element.play();
}
else {
var notify_url = "common/sound/fox.mp3";
if (Browser.isChrome) {
top.tts_area.location.href = "common/tools/tts_play/mvk_tts_chrome.html?url=" + notify_url;
}
else if (Browser.isIE) {
top.tts_area.location.href = "common/tools/tts_play/mvk_tts_ie.html?url=" + notify_url
}
else {
top.tts_area.location.href = "common/tools/tts_play/mvk_tts_ff_safari_opera.html?url=" + notify_url
}
}
var selectedEffect = 'pulsate';
if ($(".private_chat_list[for_channel_name=" + channel + "] [notify=check_notify]").text() == "") {
setInterval_id.push(setInterval("notify()", 2000))
}
var no = $('#private_chat_list_' + channel).attr('no');
var classify = 'update_notification_value';
var requester_str = "mode=private_chatting_list&classify=" + classify + "&no=" + no;
chatting_list_process(classify,requester_str, channel)
};
function view_check(current_area, checked) {
if (checked == true) {
$("#" + current_area + " div[name='message_original']").attr("class", 'original_display_on')
}
else {
$("#" + current_area + " div[name='message_original']").attr("class", 'original_display_off')
}
if (!Browser.isIE) {
if (current_area == 'chat_square_body') {
myScroll.refresh()
}
else {
myScroll_private.refresh()
}
}
}
function trans_toolbar_toggle() {
$("input:radio[group='input_area'][for1='cmt']").trigger("click");
$("#trans_block").slideToggle("slow");
$("#trans_display").slideToggle("slow");
$("#trans_tools_bar").slideToggle("slow");
}
function keyboard_setting() {
virtualKeyboard = new Keyboard($(editor));
$("#check_vk").attr("checked","checked");
var a = $(".vk:checkbox[lang='en'][order='1']");
a.attr('checked', 'checked');
css_vk();
$("#maegu_vk").draggable({
opacity: 0.8,
scroll: false,
handle: '#drag_handle'
});
$("#vk_size_minus").bind("click", function () {
var left = $('#maegu_vk').css("left","90px");
var vk_size = $('#maegu_vk').css("font-size");
$('#maegu_vk').css("font-size",(parseInt(vk_size) - 5) + 'px');
$('#maegu_vk td').css("font-size",(parseInt(vk_size) - 5) + 'px');
css_vk();
});
$("#vk_size_plus").bind("click", function () {
var left = $('#maegu_vk').css("left","90px");
var vk_size = $('#maegu_vk').css("font-size");
$('#maegu_vk').css("font-size",(parseInt(vk_size) + 5) + 'px');
$('#maegu_vk td').css("font-size",(parseInt(vk_size) + 5) + 'px');
css_vk();
});
$("#img_keyboard").bind("click", function () {
$('#maegu_vk').toggle();
var a = $(".vk:checkbox[lang='" + $('select#input_code').val() + "'][order='1']");
maegu_vk(a);
});
$("#select_vk").bind("click", function (c) {
change_vk();
});
$("#check_vk").bind("click", function () {
$("#input_code").trigger("change");
});
$("#input_code").bind("change", function () {
if ($(this).val() == 'auto' || $(this).val() == 'none' || $(".vk:checkbox[lang='" + $(this).val() + "']").length == 0) {
var a = $(".vk:checkbox[lang='en'][order='1']");
maegu_vk(a);
}
else {
var a = $(".vk:checkbox[lang='" + $(this).val() + "'][order='1']");
maegu_vk(a);
}
});
$("#src2").bind("change", function () {
if ($(editor).val()) {
if('') {
translation(Real_language)
}
}
});
$("#close_keyboard").bind("click", function () {
$("#img_keyboard").trigger("click");
});
$("#set,#ok_keyboard_list,#close_keyboard_list").bind("click", function () {
preprocess();
});
function css_vk() {
var top = $(window).height() - $("#maegu_vk").height() - $("#cmt_display").height() - $("#trans_display").height() - $("#trans_block").height() - $("#menu1").height() - $("#footer").height() - $("#main_ad").height() - $("#main_ad").height() - 10;
var left = '90px';
$("#maegu_vk").css({'position':'absolute','top':top,'left':left});
}
function maegu_vk(a) {
if($('#maegu_vk').is(":visible")) {
//var a = $(".vk:checkbox[lang='" + $('select#input_code').val() + "'][order='1']");
a.attr('checked', 'checked');
loadKeyboard(virtualKeyboard, a.val(), "0");
$("#display").html(a.attr('label'));
virtualKeyboard.textbox = $(editor);
//editor_current_layout = a.val();
}
else {
var a = $(".vk:checkbox[lang='en'][order='1']");
a.attr('checked', 'checked');
loadKeyboard(virtualKeyboard, a.val(), "0");
$("#display").html(a.attr('label'));
virtualKeyboard.textbox = $(editor);
//editor_current_layout = a.val();
}
}
}
function virtualkeyboard_list() {
var num_temp = Math.ceil(Math.random() * 10000);
$.ajax({
url: 'common/virtualkeyboard.php?mode=display_list&num_temp='+num_temp,
//data:{mode:'display_list',num_temp:num_temp},
type : 'post',
contentType:"text/plain;charset=utf-8",
crossDomain: true,
dataType:'jsonp',
json:"callback",
jsonpCallback:"vk_callback",
success: function (content1) {
},
error: function (x, o, e) {
alert(x.status + " : " + o + " : " + e)
}
})
}
function vk_callback(content1) {
content = eval("(" + content1 + ")");
var no = 0;
var str = '';
var str_US = '';
var str_lang = '';
var num = content.contents.length;
for (var i = 0; i < num; i++) {
var label = content.contents[i].label;
var value = content.contents[i].value;
var lang = content.contents[i].lang;
var t_support = content.contents[i].t_support;
var order = content.contents[i].order;
if (value == 'US') {
str_US += "";
str_US += " "
}
else if ('' && lang == '') {
str_lang += "";
str_lang += " "
}
else {
no = no + 1;
str += no + ".";
str += " "
}
}
$("#Div2").html(str_US + str_lang + "-------------------------------- " + str);
keyboard_setting();
}
/*** 사용자 정의 함수 (모바일/PC 분리되었던 것 통합) 끝 ***/
/*** Common 사용자 정의함수 시작 ***/
function pc_mobile_view() {
if (mobile_device) {
$(".mobile").css("display", "inline");
$(".pc").css("display", "none");
tts_element = new Audio();
}
else {
$(".mobile").css("display", "none");
$(".pc").css("display", "inline")
}
$("#area_keyboard").hide();
if (!mobile_device && ('' || '')) {
//$("#check_vk").show();
$("#area_keyboard").show();
}
}
function css_chatting() {
if(mobile_device) {
//if(apple) {
css_setting();
setTimeout(function () {
window.scrollTo(0,$("#logo").height() + $("#main_ad").height());
//$(window).scrollTop();
}, 1000);
//}
}
}
function css_normal() {
if(mobile_device) {
//if(apple) {
css_setting();
setTimeout(function () {
window.scrollTo(0,$("#logo").height());
//$(window).scrollTop();
}, 0);
//}
}
}
function css_setting() {
var window_height = $(window).height();//윈도우창
var logo_height = $("#logo").height();//로고 라인
var main_ad_height = $("#main_ad").height();//메인 광고 라인
var main_menu_height = $("#main_menu").height();//메인메뉴바
var cmt_display_height = $("#cmt_display").height();//검색어 입력 라인
var trans_display_height = $("#trans_display").height();//번역된 검색어 출력 라인
var trans_block_height = $("#trans_block").height();//언어 선택 라인
var menu1_height = $("#menu1").height();//도구바 라인
var footer_height = $("#footer").height();//푸터바
//var footer_height = 0;//푸터바
var apple = MobileDevice.is_iphone || MobileDevice.is_ipod || MobileDevice.is_ipad;
if(mobile_device) {
var toolbar_height = cmt_display_height + menu1_height;//도구바 전체
$("#toolbar").css("height",toolbar_height);
if(apple) {
var apple_bar = 25;
var remind_height = window_height - logo_height - main_ad_height - main_menu_height - toolbar_height + apple_bar;
}
else {
var remind_height = window_height - logo_height - main_ad_height - main_menu_height - toolbar_height - 8;
}
}
else {
var toolbar_height = cmt_display_height + trans_display_height + trans_block_height + menu1_height;//도구바 전체
$("#toolbar").css("height",toolbar_height);
var remind_height = window_height - logo_height - main_ad_height - main_menu_height - toolbar_height - 8;
}
$(".main_menu_body, #tabs .line_ad_area").css({'height':remind_height});
$("#ad_area .line_ad_area").css({'height':window_height});
if(mobile_device) {
if(apple) {
$("#chat_body").css({'height':$("#chat_body").height() + apple_bar});
}
}
var chat_menu_height = $(".ui-tabs-nav").height();
var chat_subtitle_height = $(".chat_subtitle").height();
var chat_division_height = $("#chat_body").height() - chat_menu_height + 2;
var wrapper_height = chat_division_height - chat_subtitle_height;
$(".chat_division").css({'height':chat_division_height});
$("#wrapper, #wrapper_private").css({'height':wrapper_height});
/*
alert("window_height : "+window_height+"\n"
+"logo_height : "+logo_height+"\n"
+"main_ad_height : "+main_ad_height+"\n"
+"main_menu_height : "+main_menu_height+"\n"
+"cmt_display_height : "+cmt_display_height+"\n"
+"trans_display_height : "+trans_display_height+"\n"
+"trans_block_height : "+trans_block_height+"\n"
+"menu1_height : "+menu1_height+"\n"
+"toolbar_height : "+toolbar_height+"\n"
+"footer_height : "+footer_height+"\n"
+"remind_height : "+remind_height+"\n"
);
*/
}
function init_setting_common() {
/* 출력창 변수 시작 */
title = '';//창 제목줄에 나타낼 광고 문구
if(!mobile_device) {
window_new_width = '600';//창 가로크기
window_new_height = $(window).height() * 0.7; //창 세로크기/400
}
else {
window_new_width = '90%';//창 가로크기
window_new_height = $(window).height() * 0.9; //창 세로크기/350
}
show_transition = 'fade';//창 나타날 때 효과
hide_transition = 'clip';//창 사라질 때 효과
/* 출력창 변수 끝 */
css_setting();
pc_mobile_view();
var language = Real_language;
var page_in_language = $("#page_in_language");
if (language == "ko") {
//$("#ad_korean").show()
page_in_language.append("");
page_in_language.append("");
}
else {
//$("#ad_english").show();
$("#local_search_body").parents("fieldset").hide()
page_in_language.append("");
page_in_language.append("");
}
trans_language();
if(mobile_device) {
trans_toolbar_toggle();
}
/* 도움주신 분들 링크 */
var str = '';
str += $("#ad_body .supporters").clone().wrapAll("
").parent().html();
str += " ";
str += $("#ad_body .duty_helpers").clone().wrapAll("").parent().html();
$("#special_thanks").append(str);
$("#special_thanks").css({'text-align':'center'});
$("#online_users .heading").html(set_users_routine);
//home_ad_routine();
setTimeout(function() {
$("#search_body").load("search.html");
},500);
//islowIE10_message();
//display_app();//앱 설치 안내창
/*
$("#layout_content").draggable({
opacity: 0.8,
scroll: false,
handle: '#logo'
});
*/
$("#chatting_content").css({
'display': 'none'
});
$(".info_wiki").live("click", function () {
if($(this).attr('classify')) {
var query_url = "http://"+Real_language+".wikipedia.org/wiki/" + $(this).attr('query');
}
else {
var query_url = "http://"+Temp_language+".wikipedia.org/wiki/" + $(this).attr('query');
}
if ($("#trans_check").is(":checked")) {//웹번역 옵션 체크되어 있으면
transweb(Real_language, query_url);
}
else {//웹번역 옵션이 체크되어 있지 않으면
window.open(query_url,"_blank");
}
})
//광고의 링크 클릭시//
$(".ad_url").live("click", function (c) {
if ($("#trans_check").is(":checked")) {//웹번역 옵션 체크되어 있으면
transweb(Real_language, encodeURIComponent($(this).attr('url')));
}
else {//웹번역 옵션이 체크되어 있지 않으면
window.open($(this).attr('url'),"_blank");
}
})
$(".ad_local").live("mouseover", function() {
if(!mobile_device) {
window.clearInterval(main_ad_timeId);
}
});
$(".ad_local").live("mouseout", function() {
if(!mobile_device) {
main_ad_run();
}
});
/*
$(".ad_line").live("mouseover", function() {
if(!mobile_device) {
window.clearInterval(pr_ad_timeId);
}
});
$(".ad_line").live("mouseout", function() {
if(!mobile_device) {
pr_ad_run();
}
});
*/
$(".icon-set-del").bind("click",function() {
var target_id = $(this).attr('for_id');
$("#"+target_id).val("");
});
$(".please_donate").live("click",function() {
$("a[for1='donate_maegu']").trigger("click");
});
$("#please_invest").live("click",function() {
//$("a[for1='invest_maegu']").trigger("click");
$(".maegu_internal[for1='invest_maegu']").trigger("click");
});
$(".please_invest").live("click",function() {
//$("a[for1='invest_maegu']").trigger("click");
$(".maegu_internal[for1='invest_maegu']").trigger("click");
});
$("#btn_ad_inquiry").live("click",function() {
$(".maegu_internal[for1='ad_maegu']").trigger("click");
});
$(".btn_pr_classify img").each(function(index, element) {
$(this).bind("click",function() {
$(".btn_pr_classify img.border_menu").removeClass('border_menu');
$(this).addClass('border_menu');
pr_classify = $(this).parent().attr('classify');
var title = $(this).parent().attr('title');
ad_read_routine(pr_classify,title);
});
})
/* 통신판매사업자 상세조회창 띄움 */
$(".registration_number").live("click", function() {
var url =
"http://www.ftc.go.kr/info/bizinfo/communicationViewPopup.jsp?wrkr_no=6052604946";
if(Real_language == 'ko') {
//win_comment(url, "communicationViewPopup", 750, 700, 'no');
window.open(url, "communicationViewPopup1");
}
else {
transweb_maegu(url);
}
});
/* 벤처기업 상세조회창 띄움 */
$(".venture_number").live("click", function() {
var url =
"https://www.venturein.or.kr/venturein/infor/C21210.do?venid=maegu2000&menu=2";
if(Real_language == 'ko') {
//win_comment(url, "communicationViewPopup", 750, 700, 'no');
window.open(url, "communicationViewPopup2");
}
else {
transweb_maegu(url);
}
});
$("#maegu_address_window_naver").live("click", function() {
var address = $("#maegu_address").text();
map_service_maegu("naver",address);
});
$("#maegu_address_window_google").live("click", function() {
var address = $("#maegu_address").text();
map_service_maegu("google",address);
});
$(".maegu_internal").live("click", function() {
var title_message = new Array();
var classify = $(this).attr("classify");
switch($(this).attr("classify")) {
case 'ad_inquiry' ://광고문의
title_message = $("#"+ $(this).attr("for1") + " .title").html();
break;
case 'invest' ://투자문의
title_message = $("#"+ $(this).attr("for1") + " .title").html();
break;
case 'Cooperation' ://협업문의
title_message['en'] = "If you are interested in cooperation, mail, please.";
title_message['ko'] = "협업에 관심있으시면 메일 주세요.";
title_message = title_message[Temp_language];
break;
case 'qna' ://Q&A
title_message['en'] = "If you have any questions, email, please.";
title_message['ko'] = "문의사항이 있으시면 메일 주세요.";
title_message = title_message[Temp_language];
break;
default :
title_message['en'] = "The more MaeGu evolve, the more you will be comfortable.";
title_message['ko'] = "매구가 진화할수록 여러분은 편해집니다.";
title_message = title_message[Temp_language];
break;
}
var to = $(this).attr("to");
var content = $("#" + $("input:radio[name='input_area']:checked").attr('for1')).val();
var locks = new Array();
locks = $(this).attr("class");
locks = locks.split(" ");
locks = "&"+locks.join("=readonly&")+"=readonly";
var mail_url = new Array();
mail_url = $(this).attr("hreff");
mail_url = mail_url.split(':');
var data = "role=maegu_internal";
data += "&classify="+classify;
data += "&content="+content;
data += "&from="+cs_email;
if(cs_english_name) {
data += "&from_name="+cs_english_name+"("+cs_name+")";
}
else {
data += "&from_name=";
}
data += "&to="+mail_url[1];
data += "&to_name=";
data += "&title_message="+title_message;
var url = protocol_ssl_maegu+"common/maegu_mail/index.html?" + data + locks;;
win_comment(url, "maegu_mail", 400, 500, "no");
});
$(".current_position").bind("click", function () {
my_current_position();
});
if(!mobile_device) {
$(editor + "," + editor_trans + "," + trans_verify).bind("select", function () {
flag_caret = "on";
selected_id = '#' + $(this).attr("id");
//selected_id = '#' + this.id
});
$(editor + "," + editor_trans + "," + trans_verify).bind("mousedown change", function () {
flag_caret = "off";
selected_id = '#' + $("input:radio[name='input_area']:checked").attr('for1');
//selected_id = '#' + this.id
});
}
$("#sign_up").bind("click", function () {
var url = protocol_ssl_maegu+'common/sign_up_form.php?language_code='+Temp_language+'&country_code='+Real_country_code+'&browser_language='+Browser_language+'&tel_country_code='+Tel_country_code;
var target = 'sign_up';
window.open(url, target)
});
$("#find_account").bind("click", function () {
var url = protocol_ssl_maegu+'common/find_account/find_account.html?language='+Temp_language+"&Real_country_code="+Real_country_code;
var target = 'find_password';
window.open(url, target)
});
$("#webtrans_url").live("click", function () {
transweb(Real_language, encodeURIComponent($(this).attr('url')))
});
$("#btn_modify,#temp_profile").bind("click", function () {
var url = protocol_ssl_maegu+'common/modify_form.php';
var target = 'modify_account';
window.open(url, target)
});
$("#btn_logout").bind("click", function () {
logout()
});
$("#btn_kakao_link").live("click", function () {
execute_maegu_link_kakaotalk()
});
$("#btn_kakaostory_link").live("click", function () {
execute_maegu_link_kakaostory()
});
$("#btn_facebook_link").live("click", function () {
shareToFacebook()
});
/*
$("#twitter_link").live("click", function () {
shareToTwitter()
});
*/
$("[name=input_area]").bind("click", function () {
selected_id = "#" + $(this).attr('for1')
});
$(".map_service").bind("click", function () {
switch ($(this).attr('id_map')) {
case "search_place":
search_place();//map_service_1
break;
case "display_lat_lng":
display_lat_lng();//map_service_7
break;
case "directions_google":
map_directions("google");//map_service_3
break;
case "directions_naver":
map_directions("naver");//map_service_3
break;
case "directions1":
directions1();//map_service_4
break;
case "directions2":
directions2();//map_service_5
break;
case "search_twitters":
search_twitters();//map_service_6
break;
case "world_travel":
world_travel();//map_service_2
break;
default:
break
}
});
/*
$(".get_previous_data").live({
click: function () {
var classify = $(this).parents(".chat_division").attr('classify');
var channel = $(this).parents(".chat_division").attr('channel');
$(this).parents(".chat_division").find(".loading_data").html("");
var position = 'p';
var doing = 'get_previous_data';
var no = $(this).parents(".chat_division").find(".comment .view_message:first").attr('for_no');
if (no) {
display_chat(classify, channel, position, doing, no);
}
else {
display_chat(classify, channel, 'p');
}
}
});
$(".get_recent_data").live({
click: function () {
$(this).parents(".chat_division").find(".loading_data").html("");
var classify = $(this).parents(".chat_division").attr('classify');
var channel = $(this).parents(".chat_division").attr('channel');
var position = 'n';
var doing = 'get_recent_data';
var no = $(this).parents(".chat_division").find(".comment .view_message:last").attr('for_no');
if (no) {
display_chat(classify, channel, position, doing, no);
}
else {
display_chat(classify, channel, 'n');
}
}
});
*/
$(".move_to_up").bind({
click: function () {
if ($(this).parents(".chat_division").attr('id') == 'chat_square_body') {
myScroll.scrollToElement('.view_message:first-child', 100);
}
else if ($(this).parents(".chat_division").attr('id') == 'chat_chat_body') {
myScroll_private.scrollToElement('.view_message:first-child', 100);
}
},
taphold: function () {
var classify = $(this).parents(".chat_division").attr('classify');
var channel = $(this).parents(".chat_division").attr('channel');
var position = 'p';
var doing = 'get_previous_data';
var no = $(this).parents(".chat_division").find(".comment .view_message:first").attr('for_no');
if (no) {
display_chat(classify, channel, position, doing, no);
}
else {
display_chat(classify, channel, 'p');
}
},
dblclick: function () {
var classify = $(this).parents(".chat_division").attr('classify');
var channel = $(this).parents(".chat_division").attr('channel');
var position = 'p';
var doing = 'get_previous_data';
var no = $(this).parents(".chat_division").find(".comment .view_message:first").attr('for_no');
if (no) {
display_chat(classify, channel, position, doing, no);
}
else {
display_chat(classify, channel, 'p');
}
}
});
$(".move_to_down").bind({
click: function () {
if ($(this).parents(".chat_division").attr('id') == 'chat_square_body') {
myScroll.scrollToPage(1, 10000000000, 100);
}
else if ($(this).parents(".chat_division").attr('id') == 'chat_chat_body') {
myScroll_private.scrollToPage(1, 10000000000, 100);
}
},
taphold: function () {
var classify = $(this).parents(".chat_division").attr('classify');
var channel = $(this).parents(".chat_division").attr('channel');
var position = 'n';
var doing = 'get_recent_data';
var no = $(this).parents(".chat_division").find(".comment .view_message:last").attr('for_no');
if (no) {
display_chat(classify, channel, position, doing, no);
}
else {
display_chat(classify, channel, 'n');
}
},
dblclick: function () {
var classify = $(this).parents(".chat_division").attr('classify');
var channel = $(this).parents(".chat_division").attr('channel');
var position = 'n';
var doing = 'get_recent_data';
var no = $(this).parents(".chat_division").find(".comment .view_message:last").attr('for_no');
if (no) {
display_chat(classify, channel, position, doing, no);
}
else {
display_chat(classify, channel, 'n');
}
}
});
/*
$("#chat_square_body .move_to_up").bind({
dblclick: function () {
var classify = $(this).parents(".chat_division").attr('classify');
var channel = $(this).parents(".chat_division").attr('channel');
$(this).parents(".chat_division").find(".loading_data").html("");
var position = 'p';
var doing = 'get_previous_data';
var no = $(this).parents(".chat_division").find(".comment .view_message:first").attr('for_no');
if (no) {
display_chat(classify, channel, position, doing, no);
}
else {
display_chat(classify, channel, 'p');
}
},
taphold: function () {
var classify = $(this).parents(".chat_division").attr('classify');
var channel = $(this).parents(".chat_division").attr('channel');
$(this).parents(".chat_division").find(".loading_data").html("");
var position = 'p';
var doing = 'get_previous_data';
var no = $(this).parents(".chat_division").find(".comment .view_message:first").attr('for_no');
if (no) {
display_chat(classify, channel, position, doing, no);
}
else {
display_chat(classify, channel, 'p');
}
}
})
$("#chat_square_body .move_to_down").bind({
dblclick: function () {
$(this).parents(".chat_division").find(".loading_data").html("");
var classify = $(this).parents(".chat_division").attr('classify');
var channel = $(this).parents(".chat_division").attr('channel');
var position = 'n';
var doing = 'get_recent_data';
var no = $(this).parents(".chat_division").find(".comment .view_message:last").attr('for_no');
if (no) {
display_chat(classify, channel, position, doing, no);
}
else {
display_chat(classify, channel, 'n');
}
},
taphold: function () {
$(this).parents(".chat_division").find(".loading_data").html("");
var classify = $(this).parents(".chat_division").attr('classify');
var channel = $(this).parents(".chat_division").attr('channel');
var position = 'n';
var doing = 'get_recent_data';
var no = $(this).parents(".chat_division").find(".comment .view_message:last").attr('for_no');
if (no) {
display_chat(classify, channel, position, doing, no);
}
else {
display_chat(classify, channel, 'n');
}
}
})
$(".move_to_up").bind({
click: function () {
if (!Browser.isIE) {
if ($(this).parents(".chat_division").attr('id') == 'chat_square_body') {
myScroll.scrollToElement('.view_message:first-child', 100);
}
else if ($(this).parents(".chat_division").attr('id') == 'chat_chat_body') {
myScroll_private.scrollToElement('.view_message:first-child', 100);
}
}
else {
if ($(this).parents(".chat_division").attr('id') == 'chat_square_body') {
var aaa = document.getElementById('wrapper');
aaa.scrollTop = 0;
}
else if ($(this).parents(".chat_division").attr('id') == 'chat_chat_body') {
var aaa = document.getElementById('wrapper_private');
aaa.scrollTop = 0;
}
}
}
})
$(".move_to_down").bind({
click: function () {
if (!Browser.isIE) {
if ($(this).parents(".chat_division").attr('id') == 'chat_square_body') {
//myScroll.scrollToElement('이동할 개체', 시간);
//myScroll.scrollToElement('.view_message:last-child', 100);
myScroll.scrollToPage(1, 10000000000, 100);
//myScroll.scrollTo(0,$("#chat_square_body .comment").height(),100,true);
//$("'.view_message:last-child'").css("border","solid 1px red");
}
else if ($(this).parents(".chat_division").attr('id') == 'chat_chat_body') {
//myScroll_private.scrollToElement('.view_message:last-child', 100);
myScroll_private.scrollToPage(1, 10000000000, 100);
//myScroll.scrollTo(0,$("#chat_chat_body .comment").height(),100,true);
}
}
else {
if ($(this).parents(".chat_division").attr('id') == 'chat_square_body') {
var aaa = document.getElementById('wrapper');
aaa.scrollTop = aaa.scrollHeight;
}
else if ($(this).parents(".chat_division").attr('id') == 'chat_chat_body') {
var aaa = document.getElementById('wrapper_private');
aaa.scrollTop = aaa.scrollHeight;
}
}
}
})
$("#chat_chat_body .move_to_up").bind({
dblclick: function () {
var classify = $(this).parents(".chat_division").attr('classify');
var channel = $(this).parents(".chat_division").attr('channel');
$(this).parents(".chat_division").find(".loading_data").html("");
var position = 'p';
var doing = 'get_previous_data';
var no = $(this).parents(".chat_division").find(".comment .view_message:first").attr('for_no');
if (no) {
display_chat(classify, channel, position, doing, no);
}
else {
display_chat(classify, channel, 'p');
}
},
taphold: function () {
var classify = $(this).parents(".chat_division").attr('classify');
var channel = $(this).parents(".chat_division").attr('channel');
$(this).parents(".chat_division").find(".loading_data").html("");
var position = 'p';
var doing = 'get_previous_data';
var no = $(this).parents(".chat_division").find(".comment .view_message:first").attr('for_no');
if (no) {
display_chat(classify, channel, position, doing, no);
}
else {
display_chat(classify, channel, 'p');
}
}
});
$("#chat_chat_body .move_to_down").bind({
dblclick: function () {
$(this).parents(".chat_division").find(".loading_data").html("");
var classify = $(this).parents(".chat_division").attr('classify');
var channel = $(this).parents(".chat_division").attr('channel');
var position = 'n';
var doing = 'get_recent_data';
var no = $(this).parents(".chat_division").find(".comment .view_message:last").attr('for_no');
if (no) {
display_chat(classify, channel, position, doing, no);
}
else {
display_chat(classify, channel, 'n');
}
},
taphold: function () {
$(this).parents(".chat_division").find(".loading_data").html("");
var classify = $(this).parents(".chat_division").attr('classify');
var channel = $(this).parents(".chat_division").attr('channel');
var position = 'n';
var doing = 'get_recent_data';
var no = $(this).parents(".chat_division").find(".comment .view_message:last").attr('for_no');
if (no) {
display_chat(classify, channel, position, doing, no);
}
else {
display_chat(classify, channel, 'n');
}
}
});
*/
$(".chat_message").live("click", function() {
tts_play($(this).attr("word"),$(this).attr("lang"));
});
$(".user_info, .user_info1").live("click", function () {
var user_username = $(this).attr('for_to');
display_user_info(user_username)
});
//개인 채팅 리스트에 추가된 각 목록의 삭제아이콘 클릭시
$(".private_chat_list_del").live("click", function () {
var no = $(this).parents('.private_chat_list').attr('no');
var channel = $(this).parents('[no=' + no + ']').attr('for_channel_name');
if ($("#chatting_content").attr('kmj') == channel) {
$("#chatting_content span[id=title]").text('');
$("#chatting_content span[id=bullet]").attr("login_status", '0').html(" ul > li > a').index($('[href="#chat_body"]')) ? true: false;
var is_chat_square = $("#chat_body").tabs("option", "selected") == $('#chat_body > ul > li > a').index($('[href="#chat_square_body"]')) ? true: false;
var is_chat_private = $("#chat_body").tabs("option", "selected") == $('#chat_body > ul > li > a').index($('[href="#chat_chat_body"]')) ? true: false;
var is_chat_content = ($("#chatting_list").attr('clientHeight') <= 1);
if ($(selected_id).val() && is_chat && (is_chat_square || (is_chat_private && is_chat_content))) {
if ($("#chat_chat_body #target_chat_user img").attr("login_status") == "0" && (is_chat_private && is_chat_content)) {
var user_status = '0'
}
if (flag_caret == "off") {
var message = $(selected_id).val();
}
else {
var message = $(selected_id).caret().text
}
var message = trans_item_selection();
var cmt = message;
var input_language = $("#" + $(selected_id).attr('for1')).val();
_write(cmt, input_language, user_status, "");
}
});
$("#btn_sms_ad").live("click", function () {
if (!cs_username || cs_level != '1') {
member_error_display()
}
else {
send_sms(selected_id)
}
});
$("#btn_sms").click(function () {
var content = $("#" + $("input:radio[name='input_area']:checked").attr('for1')).val();
$(this).parent('a').attr('href', "sms:" + content).trigger("click")
});
$("#btn_tel").click(function () {
var content = $("#" + $("input:radio[name='input_area']:checked").attr('for1')).val();
$(this).parent('a').attr('href', "tel:" + content).trigger("click")
});
$("#btn_camera").click(function () {
alert("Service...coming soon!");
return false
});
$("#btn_mail").click(function () {
var content = $("#" + $("input:radio[name='input_area']:checked").attr('for1')).val();
var to = '';
if(cs_username) {
$(this).parent('a').attr('hreff', "mailto:" + to).attr("class","maegu_internal lock_from").attr('content',content);
}
else {
if(mobile_device) {
$(this).parent('a').attr('href', "mailto:" + to).attr('content',content).trigger("click");
}
else {
member_error_display();
}
}
});
$("#btn_zoom").toggle(
function () {
var size_original = parseInt($("body").css("font-size"));
var size = size_original * 1.2;
$('#body_area').css({
'font-size': size
});
var is_chat = $("#tabs").tabs("option", "selected") == $('#tabs > ul > li > a').index($('[href="#chat_body"]')) ? true: false;
var is_chat_square = $("#chat_body").tabs("option", "selected") == $('#chat_body > ul > li > a').index($('[href="#chat_square_body"]')) ? true: false;
var is_chat_private = $("#chat_body").tabs("option", "selected") == $('#chat_body > ul > li > a').index($('[href="#chat_chat_body"]')) ? true: false;
var is_chat_content = ($("#chatting_list").attr('clientHeight') <= 1);
if (!Browser.isIE) {
if (is_chat && is_chat_square) {
myScroll.refresh();
myScroll.scrollToElement('.view_message:last-child', 100)
}
if (is_chat && is_chat_private && is_chat_content) {
myScroll_private.refresh();
myScroll_private.scrollToElement('.view_message:last-child', 100)
}
}
else {
if (is_chat && is_chat_square) {
var aaa = document.getElementById('wrapper');
aaa.scrollTop = aaa.scrollHeight
}
if (is_chat && is_chat_private && is_chat_content) {
var aaa = document.getElementById('wrapper_private');
aaa.scrollTop = aaa.scrollHeight
}
}
},
function () {
$('#body_area').css({
'font-size': ''
});
var is_chat = $("#tabs").tabs("option", "selected") == $('#tabs > ul > li > a').index($('[href="#chat_body"]')) ? true: false;
var is_chat_square = $("#chat_body").tabs("option", "selected") == $('#chat_body > ul > li > a').index($('[href="#chat_square_body"]')) ? true: false;
var is_chat_private = $("#chat_body").tabs("option", "selected") == $('#chat_body > ul > li > a').index($('[href="#chat_chat_body"]')) ? true: false;
var is_chat_content = ($("#chatting_list").attr('clientHeight') <= 1);
if (!Browser.isIE) {
if (is_chat && is_chat_square) {
myScroll.refresh();
myScroll.scrollToElement('.view_message:last-child', 100)
}
if (is_chat && is_chat_private && is_chat_content) {
myScroll_private.refresh();
myScroll_private.scrollToElement('.view_message:last-child', 100)
}
} else {
if (is_chat && is_chat_square) {
var aaa = document.getElementById('wrapper');
aaa.scrollTop = aaa.scrollHeight
}
if (is_chat && is_chat_private && is_chat_content) {
var aaa = document.getElementById('wrapper_private');
aaa.scrollTop = aaa.scrollHeight
}
}
});
$("#btn_login").bind("click", function () {
if (!$("#username").val() || !$("#passwd").val()) {
alert("Enter Username or Password!")
}
else {
login()
}
});
$("#check_chatting_list_heading").live("click", function () {
if ($(this).is(":checked")) {
$("#private_chatting_list_sub :checkbox").attr("checked", true)
}
else {
$("#private_chatting_list_sub :checkbox").attr("checked", false)
}
});
$("#edit_chatting_list").live("click", function () {
$(".td_private_chat_list_del").css({
'display': ''
});
$("#del_chatting_list").css({
'display': ''
});
$("#edit_chatting_list").css({
'display': 'none'
})
});
/* 선택된 채팅목록 한꺼번에 삭제 */
$("#del_chatting_list").live("click", function () {
if ($("#private_chatting_list_sub :checkbox:checked").length) {
var yes = confirm(m_confirm_delete);
if (yes == true) {
$("#private_chatting_list_sub :checkbox:checked").each(function (index, element) {
var no = $(this).parents('.private_chat_list').attr('no');
var channel = $(this).parents('[no=' + no + ']').attr('for_channel_name');
if ($("#chatting_content").attr('kmj') == channel) {
$("#chatting_content span[id=title]").text('');
$("#chatting_content span[id=bullet]").attr("login_status", '0').html(""+str_donate_invest+" ";
str += "";
str += "";
//str += "";
str += "";
str += "
";
var num = content.contents.length;
for (var i = 0; i < num; i++) {
line_comment += add_users_list(content.contents[i],'chatting_list');
}
line_comment += "
";
$("#chatting_list_sub").html(line_comment);
pc_mobile_view();
$("#chat_body").removeClass("loading");
}
$("#private_chatting_list_sub .user_me").insertAfter("#private_chatting_list_sub .heading");
}
})
}
// 친구 목록 //
function display_friends(classify) {
var str = '';
$("#chat_body").addClass("loading");
if (classify == 'list') {
var requester_str = "mode=friends&classify=" + classify + "&username="+cs_username;
}
var num_temp = Math.ceil(Math.random() * 10000);
$.ajax({
url: 'common/chat_process.php' + "?num_temp=" + num_temp,
type: 'post',
data: requester_str,
success: function (content1) {
content = eval("(" + content1 + ")");
var num = content.contents.length;
var str_heading = "";
var str_total = "";
str_heading += "