GlobalCyworldConfig = {
	cyworldDomain 			: 'http://www.cyworld.vn',
	picturaDomain 			: 'http://pictura.cyworld.vn/',
	kineDomain 				: 'http://kine.cyworld.vn/',
	
	
	
	test					: 'test'
};

 

////////////////// new msg variables //////////////////////////
/**	2007.10.13	HaNT	User Login: Can login with Email address or minihome URL.	*/
var str_msg_email_none = "Không tìm thấy địa chỉ email yêu cầu. Vui lòng thực hiện lại.";
var str_msg_minihp_domain_none = "Không tìm thấy địa chỉ Minihome yêu cầu. Vui lòng thực hiện lại.";
var str_msg_password_none = "Email và mật khẩu không khớp. Vui lòng thử lại.";
var str_msg_minihp_domain_password_none = "Địa chỉ Minihome và mật khẩu không khớp. Vui lòng thử lại.";
/*~	2007.10.13	HaNT	User Login: Can login with Email address or minihome URL.	*/
var str_msg_exit_member = "Rất tiếc, tài khoản của bạn không còn hiệu lực. Vui lòng liên hệ với Cyworld qua địa chỉ email: info@cyworld.vn.";
var str_msg_suspend_member = "Rất tiếc, tài khoản của bạn đang tạm ngừng hoạt động. Vui lòng liên hệ với Cyworld qua địa chỉ email: info@cyworld.vn.";
var str_msg_warning_member = "Rất tiếc, tư cách thành viên của bạn đang bị tạm ngừng vì vi phạm nội quy. Để có thông tin chi tiết, vui lòng liên hệ qua email: support@cyworld.vn.";
var str_msg_delete = "Bạn có chắc bạn muốn xóa không? \n Dữ liệu bị xoá không lấy lại được"
var str_msg_delete_select = "Vui lòng chọn mục bạn muốn xóa."
var str_msg_cancel = "Bạn có chắc là bạn muốn huỷ bỏ?";
var str_msg_email_input = "Vui lòng nhập địa chỉ email hoặc địa chỉ minihome của bạn.";
var str_msg_email_search = "Vui lòng nhập địa chỉ email.";
var str_msg_an_email_input = "Vui lòng nhập địa chỉ email hợp lệ.";
var str_msg_password_length = "Mật khẩu của bạn phải có độ dài từ 4 đến 14 ký tự.";
var str_msg_password_input = "Vui lòng nhập mật khẩu.";
var str_msg_repassword_input = "Vui lòng nhập lại mật khẩu.";
var str_msg_search_input = "Vui lòng nhập từ khóa tìm kiếm.";
var str_msg_id_input = "Vui lòng nhập địa chỉ cho Minihome của bạn.";
var str_msg_id_invalid_id = "Không tìm thấy Minihome nào có địa chỉ này trong hệ thống. Vui lòng thực hiện lại.";
var str_msg_none_concent = "Vui lòng nhập nội dung.";
var str_msg_none_txtSendName = "Vui lòng chọn người nhận.";
var str_msg_cp_input = "Vui lòng nhập số điện thoại di động của bạn.";
var str_msg_buddy_self = "Bạn không thể là hàng xóm của chính mình";
var str_msg_buddy_end_self = "Bạn không thể bỏ đi quan hệ với chính mình.";
var str_msg_memo_send_self = "Bạn không thể gửi tin nhắn tới chính mình.";
var str_msg_invte_send_self = "Rất tiếc. Bạn không thể mời chính mình.";
var str_msg_memo_send_ok = "Bạn có chắc bạn muốn gửi tin nhắn này?";
var str_msg_memo_end_self = "Bạn không thể chặn tin nhắn từ chính mình.";
var str_msg_buddy_friend_id_none = "Không tìm thấy thành viên này trong Cyworld. Vui lòng kiểm tra tên hoặc địa chỉ email và thử lại.";
var str_msg_email_send_process_ok = "Tin nhắn đã được gửi đi.";
var str_msg_send_cut = "Rất tiếc, mối lần bạn chỉ gửi được cho tối đa 100 người, vui lòng lược bớt danh sách người nhận và thực hiện lại.";
var str_msg_memo_cut = "Rất tiếc, nội dung không được dài quá 10,000 ký tự.";
var msg_move_minihompy = "Bạn có muốn trở về Minihome của mình?";
var str_login_msg="Vui lòng đăng nhập để sử dụng chức năng này.";
var str_msg_filling_completed = "Acorn của bạn đã được nạp thêm. Xin cảm ơn và chúc bạn mua sắm vui vẻ.";
var str_msg_filling_fail = "Không thể nạp acorn. Vui lòng thực hiện lại.";
var str_msg_appeal = "Bạn có chắc bạn muốn hỏi xin tài sản này không?";
var str_msg_select_friend = "Vui lòng chọn một người hàng xóm.";
var str_msg_input_message = "Vui lòng nhập nội dung.";
var str_msg_cymoney_spent = "Rất tiếc, bạn không đủ acorn để mua tài sản này. Vui lòng nạp thêm acorn và thực hiện lại.";
var str_msg_wishbox_cant_use_coupon = "Bạn không thể dùng những phiếu này để gửi tài sản tới danh sách Điều ước!";
var str_msg_appeal_cant_use_coupon = "Bạn không thể nhận phiếu mua hàng như một món quà.";
var str_msg_select_items = "Vui lòng chọn một tài sản.";
var str_msg_check_one = "Vui lòng chọn từ danh sách.";
var str_apply_music_item = "Bản nhạc đã được sử dụng. Chúc bạn thưởng thức vui vẻ";
var str_search_text_short = "Vui lòng nhập một từ khóa dài ít nhất 2 ký tự.";
var str_gift_reject_confirm = "Bạn có chắc bạn muốn từ chối món quà này?";
var str_item_id_is_null = "Rất tiếc, tài sản này không tồn tại.";
var str_gift_later = "Bạn có muốn gửi yêu cầu vào lúc khác không? Hệ thống sẽ lưu yêu cầu của bạn trong vòng 30 ngày.";
var str_msg_no_quest = "Bạn chưa nhận được yêu cầu nào.";
var str_msg_no_gift = "Bạn chưa nhận được món quà nào.";
var str_msg_none_name = "Vui lòng nhập tên của bạn";
var str_msg_none_fname = "Vui lòng nhập họ của bạn";
var str_msg_none_display_name = "Hãy nhập tên hiển thị mới.";
var str_msg_valid_name = "Vui lòng nhập tên bạn bằng các chữ cái và dấu gạch dưới.";
var str_msg_valid_display_name = "Vui lòng nhập tên hiển thị bằng các chữ cái và dấu gạch dưới.";
var str_msg_none_name_search = "Vui lòng nhập tên người bạn muốn tìm.";
var str_msg_none_miniid = "Vui lòng nhập địa chỉ Minihome của bạn.";
var str_msg_save_box_move = "Bạn có muốn lưu tin nhắn này vào phần Lưu trữ không?";
var str_msg_save_box_move_select = "Vui lòng chọn tin nhắn muốn chuyển";
var str_msg_memo_send_select = "Vui lòng chọn người hàng xóm bạn muốn gửi tin nhắn.";
var str_msg_receive_select = "Vui lòng chọn cá nhân hoặc nhóm mà bạn muốn chặn tin nhắn từ họ";
var str_msg_my_nickname = "Vui lòng nhập mối quan hệ của bạn với người này.";
var str_msg_other_nickname = "Vui lòng nhập mối quan hệ của người này với bạn.";
var str_msg_memo_delete = " Bạn có chắc bạn muốn xóa tin nhắn này?";
var str_msg_memo_save_move = "Bạn có muốn chuyển tin nhắn này vào phần Lưu trữ không?";
var str_msg_buddy_invite_ok = "Bạn có chắc là bạn chấp nhận thư mời này?";
var str_msg_buddy_invite_no = "Bạn có chắc bạn từ chối thư mời này?";
var str_msg_buddy_invite_reserve = "Bạn có muốn lưu lại thư mời này và sẽ quyết định sau?";
var str_msg_buddy_invite_search_cancel = "Bạn chỉ có thể hủy thư mời từ danh sách 'Thư mời chưa quyết định'.";
var str_msg_buddy_invite_search_select = "Vui lòng chọn thư mời bạn muốn hủy.";
var str_msg_buddy_invite_max = "Rất tiếc, bạn không thể lưu nhiều hơn 30 thư mời chưa quyết định. Bạn có muốn xóa thư cũ nhất để lưu những thư mới?";
var str_msg_buddy_management_group_name_input = "Vui lòng nhập tên cho nhóm.";
var str_msg_buddy_management_group_member_select = "Vui lòng chọn thành viên của nhóm.";
var str_msg_buddy_management_group_name_change = "Vui lòng chọn tên mới cho nhóm này";
var str_msg_member_key = "Số chứng thực không đúng.";
var str_msg_not_eq_password = "Sai mật khẩu.";
var str_msg_reg_email = "Rất tiếc, đã có tài khoản sử dụng địa chỉ email.";
var str_msg_process_ok = "Quá trình đã hoàn tất.";
var str_msg_icon_warning = "Không thể đưa biểu tượng vào đây.";
var str_msg_memo_blacklist_warning = "Thành viên này đã có tên trong danh sách đen của bạn.";
var str_msg_school_input = "Hãy nhập tên trường học của bạn.";
var str_msg_year_select = "Hãy chọn năm.";
var str_msg_month_select = "Hãy chọn tháng.";
var str_msg_day_select = "Hãy chọn ngày.";
var str_msg_birthday_select = "Hãy nhập sinh nhật của bạn.";
var str_msg_address_select = "Hãy nhập địa chỉ của bạn.";
var str_msg_friend_email_input = "Hãy nhập địa chỉ email của bạn mình.";
var str_msg_reg_minihp = "Rất tiếc! Địa chỉ Minihome đã được sử dụng. Vui lòng chọn địa chỉ khác.";
var str_msg_other_error = "Rất tiếc, hệ thông không thể hoàn tất việc đăng ký của bạn. Để có thông tin chi tiết, vui lòng liên hệ qua email info@cyworldinc.com ";
var str_msg_no_minihpdomain = "Vui lòng nhập địa chỉ Minihome của bạn.";
var str_msg_invite_history_delete = " Bạn có chắc Bạn muốn xoá (những) người được mời? ";
var str_msg_invite_history_select = "Hãy chọn (những) người được mời mà bạn muốn xoá."; 

//ps_person_info.js
var str_msg_email_check_input = "Vui lòng kiểm tra lại địa chỉ email của bạn cho đúng định dạng. Ví dụ tenban@tencongty.com";
var str_msg_email_check_reinput = "Vui lòng xác nhận lại địa chỉ email mới của bạn.";
var str_msg_email_double = "Bạn đã đăng ký bằng địa chỉ email này. Để thay đổi, vui lòng nhập một địa chỉ email mới.";
var str_msg_password_reinput = "Vui lòng nhập mật khẩu mới.";
var str_msg_password_reinput_too ="Vui lòng nhập mật khẩu mới.";
var str_msg_password_double = "Vui lòng xác nhận lại mật khẩu mới.";
var str_msg_password_mismatch = "Mật khẩu không khớp.";
var str_msg_empty_display_name = "Vui lòng nhập tên hiển thị";

//ps_profile_personal_info.php
var str_msg_authority = "Rất tiếc, bạn không có quyền truy nhập phần này.";
var str_msg_person_search_type = "Nếu bạn chọn chức năng Không thể tìm kiếm, các thành viên khác sẽ không thể tìm thấy bạn thông qua chức năng Tìm kiếm thành viên.";
var str_msg_random_move_type = "Nếu bạn chọn chức năng Không thể tìm kiếm, các thành viên khác sẽ không thể xem được Minihome của bạn thông qua chức năng Xem ngẫu nhiên một Minihome.";

// ps_only.js
var str_msg_no_mh_title = "Vui lòng nhập tiêu đề cho Minihome của bạn.";
var str_msg_no_img = "Vui lòng tải ảnh lên.";
var str_msg_no_folder_name = "Vui lòng nhập tên thư mục.";
var str_msg_no_menu_name = "Vui lòng nhập tên Tab.";

// ps ??? ?? by ???
var msg_item_appaly = "Tài sản của bạn đã được sử dụng.";
var msg_item_appaly_confirm = "Bạn có chắc muốn sử dụng tài sản này?";
var msg_item_apply_confirm = "Bạn có chắc muốn sử dụng tài sản này?";
var msg_item_disappaly_confirm = "Bạn có muốn loại bỏ tài sản khỏi Miniroom?";
var msg_item_disappaly_charms_confirm = "Bạn có muốn loại bỏ chuông gió đang dùng khỏi Minihome?";
var msg_item_disappaly_skins_confirm = "Bạn có muốn loại bỏ hình nền đang dùng khỏi Minihome?";
var msg_item_disappaly = "Tài sản đã được loại bỏ khỏi Miniroom.";
var msg_item_disappaly_charms = "Chuông gió đã được loại bỏ.";
var msg_item_disappaly_skins = "Hình nền đã được loại bỏ.";
var str_msg_item_enable = "Tài sản của bạn đã có hiệu lực.";
var str_msg_item_disable = "Tài sản của bạn đã được vô hiệu hóa.";
var str_msg_item_delete = "Tài sản của bạn đã được xóa.";
// PS ?? ??? - by ???
var str_msg_no_member = "Vui lòng đăng nhập";
var str_msg_plz_login = "Vui lòng đăng nhập.";
var str_msg_no_selected_del_post = "Bạn chưa chọn mục dữ liệu nào.";
var str_msg_confirm_update =" Bạn có chắc bạn muốn cập nhật Minihome?.";
var str_msg_confirm_delete = "Bạn có chắc muốn xóa không? \n Dữ liệu bị xóa sẽ không lấy lại được.";
var str_msg_bookmark_no_title = "Vui lòng nhập tên cho địa chỉ trang web.";
var str_msg_no_url = "Vui lòng nhập địa chỉ cho trang web.";
var str_msg_select_just_one = "Các địa chỉ web hay chỉ được lưu trong một thư mục. Vui lòng chọn một.";
var str_msg_no_title = "Vui lòng nhập tiêu đề.";
var str_msg_no_content = "Vui lòng nhập chú thích.";
var str_msg_without_content = "Vui lòng nhập nội dung.";
var str_msg_no_music_title = "Chưa có tên bản nhạc.";
var str_msg_no_artist = "Chưa có tên nghệ sĩ.";
var str_msg_no_img = "Vui lòng tải ảnh lên.";
var str_msg_no_comment = "Vui lòng nhập lời bình luận.";
var str_msg_no_search_value = "Không tìm thấy nội dung yêu cầu.";
var str_msg_diary_no_emoticon = "Vui lòng chọn một trạng thái để diễn tả cảm xúc của bạn.";
var str_msg_diary_no_weather = "Vui lòng chọn thời tiết ngày hôm nay.";
var str_msg_no_selected_move_post = "Vui lòng chọn tài sản muốn di chuyển.";
var str_msg_no_friends_note = "Vui lòng để lại lời bình luận.";
var str_msg_no_select_folder = "Vui lòng chọn thư mục.";
var str_msg_no_cp = "Vui lòng nhập số điện thoại di động để tiếp tục.";
var str_msg_no_anniverdary = "Vui lòng nhập ngày sinh để tiếp tục.";
var str_msg_no_message = "Vui lòng điền đầy đủ thông tin tại các trường bắt buộc.";
var str_msg_cant_upload = "Rất tiếc, file của bạn không thể tải lên."; 
var str_msg_over_file_size = "File đính kèm không được vượt quá 2MB.";
var str_msg_public_view =  "Switchover đang MỞ";
var str_msg_private_view =  "Switchover đang ĐÓNG";
var str_msg_public_change =  "Bạn có chắc bạn muốn chuyển nó sang trạng thái MỞ không?";
var str_msg_private_change =  "Bạn có chắc chắn muốn chuyển nó sang trạng thái ĐÓNG không?";
var str_msg_img_none =  "Vui lòng tải ảnh lên.";
var str_msg_no_authority = "Rất tiếc, bạn không có quyền đọc phần này.";
var str_msg_limit_tab_name = "Tên Tab không được dài quá 8 kí tự.";
var str_msg_limit_creating_tab = "Bạn chỉ có thể tạo tối đa 7 Tab.";
var str_msg_confirm_register_coverstory = "Bạn có muốn lưu Lời dẫn không?";
var str_msg_over_max_string_length = "Số ký tự tối đa là ***.";

// PS ??? by ???
var str_msg_select_em_none = "Vui lòng chọn một trạng thái để diễn tả cảm xúc của bạn.";
var str_msg_select_wea_none = "Vui lòng chọn thời tiết ngày hôm nay.";

// PS ??? by zmania
var str_msg_submit_with_file = "Vui lòng chọn file đính kèm.";
var str_msg_submit_with_video = "Vui lòng chọn video.";

// PS by adou
var str_msg_at_least_one_folder = "Vui lòng tạo ít nhất một thư mục.";
var str_msg_delete_folder_confirm = "Bạn có chắc bạn muốn xóa thư mục này và tất cả nội dung của nó không? Dữ liệu bị xóa sẽ không lấy lại được";
var str_msg_at_least_one_tab = "Vui lòng sử dụng ít nhất 1 tab trong Minihome.";
var str_msg_delete_tab_confirm = "Bạn có chắc bạn muốn xóa Tab này và tất cả nội dung của nó? Dữ liệu bị xóa không lấy lại được.";
var str_msg_bad_folder_name = "Bạn không thể dùng những chữ này để đặt tên cho thư mục.";

// 2005-06-21 by bate
var str_msg_gift_CyMoney_is_zero = "Bạn đã hết acorn. Vui lòng nạp thêm."

//replaced old variable 2006-08-14  by Alton
var FOUND_DENY_WORDS = "Nội dung bạn vừa nhập có chứa từ không cho phép theo quy định của Cyworld. Xin vui lòng tuân thủ nội quy để cùng xây dựng một cộng đồng lành mạnh.";
var FOUND_DENY_CHARACTERS = "Rất tiếc. Hiện nay hệ thống Cyworld Vietnam không hỗ trợ font quốc tế.  Để biết thêm chi tiết, vui lòng truy cập phần Trợ giúp";

// Club > Club_gen_step1_proc.php by shlee
var str_msg_some_item_no_data = "Bạn chưa điền đầy đủ thông tin. Vui lòng thực hiện lại.";
var str_msg_clubkeyword_must_one_more = "Vui lòng nhập ít nhất một từ để mô tả CLB.";
var str_msg_cancel_clubclose = "Việc đóng cửa CLB đã được huỷ bỏ";
var str_msg_clubclose = "CLB của bạn đã được đóng.";

// 2006.08.02 by Alex
var str_msg_choose_board_to_add = "Chọn mục để thêm.";
var str_msg_choose_board_to_delete = "Chọn mục để xoá.";
var str_msg_confirm_delete_board = "Bạn có chắc muốn xoá mục này?";
var str_msg_open_board_cannot_delete = "Mục đang mở không thể xoá được.";
var str_msg_delete_all_board = "Tất cả các bài viết trong mục cũng sẽ bị xoá";
var str_msg_select_title_folder = "Chọn tên cho thư mục.";
var str_msg_select_board_for_comment = "Chọn mục để gửi bình luận.";
var str_msg_select_board_for_anounymous = "Chọn mục muốn ẩn tên.";
var str_msg_select_board_for_indent = "Chọn mục để làm mục con";
var str_msg_head_cannot_indent = "Mục gốc không thể chuyển thành mục con.";
var str_msg_select_board_to_move = "Chọn mục muốn di chuyển";
var str_msg_select_board_for_rename = "Chọn mục muốn đổi tên";

var str_msg_sure_accept = "Bạn có chắc là bạn đồng ý?";
var str_msg_sure_deny = "Bạn có chắc là bạn từ chối?"; 
var str_msg_accept_clubhandover = "Bạn vừa đồng ý với đề nghị chuyển giao quyền chủ tịch CLB.";
var str_msg_accept_clubinvite = "Bạn vừa nhận lời mời tham gia CLB này và hiện bạn đã là thành viên. Chúc bạn vui vẻ tại CLB!";
var str_msg_deny_clubhandover = "Bạn vừa từ chối đề nghị chuyển giao quyền chủ tịch CLB.";
var str_msg_deny_clubinvite = "Bạn vừa từ chối lời mời tham gia CLB này.";

// Mall > Music
// 2006.08.07
var str_msg_select_at_least_one = "Vui lòng chọn ít nhất một bài hát từ danh sách";
var str_msg_confirmation_box = "Bạn có thể mua các tài sản đã chọn ngay bây giờ hoặc hoặc tiếp tục xem các trang khác. Nếu bạn xem các trang khác, bạn sẽ mất danh sách các tài sản đã chọn. ";

// Mall > Send Gift
var str_msg_not_enough_money = "Rất tiếc, bạn không có đủ acorns.";
var str_msg_select_at_least_one_item = "Vui lòng chọn ít nhất một tài sản";
/**	2007.04.18	HaNT	Prevent sending gift by default acorns.	*/
var str_prevent_sending_gift_by_default_acorn = "Bạn chỉ có thể tặng quà khi bạn đã thực hiện nạp hạt dẻ.";
/**~2007.04.18	HaNT	Prevent sending gift by default acorns.	*/
////////////////////////////////// new msg variables ////////////////////////////////////

//Begin: MinhNB 2007.10.17
var str_login_caps_lock_alert = '<table cellpadding="0" cellspacing="0" border="0" id="balloon_table"><tr><td><img src="http://img.cyworld.vn/image/common/reg-balloon2_1.gif" height="14" width="179" alt="" align="top"/></td></tr><tr><td id="balloon_bg2"></td></tr><tr><td><img src="http://img.cyworld.vn/image/common/reg-balloon2_2.gif" height="28" width="179" alt="" align="bottom"/></td></tr></table><div id="ba2" class="btext">Đang bật <b>Caps Lock</b> <br />Mật khẩu của bạn có thể không chính xác. <br /> Bấm CapsLock một lần nữa để tắt chế độ này. </div>';
//End: MinhNB 2007.10.17

// ???(??)
var int_star_sign_cnt = 12;
var str_my_star_name = new Array();
str_my_star_name[1] = new Array("Bảo Bình","Bảo Bình");
str_my_star_name[2] = new Array("Song Ngư","Song Ngư");
str_my_star_name[3] = new Array("Dương Cưu","Dương Cưu");
str_my_star_name[4] = new Array("Kim Ngưu","Kim Ngưu");
str_my_star_name[5] = new Array("Song Nam","Song Nam");
str_my_star_name[6] = new Array("Cự Giải","Cự Giải");
str_my_star_name[7] = new Array("Sư Tử","Sư Tử");
str_my_star_name[8] = new Array("Xử Nữ","Xử Nữ");
str_my_star_name[9] = new Array("Thiên Bình","Thiên Bình");
str_my_star_name[10] = new Array("Hổ Cáp","Hổ Cáp");
str_my_star_name[11] = new Array("Nhân Mã","Nhân Mã");
str_my_star_name[12] = new Array("Nam Dương","Nam Dương");

var str_my_star_chk = new Array();
str_my_star_chk[1] = new Array(121,218);
str_my_star_chk[2] = new Array(219,320);
str_my_star_chk[3] = new Array(321,420);
str_my_star_chk[4] = new Array(421,520);
str_my_star_chk[5] = new Array(521,621);
str_my_star_chk[6] = new Array(622,722);
str_my_star_chk[7] = new Array(723,822);
str_my_star_chk[8] = new Array(823,922);
str_my_star_chk[9] = new Array(923,1021);
str_my_star_chk[10] = new Array(1022,1121);
str_my_star_chk[11] = new Array(1122,1221);

// ??? ? ?? ??
var MyHompy_GSP;
var Communication_GSP;
var MyHome_Window;//new popup  for MyHome
var CyWorld_GSP;
var YourHompy_GSP;
var Top_Window;
var opener_chk;
/*
if(!window.name){
	//alert("??? ??");
	window.name = "CyWorld_GSP";
	CyWorld_GSP = this.window;
	alert("?????? ??");
}
else{
	if(window.name == "my_buddy"){
		CyWorld_GSP = top.window.GSP_BASE_MAIN;
	}
	else{
		opener_chk = top.opener;
		//alert(opener_chk);
		CyWorld_GSP = top.opener;
	}
}
*/
//alert(window.name);
if(!window.name){
	//alert("??? ??");
	window.name = "GSP_BASE_MAIN";
	CyWorld_GSP = this.window;
//	alert("?????? ??");
}
else{
	if(window.name == "GSP_BASE_MAIN"){
		CyWorld_GSP = this.window;
	}
}
//document.title = "??? ??? "+window.name+" ???.";
// ??? ? ?? ?

// ??(???)??(??)
function MsgCheck(strMessage) { if(confirm(strMessage)) { return true; } else { return false; } }
// ?? ??(??)-??? ?? ??
function fncChkBoxALL()						
	{
	var IsChecked = true;
	var ChkObj = document.all["ChkBox"];
	var ChkBoxCnt = ChkObj.length;

	if(!ChkBoxCnt) { if(IsChecked == true) { ChkObj.checked = true; } else { ChkObj.checked = false; } }
	else {
		
		for(var i=0; i < ChkBoxCnt; i++) {
			IsChecked=ChkObj[i].checked;
			if(IsChecked == false) { 
				ChkObj[i].checked = true; 
			} 
			else { 
				ChkObj[i].checked = false; 
			} 
		} 
	}
}

// this one works
function fncChkBoxALLDyn(fn) {
	var IsChecked = true;
	var ChkObj = fn.ChkBox;
	var ChkBoxCnt = ChkObj.length;
	if (!ChkBoxCnt) {
		 if(ChkObj.checked == false) {
		 	ChkObj.checked = true;
		 }
		 else {
		 	ChkObj.checked = false;
		 }
	}
	else {
		
		for(var i=0; i < ChkBoxCnt; i++) {
			IsChecked=ChkObj[i].checked;
			if(IsChecked == false) { 
				ChkObj[i].checked = true; 
			} 
			else { 
				ChkObj[i].checked = false; 
			} 
		} 
	}
}
	
		
// ?? ??/ ?? ?? ??(??)
function ChkBoxALL()
	{
	var IsChecked;
	var inputs = document.getElementsByTagName('input');
	if (!inputs) return;
	
	for (var i=0; i<inputs.length; i++) {
		if (inputs[i].name=='ChkBoxAll')
			IsChecked = inputs[i].checked;
	}

	for (var i=0; i<inputs.length; i++) {
		if (inputs[i].name=='ChkBox') {
			var ChkObj = inputs[i];
			if(IsChecked == true) { ChkObj.checked = true; } else { ChkObj.checked = false; }
		}
	}
		
	}
// ???? ?? ?? ??(??)

function ChkStateCheck()					
	{
	var inputs = document.getElementsByTagName('input');
	
	if(inputs){
		for (var i=0; i<inputs.length; i++) {
			if (inputs[i].name=='ChkBox') {
				var ChkObj = inputs[i];
				if(ChkObj.checked == true) { return true; }
			}
		}
	}
	return false;
	}
// ??? ??(??) - ????
function ChkSelValues(fn){
	var ChkValues = ""; 
	var ChkNum = 0; 

	var inputs = document.getElementsByTagName('input');
	if (!inputs) return false;

	for (var i=0; i<inputs.length; i++) {
		if (inputs[i].name=='ChkBox') {
			var ChkObj = inputs[i];
			if(ChkObj.checked == true) { if(ChkNum == 0) { ChkValues += ChkObj.value ; ChkNum = 1; } else { ChkValues += "," + ChkObj.value; } }
		}
	}

	fn.ChkValues.value = ChkValues;	// ??? ??? ( ??? : ',')

	if (ChkValues == "") { return false; } else { return true; }
}

// cross-platform checkbox checking
// you HAVE to pass the form name with this function (fn)
function ChkSelValuesDyn(fn){
	var ChkValues = ""; 
	var ChkObj = fn.ChkBox;
	var ChkBoxCnt = ChkObj.length;
	var ChkNum = 0; 

	if(!ChkBoxCnt) { if(ChkObj.checked == true) { ChkValues = ChkObj.value ; } }
	else { for(var i = 0; i < ChkBoxCnt; i++) { if(ChkObj[i].checked == true) { if(ChkNum == 0) { ChkValues += ChkObj[i].value ; ChkNum = 1; } else { ChkValues += "," + ChkObj[i].value; } } } }

	fn.ChkValues.value = ChkValues;	// ??? ??? ( ??? : ',')

	if (ChkValues == "") { return false; } else { return true; }
}

// ??? ??(??) - ??? ??
function SelSelValues(fn, objSelect){
	var ChkValues = ""; 
	var strReceiveList = ""; 
	var intSelectLen = objSelect.length;
	var intNum = 0;

	for(var i = 0; i < intSelectLen; i++){ 
		if(objSelect.options[i].selected){
			if(intNum == 0){ 
				ChkValues = objSelect.options[i].value ;
				strReceiveList = objSelect.options[i].text ;
				intNum = 1; 
			}else{
				ChkValues += "," + objSelect.options[i].value ;
				strReceiveList += "," + objSelect.options[i].text ;
			}
		}
	}

	fn.ChkValues.value = ChkValues;			// ??? ??? ( ??? : ',')
	fn.hidReceiveList.value = strReceiveList;	// ??? ????? ( ??? : ',')

	if (ChkValues == "") { return false; } else { return true; }
}
// ??? ??? ?? ?? ??(??)
function fncSelectValues(fn, objSelect){
	var ChkValues = ""; 
	var strReceiveList = ""; 
	var intSelectLen = objSelect.length;
	var intNum = 0;

	for(var i = 0; i < intSelectLen; i++){ 
		if(intNum == 0){ 
			ChkValues = objSelect.options[i].value ;
			strReceiveList = objSelect.options[i].text ;
			intNum = 1; 
		}else{
			ChkValues += "," + objSelect.options[i].value ;
			strReceiveList += "," + objSelect.options[i].text ;
		}
	}

	fn.ChkValues.value = ChkValues;			// ??? ??? ( ??? : ',')
	fn.hidReceiveList.value = strReceiveList;	// ??? ????? ( ??? : ',')

	if (ChkValues == "") { return false; } else { return true; }
}

/**	2007.10.15	HaNT	User Login: Can login with Email address or minihome URL.	*/
function LoginCheck(fn)
{
	//var fn = document.frmLogin;	
	
	if ( (trim(fn.txtEmail.value) == "") || (trim(fn.txtEmail.value) == "Email hoặc Minihome") ) 
	{ 
		alert(""+ str_msg_email_input +""); fn.txtEmail.focus(); return false; 
	}
	
	if(!IsEmail(fn.txtEmail.value))
	{
		//alert(" Vui lòng nhập đúng định dạng địa chỉ email.\n Ví dụ: cyworld@cyworld.vn");
		//fn.txtEmail.focus();
		fn.hidLoginType.value = "MINIHP_DOMAIN";
		//return false;
	}
	else
	{
		fn.hidLoginType.value = "";
	}
	
	if (fn.txtPassword.value == "")
	{ 
		alert(""+ str_msg_password_input +""); fn.txtPassword.focus(); return false; 
	}
	fn.submit();
	return true;
}
/*~	2007.10.15	HaNT	User Login: Can login with Email address or minihome URL.	*/

// ?? ?? ???? ??(??)
function WinOpen(strUrl,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty){	

	var x=screen.width/2 - WinWidth/2;
	var y=screen.height/2 - WinHeight/2;
	var OpBrWin;
	try
	{
		if (WinGubun == "" || WinGubun == "Normal")															// ???? ??? ? ??(? ??, ???, ????)
			{ OpBrWin = window.top.open(''+strUrl+'',''+strName+'','scrollbars='+ScrollBar+',resizable='+Resize+',width='+WinWidth+',height='+WinHeight+','+strProperty+''); }
		else if(WinGubun == "Center_Top")									
			{ OpBrWin = window.top.open(''+strUrl+'',''+strName+'','left='+x+', top='+0+', width='+WinWidth+', height='+WinHeight+',scrollbars='+ScrollBar+',resizable='+Resize+','+strProperty+''); }
		else																				// ??? ?? ???? ????? ??.(WinGubun : Center)
			{ OpBrWin = window.top.open(''+strUrl+'',''+strName+'','left='+x+', top='+y+', width='+WinWidth+', height='+WinHeight+',scrollbars='+ScrollBar+',resizable='+Resize+','+strProperty+''); }
	}
	catch(e)
	{
		OpBrWin = window.open(''+strUrl+'',''+strName+'','left='+x+', top='+y+', width='+WinWidth+', height='+WinHeight+',scrollbars='+ScrollBar+',resizable='+Resize+','+strProperty+'');
	}
	if(OpBrWin){
		OpBrWin.focus();
		//OpBrWin.location.replace(strUrl);
		OpBrWin.location=strUrl;
	}
	return(OpBrWin);
}

function WinOpen2(strUrl,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty){	
	var x=screen.width/2 - WinWidth/2;
	var y=screen.height/2 - WinHeight/2;
	var OpBrWin;

	if (WinGubun == "" || WinGubun == "Normal")															// ???? ??? ? ??(? ??, ???, ????)
		{ OpBrWin2 = window.open(''+strUrl+'',''+strName+'','scrollbars='+ScrollBar+',resizable='+Resize+',width='+WinWidth+',height='+WinHeight+','+strProperty+''); }
	else																													// ??? ?? ???? ????? ??.(WinGubun : Center)
		{ OpBrWin2 = window.open(''+strUrl+'',''+strName+'','left='+x+', top='+y+', width='+WinWidth+', height='+WinHeight+',scrollbars='+ScrollBar+',resizable='+Resize+','+strProperty+''); }

	if(OpBrWin){
		OpBrWin2.focus();
	}
	return(OpBrWin2);
}
function WinOpenMyHome(strUrl,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty){	
	var x=screen.width/2 - WinWidth/2;
	var y=screen.height/2 - WinHeight/2;																								// ??? ?? ???? ????? ??.(WinGubun : Center)
	OpBrWin = window.open(''+strUrl+'',''+strName+'','left='+x+', top='+y+', width='+WinWidth+', height='+WinHeight+',scrollbars='+ScrollBar+',resizable='+Resize+','+strProperty+'');
	
	if(OpBrWin){
		OpBrWin.focus();
		//OpBrWin.location.replace(strUrl);
		OpBrWin.location=strUrl;
	}
	return(OpBrWin);
}

// ?? ??(??)
function NumberCheck(str){
	var comp="0123456789";
	var len=str.length;
	for(i=0; i<len; i++) { if(comp.indexOf(str.substring(i,i+1))<0) { return true; } }
	return false;
}

function PNumberCheck(str){
	var comp="0123456789()- +";
	var len=str.length;
	for(i=0; i<len; i++) { if(comp.indexOf(str.substring(i,i+1))<0) { return true; } }
	return false;
}

//??? ?? ??(??)
function IsEmail(s)	
{ 
	return s.search(/^\s*[\w\~\-\.]+\@[\w\~\-]+(\.[\w\~\-]+)+\s*$/g)>=0; 
}
//?? ?? ??? ?? ??(??)===>?? ?? ?? ????? ??
function fncCancel(strMode) { if(strMode == "POPUP") { window.close(); } else { document.location.href = "index.php"; } }
//?? ?? ??? ?? ??(??)
//############## ?? ??(??? ??? ???? ??/?? ??? ??? #############
function Cancel() { document.location.href = "index.php"; }
// ???? ?? ??(??)
function go_minihompy(login_id){
	//alert(document.frmMy_buddy.my_buddy.selectedIndex);
	//frmMy_buddy=eval(document.frmMy_buddy);
	//alert(frmMy_buddy);
	var mh_id = document.frmMy_buddy.my_buddy.options[document.frmMy_buddy.my_buddy.selectedIndex].value;
	if(!isNaN(mh_id) && mh_id != ''){		
		open_minihompyNEW(mh_id, login_id);
	}
}


//???? ???(??)############## ???? ?? #############
function OpenPSHome(strName,strGetData){
	//alert("open_minihompy(mh_id, login_id) <- ? ??????.");
	/*
	var strUrl = "/ps/ps_gate.php" + strGetData;
	var strUrlTmp = "about:blank";
	var WinWidth = "950";
	var WinHeight = "720";
	var ScrollBar = "yes";
	var Resize = "no";
	var WinGubun = "Center";
	var strProperty = "";
	
	ps_win = WinOpen(strUrlTmp,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty);
	ps_win.location.replace(strUrl);
	*/
}
//?? => ?? ??(??)
function LeftPersonSearchPro(strMode){
	var fn = document.frmLeftPersonSearch;

	fn.hidMode.value = strMode;

	// ?? ???? ?? ?? ???
	if (strMode == "Research"){
		var rdoObj = document.all["rdoSearchChoice"];
		var intObj = rdoObj.length;
		var strData = "";
		var strSearchText = fn.txtSearchText.value;

		if (strSearchText == "") { alert(""+ str_msg_search_input +""); fn.txtSearchText.focus(); return; }

		for(var i = 0; i < intObj; i++) { if(rdoObj[i].checked == true) { strData = rdoObj[i].value; } }

		if (strData == "name") { fn.action = "person_search.php?rdoSearchChoice="+strData+"&txtName=" + strSearchText; fn.submit(); }
		else if (strData == "email") { fn.action = "person_search.php?rdoSearchChoice="+strData+"&txtEmail=" + strSearchText; fn.submit(); }
		else if (strData == "cp") { fn.action = "person_search.php?rdoSearchChoice="+strData+"&txtCPAll=" + strSearchText; fn.submit(); }
	}
}
//?? UI ???(??)
function OpenNameUIPublic(strName, strGetData){
	//???? ?? ???
	if(strName == "WinBuddyMake"){
		var strUrl = "/common/include/buddy_invite_makeC_Wview.php" + strGetData;
//		var strUrl = "/common/include/buddy_invite_requestedC_Wview.php" + strGetData;	// ?? ?? ??
		var WinWidth = "400";
		var WinHeight = "500";
	}
	// Remove neighbors
	else if(strName == "WinBuddyRemove") {
		var strUrl = "/common/include/buddy_remove_Wview.php" + strGetData;
		var WinWidth = "400";
		var WinHeight = "500";
	}
	//???? ?? > ??? ?? ?? ???
	else if(strName == "WinBuddyReceiver"){
		var strUrl = "/common/include/buddy_invite_receiverC_Mview.php" + strGetData;
		var WinWidth = "400";
		var WinHeight = "500";
	}
	//?? ???
	else if(strName == "WinMemoSend"){
		//var strUrl = "/main/memo_writeC_Wview.php" + strGetData;
		var strUrl = "/communication/memo_writeC_Wview.php" + strGetData;
		var WinWidth = "400";
		var WinHeight = "500";
	}
	//?? ??? ???? ???
	else if(strName == "WinBuddyNameChange"){
		//alert(strGetData);
		//var strUrl = "/main/buddy_name_changeC_Wview.php" + strGetData;
		
		var strUrl = "/common/include/buddy_change_makeC_Wview.php" + strGetData;
		var WinWidth = "400";
		var WinHeight = "500";
		
	}
	else if(strName == "WinBuddyNameChange_re"){
		var strUrl = "/common/include/buddy_change_re_makeC_Wview.php" + strGetData;
		var WinWidth = "400";
		var WinHeight = "500";
	}
	else if(strName == "WinBuddyInvite" ) {
		// it requires to go through the template below to process
		var strUrl = "/common/include/buddy_invite.php" + strGetData;
		var WinWidth = "400";
		var WinHeight = "500";
	}
	else if(strName == "WinClubInvite" ) {
		// it requires to go through the template below to process
		var strUrl = "/common/include/buddy_invite_club_Wview.php" + strGetData;
		var WinWidth = "400";
		var WinHeight = "500";
	}
	
	var ScrollBar = "no";
	var Resize = "no";
	var WinGubun = "Center";
	var strProperty = "";
	WinOpen(strUrl,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty);
}


//??? ? ???(??)
function OpenPublic(fn, strName, strGetData){
	
	//???? > ??? ?? ?? ???
	if(strName == "WinEmailCkeck"){
		//if(fn.txtEmailReg.value == "") { alert("Nhập địa chỉ email."); fn.txtEmailReg.focus(); return; }
		var strUrl = "/main/member_email_check.php" + strGetData;
		var WinWidth = "500";
		var WinHeight = "220";
	}
	//???? > ???? ?? ?? ???
	else if(strName == "WinID"){
//		if(fn.txtID.value == "") { alert("" + str_msg_id_input + ""); fn.txtID.focus(); return; }
		var strUrl = "/main/member_idcheck_C_view.php" + strGetData;
		var WinWidth = "388";
		var WinHeight = "238";
	}
	else if(strName == "WinUrlCheck"){
		//alert(strGetData);
//		if(fn.txtID.value == "") { alert("" + str_msg_id_input + ""); fn.txtID.focus(); return; }
		var strUrl = "/main/member_idcheck_inline.php" + strGetData;
		var WinWidth = "0";
		var WinHeight = "0";
	}	
	
	else if(strName == "RegSchool"){
		var strUrl = "/myhome/setting/pop_regist_school_proc.php" + strGetData;
		var WinWidth = "0";
		var WinHeight = "0";
	}	
	
	//???? > ?? ?? ???
	else if(strName == "WinSchoolSearch"){
		var strUrl = "/main/search_school_C_Wview.php" + strGetData;
		var WinWidth = "470";
		var WinHeight = "420";
		var ScrollBar = "yes";
		var Resize = "no";
		var WinGubun = "Normal";
		var strProperty = "";

		WinOpen(strUrl,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty);
		return;
	}
	//??? > ???? ???
	else if(strName == "WinMemoView"){
		var strUrl = "/main/memo_readC_view.php" + strGetData;
		var WinWidth = "400";
		var WinHeight = "500";
		var strName = "CygramWin";
	}
	//?? ??? > ??/?? > ???? ?? ???
	else if(strName == "WinMemoAddReceiver"){
		var strUrl = "/main/memo_write_add_receiverC_Mview.php" + strGetData;
		var WinWidth = "444";
		var WinHeight = "272";
		var strName = "AttachRecWin";
	}
	else if(strName == "CommunicationWinMemoAddReceiver"){
		var strUrl = "/communication/memo_write_add_receiverC_Mview.php" + strGetData;
		var WinWidth = "444";
		var WinHeight = "272";
		var strName = "AttachRecWin";
	}
	//?? ??? > ?? ??? ?? ?? ?? ???
	else if(strName == "WinBuddyInviteI"){
		var strUrl = "/main/buddy_invite_i_requestedC_view.php" + strGetData;
		var WinWidth = "400";
		var WinHeight = "500";
		var strName = "CygramWin";
	}
	//?? ??? > ?? ??? ?? ?? ?? ???
	else if(strName == "WinBuddyInviteMe"){
		var strUrl = "/main/buddy_invite_me_requestedC_Wview.php" + strGetData;
		var WinWidth = "400";
		var WinHeight = "500";
		var strName = "CygramWin";
	}
	//?? ??? ??? ??
	else if(strName == "WinIndexMyHompy_GSP"){
		var strUrl = "/ps/ps_gate.php" + strGetData;
		var strUrlTmp = "about:blank";
		var strName = "MyHompy_GSP";
		var WinWidth = "932";
		var WinHeight = "572";
		var ScrollBar = "no";
		var Resize = "no";
		var WinGubun = "Center";
		var strProperty = "";
		MyHompy_GSP = WinOpen(strUrlTmp,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty);
		MyHompy_GSP.location.replace(strUrl);	
		return;
	}
	//???? > ???? > ???? ?? ???
	else if(strName == "WinWaitView"){
		var strUrl = "/main/buddy_invite_waitingC_view.php" + strGetData;
		var WinWidth = "388";
		var WinHeight = "380";
	}
	//?? > ??? ????? ??? ?? ???
	else if(strName == "WinOutLook"){
		var strUrl = "/main/buddy_invite_outlookC_Wview.php" + strGetData;
		var WinWidth = "438";
		var WinHeight = "475";
	}

	var ScrollBar = "no";
	var Resize = "no";
	var WinGubun = "Normal";
	var strProperty = "";

	WinOpen(strUrl,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty);
}


function OpenPublicMnh(fn, strName, strGetData){
	//???? > ??? ?? ?? ???
	
	if(strName == "WinUrlCheck"){
//		if(fn.txtID.value == "") { alert("" + str_msg_id_input + ""); fn.txtID.focus(); return; }
		var strUrl = "/main/member_idcheck_inline.php" + strGetData;
		var WinWidth = "0";
		var WinHeight = "0";
	}	
	var ScrollBar = "no";
	var Resize = "no";
	var WinGubun = "Normal";
	var strProperty = "";

	WinOpen(strUrl,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty);
}

//???? > ??? ?? ??(???/ ????)
function DoubleCheckPro(strMode){
	if (strMode == "EmailCheck")		// ?? ?? > ??? ??
		{ window.opener.document.frmMember.txtEmail.value='';window.close(); }
	else if (strMode == "IDCheck")		// ?? ??(??) > ?? ?? ??
		{ window.opener.document.frmMember.txtID.value='';window.close(); }
}
//?? ?? ???? ???? > ???
function fncQuickSearchSelectSet(strSearchType){
	var fn = document.frmQuickPersonSearch;

	fn.hidSearchSelect.value = strSearchType;

	if(strSearchType == "email"){
		tblQuickEmail.style.display = 'inline';
		tblQuickCP.style.display = 'none';
	}
	else if(strSearchType == "cp"){
		tblQuickEmail.style.display = 'none';
		tblQuickCP.style.display = 'inline';
	}
}
//?? ?? ???? ????
function fncQuickPersonSearch(strUrl){
	var fn = document.frmQuickPersonSearch;
	var GetData = "?strQuickSearch=Yes&strQuickChoice=" + fn.hidSearchSelect.value;

	if(fn.hidSearchSelect.value == "email"){
		var strEmail = fn.txtEmail.value;
		if (!IsEmail(strEmail)) { alert("" + str_msg_an_email_input + ""); fn.txtEmail.value = ""; fn.txtEmail.focus(); return; }
		GetData = GetData + "&strEmail=" + fn.txtEmail.value;
	}else if(fn.hidSearchSelect.value == "cp"){
		if (fn.txtCP.value == '') { alert("" + str_msg_cp_input + ""); fn.txtCP.value = ""; fn.txtCP.focus(); return; }
		if (NumberCheck(fn.txtCP.value)) { alert("" + str_msg_cp_input + ""); fn.txtCP.value = ""; fn.txtCP.focus(); return; }
		GetData = GetData + "&strCP=" + fn.txtCP.value;
	}

	fn.action = strUrl + GetData; fn.submit();
}
//?? ?? ???? ???? ?? ? ???? ?? ??
function fncQuickWaitPro(strUrl, strSeq, strMaxWait){
	var fn = document.frmQuickPersonSearch;

	if (strMaxWait == "Y") { if(!MsgCheck("" + str_msg_buddy_invite_max + "")) { return; } }

	fn.action = "/main/person_search_buddy_invite_proc.php?hidMode=WaitPro&hidSeq=" + strSeq + "&hidReturnURL=" + strUrl + ""; fn.submit();
}
//?? ?? ???? ?? ???? ??? ??
function fncQuickBuddyInvite(){
	var fn = document.frmQuickPersonSearch;
	var strEmail = fn.txtBuddyInviteEmail.value;

	if (!IsEmail(strEmail)) { alert("" + str_msg_an_email_input + ""); fn.txtBuddyInviteEmail.value = ""; fn.txtBuddyInviteEmail.focus(); return; }
	else { fn.action = "/main/person_buddy_invite_proc.php"; fn.submit(); }
}

/* URL? ??
??	:	URL ? ???? GET
??	:	go_url(??? URL);
??	:	???
??	:	target_window (NULL:??, b:???, i:??????, u:???? ?????);
*/
function go_url(target_window, url, strProperty){
	if(typeof(strProperty) == "undefined") strProperty = "";
	
	switch(target_window){		

		case("GSP_BASE_MAIN"):

			var str_redirect_code;
			str_redirect_code = "<form name='frmRedirect' method='post' action=" + url + " target='GSP_BASE_MAIN'></form>";
			document.body.innerHTML = document.body.innerHTML + str_redirect_code;
			document.frmRedirect.submit();
			//GSP_BASE_MAIN.focus(); 
			
		break;
		
		case("b"):
			var win;
			
			if( top.window.name != "MyHompy_GSP")//TGT added, not called from Minihome
			{
				win = top;
			}
			else if (!top.opener || top.opener.closed)
			{
				if (!top.Top_Window || top.Top_Window.closed)
				{
					if(strProperty == "")
					{
						top.Top_Window = top.window.open('', 'CyWorld_GSP');
					}
					else
					{
						top.Top_Window = top.window.open('', 'CyWorld_GSP', strProperty);
					}
				}
				win = top.Top_Window;
			}
			else
			{
				win = top.opener;
			}
			
			if(win.top.frames["GSP_BASE_MAIN"]){
				try {
					//top.opener.top.frames["GSP_BASE_MAIN"].location.href = url;
					top.frames["GSP_BASE_MAIN"].location.href = url;
				} catch (e) {
					//alert(e);
					win.top.location.href = url;
				}				
//				top.opener.top.frames["GSP_BASE_MAIN"].location.href = url;
			}
			else{				
				win.top.location.href = url;
			}
			win.focus();
		break;
		
		case("i"):
			MyHompy_GSP.frames["ps_main"].location.href = url;
			MyHompy_GSP.focus();		
		break;
		
		case("u"):
			YourHompy_GSP.location.href = url;
			YourHompy_GSP.focus();
		break;

		case("new_win"):
			var newWin;
			
			if(url.indexOf("cyworld") == -1)
			{
				newWin = top.opener.open(url,'popup');
				newWin.focus();
			}
			else
			{
				top.opener.parent.document.location.href = url;
//				top.opener.focus();
			}	
		break;
		
		default:
			//alert(url);
			document.location.href = url;
		break;		
	}
	
	return false;
}

/* ???? ? ?? (????)
??	:	???? ?? ??
??	:	open_minihompy(MH_ID, LOGIN_ID, redirect_url);
??	:	???
??	:	MH_ID <- ???? , LOGIN_ID <- ???? ????  
*/
function process_legacy_url(redirect_url)
{
	if(redirect_url!= null)
	{
		//process legacy redirect_url
		if(redirect_url.indexOf('/ps/')>=0)
		{
			if(redirect_url.indexOf('/ps/ps_bbs_divide_proc.php')>=0)
			{
				redirect_url = redirect_url.replace('/ps/ps_bbs_divide_proc.php','/myhome/common/include/myhome_divide_proc.inc');			
			}
			else if(redirect_url.indexOf('/ps/ps_album_Wview.php')>=0)//upload photo
			{
				redirect_url = redirect_url.replace('/ps/ps_album_Wview.php','http://fs1.cyworld.vn/myhome/album/photo.php');
				redirect_url += "&root=index.php";			
			}
			else if(redirect_url.indexOf('/ps/ps_video_Wview.php')>=0)//upload video
			{
				redirect_url = redirect_url.replace('/ps/ps_video_Wview.php','http://cvrt.cyworld.vn/myhome/video/video_upload.php');			
			}
			else if(redirect_url.indexOf('/ps/ps_profile_view.php')>=0)// profile setting
			{
				redirect_url = redirect_url.replace('/ps/ps_profile_view.php','http://www.cyworld.vn/myhome/setting/setting_account_profile.php');		
				
			}
			else if(redirect_url.indexOf('/ps/ps_item_wish_box.php?mh_id=')>=0)// wish list
			{
				redirect_url = redirect_url.replace('/ps/ps_item_wish_box.php?mh_id=','http://www.cyworld.vn/myhome/home/asset_list.php?asset_type=wish&mh_id=');			
			}
			else
			{
				redirect_url= null;
			}
			
//			alert('test in /js/common.js process_legacy_url(): ' + redirect_url);
			return redirect_url;
		}
		else if(redirect_url.indexOf('/myhome/')>=0)
		{
			return redirect_url;
		}
	}	
}
function open_minihompy(mh_id, login_id, redirect_url){	
	
	/*var int_login_id = new Number(login_id);		
		
	if( int_login_id<=22000170000 )//old user (or not yet logged in)
	{
		if(int_login_id<=0) login_id='';
		//check cookie
		var is_minihome = TGTGet_Cookie( 'minihome_open');			
		if(is_minihome!=null)
		{
			if(is_minihome=='1')
			{
//				alert('in js/common.js message:is mini home');
				//open_minihompyNEW(mh_id, login_id, redirect_url);
				open_myhome(mh_id, login_id, redirect_url);
			}
			else
			{
//				alert('in js/common.js message:is  home');
				open_myhome(mh_id, login_id, redirect_url);
			}
		}
		else if(MyHompy_GSP)//current choice is minihome
		{
//			alert('in js/common.js message:current choice is minihome');
			open_minihompyNEW(mh_id, login_id, redirect_url);
		}
		else if (!MyHompy_GSP && top.window.name == "MyHompy_GSP")//open from within minihome
		{
//			alert('in js/common.js message:open from within mini home');
			open_minihompyNEW(mh_id, login_id, redirect_url);
		}
		else//open myhome as default
		{
			open_myhome(mh_id, login_id, redirect_url);
		}
		
	}
	else// new member, open myhome always
	{
		//alert('new member');*/
		
		open_myhome(mh_id, login_id, redirect_url);		
	/*}	*/
}
function switch_minihome(mh_id, login_id,redirect_url){
	
	try{
		//check cookie
		var is_minihome = TGTGet_Cookie( 'minihome_open');
		if(is_minihome!=null)
		{
			if(is_minihome=='1')
			{
				switch_minihomeNEW(mh_id, login_id, redirect_url);
			}
			else
			{
				switch_myhome(mh_id, login_id, redirect_url);
			}
		}
		else if(MyHompy_GSP)//current choice is minihome
		{
			switch_minihomeNEW(mh_id, login_id, redirect_url);
		}
		else if (!MyHompy_GSP && top.window.name == "MyHompy_GSP")//switch from within minihome 
		{
			switch_minihomeNEW(mh_id, login_id,redirect_url);
		}
		else
		{
			switch_myhome(mh_id, login_id,redirect_url);
		}
	}
	catch(e)//normally due to cross domain issue, i.e. from within minoroom
	{}
}

 function switch_ads_minihome(mh_id, login_id,redirect_url){
 	/*this is the special function for open up minihome/myhome from within miniroom, where there are cross domain issues (from within fs1)
 	
	//alert('TGT');
	var domain = "http://www.cyworld.vn";
	var is_minihome = TGTGet_Cookie( 'minihome_open');
	if(is_minihome=='1')
	{
		var strUrl = domain + "/ps/ps_index_frame.php?mh_id=" + mh_id + "&login_id=" + login_id;
		if(redirect_url){
			strUrl = strUrl + "&redirect_url=" + escape(redirect_url);
		}
		var strUrlTmp = "about:blank";
		var WinWidth = "932";
		//var WinHeight = "574";
		var WinHeight = "626";
		var ScrollBar = "yes";
		var Resize = "no";
		var WinGubun = "";
		var strProperty = "";
		var MyHompy_GSP;
		var strName = "MyHompy_GSP";	
		//if (!MyHompy_GSP && top.window.name == "MyHompy_GSP")
		//	MyHompy_GSP = window;
		
		//if(!MyHompy_GSP || MyHompy_GSP.closed || top.window.name != "MyHompy_GSP"){			
			MyHompy_GSP = WinOpen(strUrlTmp,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty);
		//}
		MyHompy_GSP.focus(); 
		MyHompy_GSP.location.replace(strUrl);
	}
	else//minihome
	{
		var strUrl = domain + "/myhome/index.php?mh_id=" + mh_id + "&login_id=" + login_id;
		if(redirect_url){
			strUrl = strUrl + "&redirect_url=" + escape(redirect_url);
		}
	
		var strUrlTmp = "about:blank";
		var WinWidth = screen.width;
		//var WinHeight = "574";
		var WinHeight = screen.height;
		var ScrollBar = "yes";
		var Resize = "yes";
		var WinGubun = "";
		var strProperty = "status=0,toolbar=0,location=0,menubar=0";	
		
		var strName = "MyHome_Window";
		MyHome_Window = WinOpenMyHome(strUrlTmp,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty);
		
		MyHome_Window.focus(); 
		MyHome_Window.location=(strUrl);
	//}*/
 	open_myhome(mh_id, login_id,redirect_url);
}

function open_minihompyNEW(mh_id, login_id, redirect_url)
{
	TGTSet_Cookie( 'minihome_open', '1', 30, '/', 'cyworld.vn', '' );
	var domain = "http://www.cyworld.vn";
	var strUrl = domain + "/ps/ps_gate_frame.php?mh_id=" + mh_id + "&login_id=" + login_id;
	if(redirect_url){
		strUrl = strUrl + "&redirect_url=" + escape(redirect_url);
	}
	var strUrlTmp = "about:blank";
	var WinWidth = "932";
	//var WinHeight = "574";
	var WinHeight = "626";
	var ScrollBar = "yes";
	var Resize = "no";
	var WinGubun = "";
	var strProperty = "";
	var strName = "MyHompy_GSP";		
	try
	{
		if (!MyHompy_GSP && top.window.name == "MyHompy_GSP")
			MyHompy_GSP = top.window;			
		if(!MyHompy_GSP || MyHompy_GSP.closed || top.window.name != "MyHompy_GSP")
		{			
			MyHompy_GSP = WinOpen(strUrlTmp,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty);
		}		
	}
	catch(e)
	{
		MyHompy_GSP = WinOpen(strUrlTmp,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty);
	}
	MyHompy_GSP.focus(); 
	MyHompy_GSP.location.replace(strUrl);
}
function switch_minihomeNEW(mh_id, login_id,redirect_url){

	parent.parent.parent.document.location.replace('blank.htm');
	var domain = "http://www.cyworld.vn";
	
	var strUrl = domain + "/ps/ps_index_frame.php?mh_id=" + mh_id + "&login_id=" + login_id;
	if(redirect_url){
		strUrl = strUrl + "&redirect_url=" + escape(redirect_url);
	}

	var strUrlTmp = "about:blank";
	var WinWidth = "932";
	//var WinHeight = "574";
	var WinHeight = "626";
	var ScrollBar = "yes";
	var Resize = "no";
	var WinGubun = "";
	var strProperty = "";
	
	try
	{
		if (!MyHompy_GSP && top.window.name == "MyHompy_GSP")
			MyHompy_GSP = top.window;
	
		var strName = "MyHompy_GSP";
		if(!MyHompy_GSP || MyHompy_GSP.closed || top.window.name != "MyHompy_GSP"){			
			MyHompy_GSP = WinOpen(strUrlTmp,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty);
		}
	}
	catch(e)
	{
		MyHompy_GSP = WinOpen(strUrlTmp,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty);
	}
	MyHompy_GSP.focus(); 
	MyHompy_GSP.location.replace(strUrl);
}

function open_myhome(mh_id, login_id, redirect_url){		
	var int_login_id = new Number(login_id);
	if(int_login_id<=0) login_id='';
	//change the redirect_url to fit myhome
	redirect_url = process_legacy_url(redirect_url);
	
	if(MyHompy_GSP)
	{
		MyHompy_GSP.close();
		MyHompy_GSP = null;
	}	
	//document.cookie = "minihome_open=0;domain=cyworld.vn";
	TGTSet_Cookie( 'minihome_open', '0', 30, '/', 'cyworld.vn', '' );
	var domain = "http://www.cyworld.vn";
	var strUrl = domain + "/myhome/" + mh_id;
	//var strUrl = domain + "/myhome/index.php?mh_id=" + mh_id + "&login_id=" + login_id;
	
	//alert(strUrl);
	
	if(redirect_url){		
		strUrl = strUrl + "&redirect_url=" + escape(redirect_url);
	}
	var strUrlTmp = "about:blank";
	var WinWidth =1022;
	//var WinHeight = "574";
	var WinHeight =screen.height;
	var ScrollBar = "yes";
	var Resize = "yes";
	var WinGubun = "";
	var strProperty  = "status=1,toolbar=1,location=1,menubar=1";	
	var strName = "MyHome_Window";	
	try
	{
		/*if(window.top.document.body.clientWidth<1000)
		{		
			
			try
			{
				if (top.window.name ==strName)
				{
					eval(strName+"=top.window;");
				}	
				if(!eval(strName)  || eval(strName) .closed){					
					eval(strName+"=WinOpenMyHome(strUrlTmp,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty);");			
				}		
				//alert(eval("myhome_window_list."+strName));
			}
			catch(e)
			{
				eval(strName+"=WinOpenMyHome(strUrlTmp,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty);");		
			}
			if(eval(strName).location!=strUrl) eval(strName).location=(strUrl);
				eval(strName).focus();			
		}
		else
		{
			top.document.location.href = strUrl;		
		}
		*/
		window.open(strUrl,'_blank');
	}
	catch(e)
	{
		eval(strName+"=WinOpenMyHome(strUrl,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty);");
	}
	
 
}

function switch_myhome(mh_id, login_id,redirect_url){
	//change the redirect_url to fit myhome	
	try
	{
		redirect_url = process_legacy_url(redirect_url);
		MyHompy_GSP = null;
		
		//parent.parent.parent.document.location.replace('blank.htm');
		var domain = "http://www.cyworld.vn";
		
		var strUrl = domain + "/myhome/index.php?mh_id=" + mh_id + "&login_id=" + login_id;
		if(redirect_url){
			strUrl = strUrl + "&redirect_url=" + escape(redirect_url);
		}
	
		var strUrlTmp = "about:blank";
		var WinWidth = screen.width;
		//var WinHeight = "574";
		var WinHeight = screen.height;
		var ScrollBar = "yes";
		var Resize = "yes";
		var WinGubun = "";
		var strProperty = "status=0,toolbar=0,location=0,menubar=0";
		
		var strName = "MyHome_Window"+mh_id;
		eval(strName+"=top.window;");//always open in the curent one		
		eval(strName).location=(strUrl);
		eval(strName).focus(); 	
	}
	catch(e)
	{
		open_myhome(mh_id, login_id, redirect_url);
	}
}

function TGTSet_Cookie( name, value, expires, path, domain, secure ) 
{
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );
	
	/*
	if the expires variable is set, make the correct 
	expires time, the current script below will set 
	it for x number of days, to make it for hours, 
	delete * 24, for minutes, delete * 60 * 24
	*/
	if ( expires )
	{
	expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	
	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
	( ( path ) ? ";path=" + path : "" ) + 
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
}
function TGTDelete_Cookie ( name, path, domain )
{
	  if ( TGTGet_Cookie( name ) ) 
	  {
	  	document.cookie = name + "=" +( ( path ) ? ";path=" + path : "") +( ( domain ) ? ";domain=" + domain : "" ) +";expires=Thu, 01-Jan-1970 00:00:01 GMT";
	  }
}
function TGTGet_Cookie( check_name ) {
	// first we'll split this cookie up into name/value pairs
	// note: document.cookie only returns name=value, not the other components
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false; // set boolean t/f default f
	
	for ( i = 0; i < a_all_cookies.length; i++ )
	{
		// now we'll split apart each name=value pair
		a_temp_cookie = a_all_cookies[i].split( '=' );
		
		
		// and trim left/right whitespace while we're at it
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
	
		// if the extracted name matches passed check_name
		if ( cookie_name == check_name )
		{
			b_cookie_found = true;
			// we need to handle case where cookie has no value but exists (no = sign, that is):
			if ( a_temp_cookie.length > 1 )
			{
				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			}
			// note that in cases where cookie is initialized but no value, null is returned
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found )
	{
		return null;
	}
}


/* ?? UI ?? ??
by ???
*/
var name_ui_view_mode = 0;
function name_ui_set(view_mode){
	name_ui_view_mode = view_mode;
	if(name_ui_view_mode == 1){
		//alert("UI ???");
	}
	else{
		//alert("UI ???");
	}
}
/* PS?? ???? ?? ??? */
function fncOpenImgUpload(fn, strName, strGetData){
	var strUrl = "/ps/ps_bbs_C_imageupload.php" + strGetData;
	var WinWidth = "438";
	var WinHeight = "450";
	var ScrollBar = "no";
	var Resize = "no";
	var WinGubun = "Normal";
	var strProperty = "";

	WinOpen(strUrl,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty);
}


/* ?? ?? ???. ?? ?? ??? ??? */
// ???? by ???

function Volum_control(bgm_win,mode){
	if(bgm_win.bgm_player){
		if(mode == 0){
			if( bgm_win.bgm_player.Volume < -10){
				bgm_win.bgm_player.Volume = bgm_win.bgm_player.Volume + 200;
			}
		}
		else{
			if( bgm_win.bgm_player.Volume > -4000){
				bgm_win.bgm_player.Volume = bgm_win.bgm_player.Volume - 200;
			}
		}
	}
}

function music_pause(bgm_win,mode){
	if(bgm_win.bgm_player){
		if(bgm_win.bgm_player.PlayState == 1){
			bgm_win.bgm_player.Play();
		}
		else{
			if(bgm_win.bgm_player.PlayState == 2){
				bgm_win.bgm_player.Pause();
			}
		}
	}
}

function music_stop(bgm_win,mode){
	if(bgm_win.bgm_player){
		bgm_win.bgm_player.Stop();
	}
}

function music_play(bgm_win, mode){	
	if(bgm_win.bgm_player){		
		if(bgm_win.bgm_player.PlayState == 0 || bgm_win.bgm_player.PlayState == 1){
			bgm_win.bgm_player.Play();
		}
	}
}

function music_open(bgm_win, music_url, music_id){
	if(bgm_win.bgm_player){
		if(document.all['music_title']){
			document.all['music_title'].innerHTML = arr_music_title[music_id];
		}
		if(document.all['artist']){
			document.all['artist'].innerHTML = arr_artist[music_id];
		}
		if(document.all['infomation']){
			document.all['infomation'].innerHTML = arr_infomation[music_id];
		}
		if(document.all['acorn']){
			document.all['acorn'].innerHTML = arr_acorn[music_id];
		}
		bgm_win.bgm_player.open(music_url);
	}
}

// ?? ?? ??? => ??? ??
function fncStarSign(intMonth, intDay){
	var fn = document.frmMember;
	var intDateVal = 0;
	var strStarName = "";

	if (fn.selYear.value == ""){ alert("" + str_msg_year_select + ""); fn.selYear.focus(); return; }
	if (fn.selMonth.value == ""){ alert("" + str_msg_month_select + ""); fn.selMonth.focus(); return; }
	if (fn.selDay.value == ""){
		alert("" + str_msg_day_select + ""); fn.selDay.focus(); return;
	}else{
		if(intDay.length == 1){	intDateVal = intMonth + "0" + intDay; }
		else { intDateVal = intMonth + intDay; }

		for(i = 1; i < int_star_sign_cnt; i++){
			if(str_my_star_chk[i][0] <= intDateVal && str_my_star_chk[i][1] >= intDateVal){
				strStarName = str_my_star_name[i][1];
				intStarType = i;
			}
		}
		
		if(strStarName == ""){ strStarName = str_my_star_name[12][1]; intStarType = 12; }
	//	star_sign_text.innerHTML = strStarName;
		document.getElementById('temp1').value =  intStarType;
	//	document.frmMember.hidConstellationType.value = intStarType;
	}
}

// ??? ??? ???? ????
function winResize_MoveCenter(size_x,size_y){
	var x=screen.width/2 - size_x/2;
	var y=screen.height/2 - size_y/2;
	window.resizeTo(size_x,size_y);
	window.moveTo(x,y);
}

//  ?? ??? ? ? ??? ????? by zmania
function access_fail_redirect(mode){
	
	if(mode == "ps"){
		top.window.ps_main.location = "./ps_home1_view.php";
	}
}

//Select ?? ???
function fncSelectClear(objSelect){ 
//	var objSelect= eval("document.frmMember." + objSelect); //by adou
	if(objSelect){
		for(i=0; i < objSelect.length; i++) { objSelect.options[i] = null; }
	}
}

//  ?? ??(select box) ?? ??
function fncSetDay(intYear, intMonth, strDay){
	var fn = document.frmMember;
	var intDayCnt;
	var objDay= eval("document.frmMember." + strDay);	

	if (fn.selYear.value == ""){ alert("" + str_msg_year_select + ""); fn.selYear.focus(); return; }
	if (fn.selMonth.value == ""){ 
		alert("" + str_msg_month_select + ""); fn.selMonth.focus(); return;
	}else{
		fncSelectClear(objDay);							// ??(select box)? ??? ??.
		intDayCnt = fncChangeMonth(intYear, intMonth);	// ?, ?? ???? ?? ??? ?? ??? ?? ???.

		if(intDayCnt > 0) { for(i=1; i <= intDayCnt; i++) { objDay.options[i-1] = new Option(i,i); } }
	}
}

// ?? ??
function fncChangeMonth(intYear, intMonth){
	var intDayCnt = 0;
    var intYear4 = 0;
    var intYear100 = 0;
    var intYear400 = 0;
    
    intYear4 = intYear % 4;
    intYear100 = intYear % 100;
    intYear400 = intYear % 400;

	switch (parseInt(intMonth)){
	  case 1:	intDayCnt = 31;	break;	    
	    
	  case 2:	if(intYear4 == 0 ) { 
					intDayCnt = 29;
					if(intYear100 == 0){
						if(intYear400 == 0) { intDayCnt = 29; }
						else { intDayCnt = 28; }
					}
				}
				else { intDayCnt = 28; }
				break;
	  case 3:	intDayCnt = 31;	break;
	  case 4:	intDayCnt = 30;	break;
	  case 5:	intDayCnt = 31;	break;
	  case 6:	intDayCnt = 30;	break;
	  case 7:	intDayCnt = 31;	break;
	  case 8:	intDayCnt = 31;	break;
	  case 9:	intDayCnt = 30;	break;
	  case 10:	intDayCnt = 31;	break;
	  case 11:	intDayCnt = 30;	break;
	  case 12:	intDayCnt = 31;	break;	    
	}
	return intDayCnt;
}

function person_choose(){
	if(document.frmPersonSearch.SelPerson){
		var person_info = new Array();
		var recive_info;
		sel_ele = document.frmPersonSearch.SelPerson;
		sel_num = sel_ele.length;
		if(!sel_num){
			sel_num = 1;
			person_info = sel_ele.value.split("|");
			recive_info = sel_ele.value;
	
		}
		else{
			for(i = 0; i<sel_num; i++){
				if(sel_ele[i].checked == true){
					opener.document.frmGift.recive_info.value = sel_ele[i].value;
					person_info = sel_ele[i].value.split("|");
					recive_info = sel_ele[i].value;
					break;
				}
			}
		}
		opener.document.frmGift.recive_info_display.value = person_info[1];
		opener.document.frmGift.recive_info.value = recive_info;
//		opener.document.frmGift.recive_info.value = person_info[0];
//		opener.document.frmGift.recive_info_display.value = person_info[1];
		window.close();
	}
}

function int_Comma(input_number) 
 { 
 str = input_number; 
 var retValue = ""; 
 var retValue2 = ""; 

 for(i=0; i<str.length; i++) 
  { if(str.charAt(str.length - i -1) != ","){ retValue2 = str.charAt(str.length - i -1) + retValue2; }} 

 for(i=0; i<retValue2.length; i++) 
  { 
  if(i > 0 && (i%3)==0) { retValue = retValue2.charAt(retValue2.length - i -1) + "," + retValue; }
  else { retValue = retValue2.charAt(retValue2.length - i -1) + retValue; } 
  } 
 return(retValue); 
 }

// ???? ?? ??? ??? ???? ??? ex) hideControl (select, layPOPUP)
// by zmania
function hideControl (tagName, popupObj) 
{ 
    if (document.all) { 

        var x = cmGetX (popupObj); 
        var y = cmGetY (popupObj); 
        var w = popupObj.offsetWidth; 
        var h = popupObj.offsetHeight; 

        var i; 
        for (i = 0; i < document.all.tags(tagName).length; ++i) { 
            var obj = document.all.tags(tagName)[i]; 
            if (!obj || !obj.offsetParent) continue; 

            var ox = cmGetX (obj); 
            var oy = cmGetY (obj); 
            var ow = obj.offsetWidth; 
            var oh = obj.offsetHeight; 

            if (ox > (x + w) || (ox + ow) < x) continue; 
            if (oy > (y + h) || (oy + oh) < y) continue; 
             
            if(obj.style.visibility == "hidden") continue; 

            if(!popupObj.overFlag) 
                popupObj.overFlag = new Array (); 

            popupObj.overFlag[popupObj.overFlag.length] = obj; 
			if(tagName == "IFRAME"){
				if(obj.name == "mh_buddy" || obj.name == "actionFrame" || obj.name == "my_buddy"){
					obj.style.visibility = "hidden";
				}
			}
			else{
				obj.style.visibility = "hidden"; 
			}
        } 
    } 

} 

function showControl(popupObj) 
{ 
    if (popupObj.overFlag) { 
        var i; 
        for (i = 0; i < popupObj.overFlag.length; ++i) 
            popupObj.overFlag[i].style.visibility = ""; 
    } 
    popupObj.overFlag = null; 
} 

function cmGetX (obj) 
{ 
    var x = 0; 
    do 
    { 
        x += obj.offsetLeft; 
        obj = obj.offsetParent; 
    } 
    while (obj); 
    return x; 
} 

function cmGetY (obj) 
{ 
    var y = 0; 
    do 
    { 
        y += obj.offsetTop; 
        obj = obj.offsetParent; 
    } 
    while (obj); 
    return y; 
} 

// ???? ?? by zmania
function chk_broswer(){
	 if (navigator.appName.indexOf("Microsoft")!=-1) {
		return(true);
	 }
	 else{
		 return(false);
	 }
}

// ?? ? ?? by zmania
function tmp_obj_info(obj){
	var str;
	for(i in obj){
		str = str + i + " = " + obj[i] + "<br>";
	}
	//document.write(str);
}

// Strip whitespace from the beginning and end of a string 
// by adou
function trim(s){
	if(typeof(s) != "undefined")
	{
		s = "" + s;
		return s.replace(/(^\s*)|(\s*$)/g, "");
	}
	
	return "";
}

// 2005-05-17 statistics functions


function safe_add(x, y)
{
  var lsw = (x & 0xFFFF) + (y & 0xFFFF)
  var msw = (x >> 16) + (y >> 16) + (lsw >> 16)
  return (msw << 16) | (lsw & 0xFFFF)
}

function rol(num, cnt)
{
  return (num << cnt) | (num >>> (32 - cnt))
}

function cmn(q, a, b, x, s, t)
{
  return safe_add(rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b)
}
function ff(a, b, c, d, x, s, t)
{
  return cmn((b & c) | ((~b) & d), a, b, x, s, t)
}
function gg(a, b, c, d, x, s, t)
{
  return cmn((b & d) | (c & (~d)), a, b, x, s, t)
}
function hh(a, b, c, d, x, s, t)
{
  return cmn(b ^ c ^ d, a, b, x, s, t)
}
function ii(a, b, c, d, x, s, t)
{
  return cmn(c ^ (b | (~d)), a, b, x, s, t)
}

function coreMD5(x)
{
  var a =  1732584193
  var b = -271733879
  var c = -1732584194
  var d =  271733878

  for(i = 0; i < x.length; i += 16)
  {
    var olda = a
    var oldb = b
    var oldc = c
    var oldd = d

    a = ff(a, b, c, d, x[i+ 0], 7 , -680876936)
    d = ff(d, a, b, c, x[i+ 1], 12, -389564586)
    c = ff(c, d, a, b, x[i+ 2], 17,  606105819)
    b = ff(b, c, d, a, x[i+ 3], 22, -1044525330)
    a = ff(a, b, c, d, x[i+ 4], 7 , -176418897)
    d = ff(d, a, b, c, x[i+ 5], 12,  1200080426)
    c = ff(c, d, a, b, x[i+ 6], 17, -1473231341)
    b = ff(b, c, d, a, x[i+ 7], 22, -45705983)
    a = ff(a, b, c, d, x[i+ 8], 7 ,  1770035416)
    d = ff(d, a, b, c, x[i+ 9], 12, -1958414417)
    c = ff(c, d, a, b, x[i+10], 17, -42063)
    b = ff(b, c, d, a, x[i+11], 22, -1990404162)
    a = ff(a, b, c, d, x[i+12], 7 ,  1804603682)
    d = ff(d, a, b, c, x[i+13], 12, -40341101)
    c = ff(c, d, a, b, x[i+14], 17, -1502002290)
    b = ff(b, c, d, a, x[i+15], 22,  1236535329)

    a = gg(a, b, c, d, x[i+ 1], 5 , -165796510)
    d = gg(d, a, b, c, x[i+ 6], 9 , -1069501632)
    c = gg(c, d, a, b, x[i+11], 14,  643717713)
    b = gg(b, c, d, a, x[i+ 0], 20, -373897302)
    a = gg(a, b, c, d, x[i+ 5], 5 , -701558691)
    d = gg(d, a, b, c, x[i+10], 9 ,  38016083)
    c = gg(c, d, a, b, x[i+15], 14, -660478335)
    b = gg(b, c, d, a, x[i+ 4], 20, -405537848)
    a = gg(a, b, c, d, x[i+ 9], 5 ,  568446438)
    d = gg(d, a, b, c, x[i+14], 9 , -1019803690)
    c = gg(c, d, a, b, x[i+ 3], 14, -187363961)
    b = gg(b, c, d, a, x[i+ 8], 20,  1163531501)
    a = gg(a, b, c, d, x[i+13], 5 , -1444681467)
    d = gg(d, a, b, c, x[i+ 2], 9 , -51403784)
    c = gg(c, d, a, b, x[i+ 7], 14,  1735328473)
    b = gg(b, c, d, a, x[i+12], 20, -1926607734)

    a = hh(a, b, c, d, x[i+ 5], 4 , -378558)
    d = hh(d, a, b, c, x[i+ 8], 11, -2022574463)
    c = hh(c, d, a, b, x[i+11], 16,  1839030562)
    b = hh(b, c, d, a, x[i+14], 23, -35309556)
    a = hh(a, b, c, d, x[i+ 1], 4 , -1530992060)
    d = hh(d, a, b, c, x[i+ 4], 11,  1272893353)
    c = hh(c, d, a, b, x[i+ 7], 16, -155497632)
    b = hh(b, c, d, a, x[i+10], 23, -1094730640)
    a = hh(a, b, c, d, x[i+13], 4 ,  681279174)
    d = hh(d, a, b, c, x[i+ 0], 11, -358537222)
    c = hh(c, d, a, b, x[i+ 3], 16, -722521979)
    b = hh(b, c, d, a, x[i+ 6], 23,  76029189)
    a = hh(a, b, c, d, x[i+ 9], 4 , -640364487)
    d = hh(d, a, b, c, x[i+12], 11, -421815835)
    c = hh(c, d, a, b, x[i+15], 16,  530742520)
    b = hh(b, c, d, a, x[i+ 2], 23, -995338651)

    a = ii(a, b, c, d, x[i+ 0], 6 , -198630844)
    d = ii(d, a, b, c, x[i+ 7], 10,  1126891415)
    c = ii(c, d, a, b, x[i+14], 15, -1416354905)
    b = ii(b, c, d, a, x[i+ 5], 21, -57434055)
    a = ii(a, b, c, d, x[i+12], 6 ,  1700485571)
    d = ii(d, a, b, c, x[i+ 3], 10, -1894986606)
    c = ii(c, d, a, b, x[i+10], 15, -1051523)
    b = ii(b, c, d, a, x[i+ 1], 21, -2054922799)
    a = ii(a, b, c, d, x[i+ 8], 6 ,  1873313359)
    d = ii(d, a, b, c, x[i+15], 10, -30611744)
    c = ii(c, d, a, b, x[i+ 6], 15, -1560198380)
    b = ii(b, c, d, a, x[i+13], 21,  1309151649)
    a = ii(a, b, c, d, x[i+ 4], 6 , -145523070)
    d = ii(d, a, b, c, x[i+11], 10, -1120210379)
    c = ii(c, d, a, b, x[i+ 2], 15,  718787259)
    b = ii(b, c, d, a, x[i+ 9], 21, -343485551)

    a = safe_add(a, olda)
    b = safe_add(b, oldb)
    c = safe_add(c, oldc)
    d = safe_add(d, oldd)
  }
  return [a, b, c, d]
}

function binl2hex(binarray)
{
  var hex_tab = "0123456789abcdef"
  var str = ""
  for(var i = 0; i < binarray.length * 4; i++)
  {
    str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +
           hex_tab.charAt((binarray[i>>2] >> ((i%4)*8)) & 0xF)
  }
  return str
}

function binl2b64(binarray)
{
  var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
  var str = ""
  for(var i = 0; i < binarray.length * 32; i += 6)
  {
    str += tab.charAt(((binarray[i>>5] << (i%32)) & 0x3F) |
                      ((binarray[i>>5+1] >> (32-i%32)) & 0x3F))
  }
  return str
}


function str2binl(str)
{
  var nblk = ((str.length + 8) >> 6) + 1 // number of 16-word blocks
  var blks = new Array(nblk * 16)
  for(var i = 0; i < nblk * 16; i++) blks[i] = 0
  for(var i = 0; i < str.length; i++)
    blks[i>>2] |= (str.charCodeAt(i) & 0xFF) << ((i%4) * 8)
  blks[i>>2] |= 0x80 << ((i%4) * 8)
  blks[nblk*16-2] = str.length * 8
  return blks
}

function strw2binl(str)
{
  var nblk = ((str.length + 4) >> 5) + 1 // number of 16-word blocks

  var blks = new Array(nblk * 16)
  for(var i = 0; i < nblk * 16; i++) blks[i] = 0
  for(var i = 0; i < str.length; i++)
    blks[i>>1] |= str.charCodeAt(i) << ((i%2) * 16)
  blks[i>>1] |= 0x80 << ((i%2) * 16)
  blks[nblk*16-2] = str.length * 16
  return blks
}

function hexMD5 (str) { return binl2hex(coreMD5( str2binl(str))) }
function hexMD5w(str) { return binl2hex(coreMD5(strw2binl(str))) }
function b64MD5 (str) { return binl2b64(coreMD5( str2binl(str))) }
function b64MD5w(str) { return binl2b64(coreMD5(strw2binl(str))) }
function calcMD5(str) { return binl2hex(coreMD5( str2binl(str))) }


//Base64

var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + //all caps
"abcdefghijklmnopqrstuvwxyz" + //all lowercase
"0123456789+/="; // all numbers plus +/=

//Heres the encode function
function encode64(inp)
{
	var out = ""; //This is the output
	var chr1, chr2, chr3 = ""; //These are the 3 bytes to be encoded
	var enc1, enc2, enc3, enc4 = ""; //These are the 4 encoded bytes
	var i = 0; //Position counter
	
	do { //Set up the loop here
		chr1 = inp.charCodeAt(i++); //Grab the first byte
		chr2 = inp.charCodeAt(i++); //Grab the second byte
		chr3 = inp.charCodeAt(i++); //Grab the third byte
		
		//Here is the actual base64 encode part.
		//There really is only one way to do it.
		enc1 = chr1 >> 2;
		enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
		enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
		enc4 = chr3 & 63;
		
		if (isNaN(chr2)) {
			enc3 = enc4 = 64;
		} else if (isNaN(chr3)) {
			enc4 = 64;
		}
		
		//Lets spit out the 4 encoded bytes
		out = out + keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) +
		keyStr.charAt(enc4);
		
		// OK, now clean out the variables used.
		chr1 = chr2 = chr3 = "";
		enc1 = enc2 = enc3 = enc4 = "";
	
	} while (i < inp.length); //And finish off the loop
	
	//Now return the encoded values.
	return out;
}

//Heres the decode function
function decode64(inp)
{
	var out = ""; //This is the output
	var chr1, chr2, chr3 = ""; //These are the 3 decoded bytes
	var enc1, enc2, enc3, enc4 = ""; //These are the 4 bytes to be decoded
	var i = 0; //Position counter
	
	// remove all characters that are not A-Z, a-z, 0-9, +, /, or =
	var base64test = /[^A-Za-z0-9\+\/\=]/g;
	
	if (base64test.exec(inp)) { //Do some error checking
		alert("There were invalid base64 characters in the input text.\n" +
		"Valid base64 characters are A-Z, a-z, 0-9, ?+?, ?/?, and ?=?\n" +
		"Expect errors in decoding.");
	}
	inp = inp.replace(/[^A-Za-z0-9\+\/\=]/g, "");
	
	do { //Here??ÔøΩs the decode loop.
	
		//Grab 4 bytes of encoded content.
		enc1 = keyStr.indexOf(inp.charAt(i++));
		enc2 = keyStr.indexOf(inp.charAt(i++));
		enc3 = keyStr.indexOf(inp.charAt(i++));
		enc4 = keyStr.indexOf(inp.charAt(i++));
		
		//Heres the decode part. There??ÔøΩs really only one way to do it.
		chr1 = (enc1 << 2) | (enc2 >> 4);
		chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
		chr3 = ((enc3 & 3) << 6) | enc4;
		
		//Start to output decoded content
		out = out + String.fromCharCode(chr1);
		
		if (enc3 != 64) {
			out = out + String.fromCharCode(chr2);
		}
		if (enc4 != 64) {
			out = out + String.fromCharCode(chr3);
		}
		
		//now clean out the variables used
		chr1 = chr2 = chr3 = "";
		enc1 = enc2 = enc3 = enc4 = "";
	
	} while (i < inp.length); //finish off the loop
	
	//Now return the decoded values.
	return out;
}

function getCookie(name){
    var cname = name + "=";
    var dc = document.cookie;

    if (dc.length > 0) {
     begin = dc.indexOf(cname);

        if (begin != -1) {
         begin += cname.length;
         end = dc.indexOf(";", begin);

         if (end == -1) end = dc.length;
             return unescape(dc.substring(begin, end));
        }
    }
    return "";
}

function setCookie(name, value)
{
   var argv = setCookie.arguments;
   var argc = setCookie.arguments.length;
   var expires = (2 < argc) ? argv[2] : null;
   var path = (3 < argc) ? argv[3] : null;
   var domain = (4 < argc) ? argv[4] : null;
   var secure = (5 < argc) ? argv[5] : false;

   document.cookie = name + "=" + value +
     ((expires == null) ? "" : ("; expires="+expires.toGMTString())) +
     ((path == null) ? "" : ("; path=" + path)) +
     ((domain == null) ? "" : ("; domain=" + domain)) +
     ((secure == true) ? "; secure" : "");

}
if(getCookie("GCY_UVID") == null || getCookie("GCY_UVID") == ""){
  var cookieval = new Date();
  cookieval = cookieval.getTime();
  var rStr_1 = "" + Math.random();
  var rStr_2 = "" + Math.random();
  var rStr_3 = "" + Math.random();
  var rStr_4 = "" + Math.random();
  var rStr_5 = "" + Math.random();
  rStr_1 = rStr_1.charAt(2);
  rStr_2 = rStr_2.charAt(2);
  rStr_3 = rStr_3.charAt(2);
  rStr_4 = rStr_4.charAt(2);
  rStr_5 = rStr_5.charAt(2);

  var uv_expired_data = new Date(2011,1,1);
  cookieval = cookieval + rStr_1 + rStr_2 + rStr_3 + rStr_4 + rStr_5;
  setCookie("GCY_UVID", encode64(cookieval) , uv_expired_data, "/", ".cyworld.vn", false);
}

//?ÔøΩÔøΩ�?§∫ËØÑËÆ∫�?î®?ÔøΩÔøΩÂÆö‰πâË°®ÊÉÖ 2005-05-16 adou
function showPersonacon(persona_view_id) {
	var span_name = "persona"+persona_view_id;
	var open = document.getElementById(span_name).style.display;

	if(open == "none") {
		document.getElementById(span_name).style.display = '';
	}
	else {
		document.getElementById(span_name).style.display = 'none';
	}
}
function setPersona(frmName, cid, rid, pid, pimg) {
	var srcName = "personasrc" + cid;
	var span_name = "persona" + cid;
	document.getElementById(srcName).src = pimg;
	document.forms[frmName].personaconid.value = pid;
	if(document.getElementById(span_name).style.display == "") {
		document.getElementById(span_name).style.display = 'none';
	}
}

//count input length and alert
function inputCheckMinLength(element,minLength){
	var temp;
	var charcount;
	var reserve;
	var currentLenght = 0;
	var inputLength = element.value.length;
	for(k=0; k<inputLength; k++){
		temp = element.value.charAt(k);
		if(escape(temp).length > 4)
			currentLenght += 2;
		else
			currentLenght++;
	}
	if(currentLenght < minLength){
		element.value = cutInputStr(element.value,minLength);
		
		alert("Minimum charater size is " + minLength );
		return false;
	}
}

function inputCheckCommon(element,maxLength,filter){
	var temp;
	var charcount;
	var reserve;
	var currentLenght = 0;
	var inputLength = element.value.length;
	
	for(k=0; k<inputLength; k++){
		temp = element.value.charAt(k);
		if(escape(temp).length > 4)
			currentLenght += 2;
		else
			currentLenght++;
	}
	if (currentLenght < 5 ) {
		alert("Minimum input length is 5 ");
		return false;
	}
	if(currentLenght > maxLength){
		element.value = cutInputStr(element.value,maxLength);
		
		alert("Maximum input length is" + maxLength );
	}
	if(currentLenght>maxLength)currentLenght = maxLength;
	if(document.getElementById(element.id + '_count'))document.getElementById(element.id + '_count').innerHTML = '(' + currentLenght + '/'+maxLength+')';
}

//cut string
function cutInputStr(aquery,i){
var tmpStr;
var temp=0;
var onechar;
var tcount;
 
tcount = 0;
tmpStr = new String(aquery);
temp = tmpStr.length;

for(k=0;k<temp;k++){
	onechar = tmpStr.charAt(k);
	if(escape(onechar).length > 4){ tcount += 2; }
	else if(onechar!="\r\n"){ tcount++; }
	if(tcount>i){
		tmpStr = tmpStr.substring(0,k);
		break;
	}
}
return tmpStr;

}					

// check Korea charset
function checkKoreaChar(str) {
	
	for(i=0; i<str.length; i++) {
  		if(((str.charCodeAt(i) > 0x3130 && str.charCodeAt(i) < 0x318F) || (str.charCodeAt(i) >= 0xAC00 && str.charCodeAt(i) <= 0xD7A3))) {
			return true;
  		}
	}
	return false;
}
 
function ShowHideMenu(menunm)
{    
	//fixing for Safari compatibility
	club_menu= document.getElementById(menunm);
	//if (document.all[menunm].style.display == 'none')
	if (club_menu.style.display == 'none')	
	{
		//document.all[menunm].style.display = '';
		club_menu.style.display = '';
		return;
	}
	//if (document.all[menunm].style.display == '') 
	if (club_menu.style.display == '') 	
	{
		//document.all[menunm].style.display = 'none';
		club_menu.style.display = 'none';		
		return;
	}
}

function win_open(src, target, width, height)
{
	var x=screen.width/5;
	var y=screen.height/5;
	window.open(src, target, "left="+x+", top="+y+",directories=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no,width=" + width + ",height=" + height);
}
function openImageUpload(strUrl, WinWidth, WinHeight) {
	var WinName = "mhPop";	
	if(!WinWidth){
		WinWidth = 610;
	}
	if(!WinHeight){
		WinHeight = 580;
	}	
	WinOpen(strUrl,WinName,WinWidth,WinHeight);
}


// tmp beginner open

function open_beginner(bid) {
	switch(bid) {
		case 1 :
				// minihome
				window.open("/ps/beginner/minihome_01.html",'Beginner','width=932,height=583');
				break;
		case 2 : 
				//club
				window.open("/club/beginner/01.html",'Beginner','width=932,height=583');
				break;
		case 3 :
				//miniroom
				window.open("/ps/beginner/01.html",'Beginner','width=932,height=583');
				break;
		default :
				break;
	}
}

// filtering language
function FilterPattern (lang,obj) {

	var regex_pattern;

	/*
	// 06.11.02 Rock<rockk@nate.com>
	// temporary job
	switch(lang){
		//case 'HAN':
		//	regex_pattern = /[\u3000-\u303f]|[\u1100-\u11ff]|[\u3130-\u318f]|[\uac00-\ud7a3]/g;
		//	break;
		default:
			regex_pattern = /[\u0400-\u1FFFF]|[\u2f00-\uffff]/g;
			break;
	}

	if ( obj.search(regex_pattern) == -1)  {
		return false;
	}else{
		alert(FOUND_DENY_CHARACTERS);
		return true;
	}*/
	
	return false;

}

function filterCharacter(level,obj) {
//alert(level);
		var str_name = trim(obj);
		if(str_name.length==0) 
			return false;
			
		switch (level) 
		{
			// allow letter and number only
			case 0:
				var exp = /[^\w]/g;
				break;
			
			// allow letter, number and basic punct
			case 1:
				var exp = /[^\s\w\?\*\+\.\|\{\}\\\[\]\(\)\-!@#\$%&_=;',:<>~]/g;
				break;
				
			//allow letter, number and exact punct:  .(dot), _(under score)
			case 2:
				var exp = /[^\s\w\._@]/g;
				break;
				
			//check punct @
			case 3:
				var exp = /[@]/g;
				break;
				
/**	2007.12.16	HaNT	Allow letter, number, Vietnamese and basic punct.	*/				
			// allow letter, number, Vietnamese and basic punct
			case 4:
				var exp = /[^\s\w\?\*\+\.\|\{\}\\\[\]\(\)\-!@#\$%&_=;',:<>~à-ỹÀ-Ỹ]/g;
				break;
/*~	2007.12.16	HaNT	Allow letter, number, Vietnamese and basic punct.	*/
		}
		
		if ( str_name.search(exp) > -1 ) {
			return false;
		} else {
			return true;
		}
}

function MallImageResize(objId,w,h) {
	myImage = new Image();
	myImage.src = document.getElementById(objId).src;
	
	if(myImage.width > w) {
		document.getElementById(objId).style.width = w;
	}
	if(myImage.height > h) {
		document.getElementById(objId).style.height = h;
	}
}

function validateCommentAll(fn, mode) {

	switch(mode) {
		case "write":
			if(trim(fn.comment.value) == "") {
				alert(str_msg_no_comment);
				return false;
			}
			if(FilterPattern('HAN',fn.comment.value)){
				return false;
			}
			if(wordFilter(fn.comment.value, 'B')){
				fn.comment.focus();
				return false;
			}			
			return true;
			break;
	}
	return true;
}


// ===============================================================
// Header part form functions
// ===============================================================
 
function search_from_top() {
	var stype = document.getElementById("search_top_option").value;
    if (stype=="people") {
		return peopleSearch();
    } else if (stype=="club") {
		return clubSearch();
	}
        	       
}
        
function peopleSearch() {
    var input = document.getElementById("top_search").value;
    
    if(wordFilter(input, 'I')){
		return false;
	}
    
	if(FilterPattern('HAN',input)){
		return false;
	}
    
	if ( input !="" && isDirty==true )
    {
		var fn = document.getElementById("form_search_top");
        fn.action = "/main/person_search_Wview.php";
        fn.submit();
        return true;
    } else {
		alert ("Make sure your search terms are entered correctly.");
		return false;
	}
}
        
function clubSearch() {
	var input = document.getElementById("top_search").value;
	
    if(wordFilter(input, 'I')){
		return false;
	}
    
	if(FilterPattern('HAN',input)){
		return false;
	}        		
	if ( input !="" && isDirty==true )
    {
    	var fn = document.getElementById("form_search_top");
        fn.action = "/club/section/club_section_search.php";
        fn.submit();
        return true;	
	} else {
		alert ("Make sure your search terms are entered correctly.");
		return false;
	}
        	
}
        
//switch people<->club search.
function switchSearch(stype) {
	if (stype=="people") {
    	addLastName();
    } else if (stype=="club") {
		removeLastName();
	} else if (stype=="defaultclub") {
		addLastName();
		removeLastName();
	}
}
   	
//switch to clubsearch.
function removeLastName() {
       			
	var el = document.getElementById("top_search_lastname")
	if (document.getElementById("top_search_box_container") && el) {
		document.getElementById("top_search_box_container").removeChild(el);	
	}
    var sel = document.getElementById("top_search");
    sel.style.width="125px";
    sel.value ="CLB ngẫu nhiên";
    sel.name = "query";
    // element is not getting an event, so line below will throw js error
    //sel.onkeydown = checkEnterAndSearch;
    isDirty =false;
}

//switch to people search.
function addLastName() {
	//create input element for last name
    var el = document.createElement('input');
    el.type ="text";
    el.className = "navsearchtxt";
    el.id = el.name = "top_search_lastname";
    if (document.getElementById("top_search_box_container")) {
		//document.getElementById("top_search_box_container").appendChild(el);	
	}
    el.style.width = "125px";
    el.value = "last name";
    el.onclick = onClick_handle;
    // element is not getting an event, so line below will throw js error
    //el.onkeydown = checkEnterAndSearch;
    
    var sel = document.getElementById("top_search");
    sel.style.width="125px";
    sel.value ="";
    sel.onclick = onClick_handle;
    // element is not getting an event, so line below will throw js error
    //sel.onkeydown = checkEnterAndSearch;
       		
    sel.name = "search_result_user_name"; 
    el.name="user_name_second";
       		
	isDirty =false;
}
       	
function onClick_handle ()
{
	//detect whether it is clicked first time or not.	
    if (isDirty==false) {
       	document.getElementById("top_search").value="";
       	if (document.getElementById("top_search_lastname"))
       		document.getElementById("top_search_lastname").value="";
		isDirty = true;
	}
}


var isDirty =false;

function checkEnterAndSearch()
{
	
	if (event.keyCode == 13) 
		search_from_top();
}
function moveNextInput()
{
	if (event.keyCode == 13)
		document.getElementById("top_search_lastname").focus();
}


// ===============================================================
// Common functions for header
// ===============================================================

function alertLogin(){
	alert('Login First !');
	return false;
}

function initPage() {
	
    preButtons();
    getLinksToBlur();

	//initially set to people search.
   
}

function alertPreparing() {
	alert('Preparing...');
	return false; 
}


// ==============================================================
// Global link from footer
// ==============================================================

function go_globalcyworld(v,str_national,str_flag) {

	if(str_flag.checked) {
	str_chk='Y';	
	}
	else {
	str_chk='N'
	}
	
	// alert('http://www.cyworld.com/global_locale.jsp?etc='+str_national+'&chk='+str_chk,'CyWorld_GSP','');
	window.open ('http://www.cyworld.com/global_locale.jsp?etc='+str_national+'&chk='+str_chk,'CyWorld_GSP','');
	//eval(v).window.location.replace('http://www.cyworld.com/global_locale.jsp?etc='+str_national+'&chk='+str_chk);
	
}

// for ajax START
	////
	// Î?ô�?ûë�?∞ÄÎä•Ìïú Î�?åÎ?º�?ö∞�?†Ä Ìå?�?†ï
	//
	// @sample        if(chkAjaBrowser()){ location.href='nonajax.htm' }
	// @sample        oj = new chkAjaBrowser();if(oj.bw.safari){ /* Safari �?ΩîÎìú */ }
	// @return        Î?º�??¥Î�?åÎü¨Î¶¨�?∞Ä Î?ô�?ûë�?∞ÄÎä•Ìïú Î�?åÎ?º�?ö∞�?†ÄÎßå true  true|false
	//
	//  Enable list (v038ÌòÑ�?û¨)
	//   WinIE 5.5+ 
	//   Konqueror 3.3+
	//   AppleWebKit�?≥Ñ(Safari,OmniWeb,Shiira) 124+ 
	//   Mozilla�?≥Ñ(Firefox,Netscape,Galeon,Epiphany,K-Meleon,Sylera) 20011128+ 
	//   Opera 8+ 
	//
	function chkAjaBrowser()
	{
		var a,ua = navigator.userAgent;
		this.bw= { 
		  safari    : ((a=ua.split('AppleWebKit/')[1])?a.split('(')[0]:0)>=124 ,
		  konqueror : ((a=ua.split('Konqueror/')[1])?a.split(';')[0]:0)>=3.3 ,
		  mozes     : ((a=ua.split('Gecko/')[1])?a.split(" ")[0]:0) >= 20011128 ,
		  opera     : (!!window.opera) && ((typeof XMLHttpRequest)=='function') ,
		  msie      : (!!window.ActiveXObject)?(!!createHttpRequest()):false 
		}
		return (this.bw.safari||this.bw.konqueror||this.bw.mozes||this.bw.opera||this.bw.msie)
	}
	

	////
	// XMLHttpRequest �?ò§Î�?å�?†?Ìä�? �?É?�?Ñ±
	//
	// @sample        oj = createHttpRequest()
	// @return        XMLHttpRequest �?ò§Î�?å�?†?Ìä�?(�??�?�?ä§ÌÑ¥�?ä§)
	//
	function createHttpRequest()
	{
		if(window.ActiveXObject){
			 //Win e4,e5,e6�?ö©
			try {
				return new ActiveXObject("Msxml2.XMLHTTP") ;
			} catch (e) {
				try {
					return new ActiveXObject("Microsoft.XMLHTTP") ;
				} catch (e2) {
					return null ;
	 			}
	 		}
		} else if(window.XMLHttpRequest){
			 //Win Mac Linux m1,f1,o8 Mac s1 Linux k3�?ö©
			return new XMLHttpRequest() ;
		} else {
			return null ;
		}
	}
	
	////
	// �?Ü°�?àò�?ã† Ìï®�?àò
	//
	// @sample         sendRequest(onloaded,'&prog=1','POST','./about2.php',true,true)
	// @param callback �?Ü°�?àò�?ã†�?ãú�?ó? �?�?∞Î?ôÌïòÎäî Ìï®�?àò �??¥Î¶Ñ
	// @param data	   �?Ü°�?ã†ÌïòÎäî Î?∞�??¥ÌÑ∞ (&�??¥Î¶Ñ1=�?∞í1&�??¥Î¶Ñ2=�?∞í2...)
	// @param method   "POST" Îò?Îäî "GET"
	// @param url      �?öî�?≤≠ÌïòÎäî Ìåå�??º�??ò URL
	// @param async	   ÎπÑÎ?ô�?�?∞Î?ºÎ©¥ true Î?ô�?�?∞Î?ºÎ©¥ false
	// @param sload	   �?àòÌ?º Î°úÎìú trueÎ°ú �?∞ï�?†ú„Ä?�?É?ÎûµÎò?Îäî falseÎäî �?�?∞Î≥�?
	// @param user	   �??�?�?¶? Ìéò�??¥�?ßÄ�?ö© �?Ç¨�?ö©�?û? �??¥Î¶Ñ
	// @param password �??�?�?¶? Ìéò�??¥�?ßÄ�?ö© �?ïîÌò�?
	//
	function sendRequest(callback,data,method,url,async,sload,user,password)
	{
		//XMLHttpRequest �?ò§Î�?å�?†?Ìä�? �?É?�?Ñ±
		var oj = createHttpRequest();
		if( oj == null ) return null;
		
		//�?∞ï�?†ú Î°úÎìú�??ò �?Ñ§�?†ï
		var sload = (!!sendRequest.arguments[5])?sload:false;
		if(sload || method.toUpperCase() == 'GET')url += "?";
		if(sload)url=url+"t="+(new Date()).getTime();
		
		//Î�?åÎ?º�?ö∞�?†Ä Ìå?�?†ï
		var bwoj = new chkAjaBrowser();
		var opera	  = bwoj.bw.opera;
		var safari	  = bwoj.bw.safari;
		var konqueror = bwoj.bw.konqueror;
		var mozes	  = bwoj.bw.mozes ;

		//�?Ü°�?ã† �?≤òÎ¶¨
		//operaÎäî onreadystatechange�?ó? �?§ëÎ≥µ �??ëÎãµ�??¥ �?ûà�??Ñ �?àò �?ûà�?ñ¥ onload�?∞Ä �?ïà�?†Ñ
		//Moz,FireFoxÎäî oj.readyState==3�?ó?�?ÑúÎ?Ñ �?àò�?ã†ÌïòÎØÄÎ°ú Î≥¥ÌÜµ�??Ä onload�?∞Ä �?ïà�?†Ñ
		//Win ie�?ó?�?ÑúÎäî onload�?∞Ä Î?ô�?ûëÌïò�?ßÄ �?ïäÎäîÎã§
		//Konqueror�??Ä onload�?∞Ä Î∂à�?ïà�?†ï
		//�?∞�?�?≥† http://jsgt.org/ajax/ref/test/response/responsetext/try1.php
		if(opera || safari || mozes){
			oj.onload = function () { callback(oj); }
		} else {
		
			oj.onreadystatechange =function () 
			{
				if ( oj.readyState == 4 ){
					callback(oj);
				}
			}
		}

		//URL �??�?�?ΩîÎî©
		data = uriEncode(data)
		if(method.toUpperCase() == 'GET') {
			url += data
		}
		
		//open Î©î�?ÜåÎìú
		oj.open(method,url,async,user,password);

		setEncHeader(oj)
		oj.send(data);

		//URI �??�?�?ΩîÎî© Ìó§Î?î �?Ñ§�?†ï
		function setEncHeader(oj){
	
			var contentTypeUrlenc = 'application/x-www-form-urlencoded; charset=UTF-8';
			if(!window.opera){
				oj.setRequestHeader('Content-Type',contentTypeUrlenc);
			} else {
				if((typeof oj.setRequestHeader) == 'function')
					oj.setRequestHeader('Content-Type',contentTypeUrlenc);
			}	
			return oj
		}

		//URL �??�?�?ΩîÎî©
		function uriEncode(data){

			if(data!=""){
				//&�?ôÄ=Î°ú �??ºÎã® Î∂ÑÌï¥Ìï¥�?Ñú encode
				var encdata = '';
				var datas = data.split('&');
				for(i=1;i<datas.length;i++)
				{
					var dataq = datas[i].split('=');
					encdata += '&'+encodeURIComponent(dataq[0])+'='+encodeURIComponent(dataq[1]);
				}
			} else {
				encdata = "";
			}
			return encdata;
		}


		return oj
	}
// for ajax END

function notop() {}	

function popUp_TermsOfUseAgreement(URLStr, left, top, width, height) 
{
  	//URLStr = "http://www.cyworld.vn/main/terms_of_use_agreement.php";
  	URLStr = "http://www.cyworld.vn/main/aboutus/terms.php";
/*  	
  	left=20;
  	top=20;
  	width =590;
  	height=800;
	popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
*/
	popUpWin = open(URLStr, 'popUpWin');	
}

function popUp_PrivacyPolicy(URLStr, left, top, width, height) {
  URLStr = "http://www.cyworld.vn/main/privacy_policy.php";
  left=20;
  top=20;
  width =590;
  height=800;
	popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
} 

function goto_club(clubid,window_mode){
	if(window_mode == 1){
		window.top.location.href='http://club.cyworld.vn/club/clubmain.php?clubid='+clubid;
	}else{
		document.frm_gotoclub.action ='http://club.cyworld.vn/club/clubmain.php?clubid='+clubid;
		document.frm_gotoclub.target = "_blank";
		document.frm_gotoclub.submit();
	}
}

// some compatibility functions
if(typeof HTMLElement!="undefined" && !HTMLElement.prototype.outerHTML){
	var _emptyTags = {
	   "IMG":   true,
	   "BR":    true,
	   "INPUT": true,
	   "META":  true,
	   "LINK":  true,
	   "PARAM": true,
	   "HR":    true
	};

	HTMLElement.prototype.__defineGetter__("outerHTML", function () 
	{
		try
		{	   
			var attrs = this.attributes;
		
			   var str = "<" + this.tagName;
			   for (var i = 0; i < attrs.length; i++)
			      str += " " + attrs[i].name + "=\"" + attrs[i].value + "\"";		
			      
			   if (_emptyTags[this.tagName])
			   {
			   	return str + ">";
			   }
			   
			   return str + ">" + this.innerHTML + "</" + this.tagName + ">";
		}catch(e)
		{
		 	//return '';
			alert('err='+e);
		}	
	}
	);
}

function open_lyrics_pop(songid)
{
	var newWinUrl = "/common/music/song_info_pop.php?songid=" + songid ;
	window.open(newWinUrl,'songinfo', 'height=600,width=630,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes');
				
}

//add for design, yellowdog
function changeImage(imgname, targetId) 
{
	try
	{
		var img = "http://img.cyworld.vn/image/common/"+imgname+".jpg";
		eval("document.getElementById('"+targetId+"').src='"+img+"';");
	}
	catch(e)
	{
	}
}

//add for design, yellowdog
function displaysub(targetId, stat) {
	if(stat=="show") {
		eval("document.getElementById('"+targetId+"').style.display='';");
	} else if(stat=="hide") {
		eval("document.getElementById('"+targetId+"').style.display='none';");			
	}
}

/**	2006/11/27	HaNT	Added for design of "mall/cyworld_shop_historyacorns.php" file	*/
function playflash(file,width,height,bgcolor,quality,name){
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'" id="'+name+'">');  //플래쉬플레이어 버전이 이전버전일경우 버전 8을 변경
	document.write('');
	document.write('');
	//document.write('');  //투명플래쉬가 아닐경우 이 라인을 삭제
	document.write('');
	document.write('<object src="'+file+'" quality="'+quality+'" wmode="transparent" bgcolor="'+bgcolor+'" width="'+width+'" height="'+height+'" name="'+name+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>')
}
/**	~2006/11/27	HaNT	Added for design of "mall/cyworld_shop_historyacorns.php" file	*/

/** 2007/04/12	HaNT	Work with select_option_multiple	*/
var NS4 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) < 5);

function addOption(theSel, theText, theValue)
{
  	var newOpt = new Option(theText, theValue);
  	var selLength = theSel.length;
  	theSel.options[selLength] = newOpt;
}

function deleteOption(theSel, theIndex)
{ 
  	var selLength = theSel.length;
  	if(selLength>0)
  	{
    	theSel.options[theIndex] = null;
  	}
}

function moveOptions(theSelFrom, theSelTo, isOptionDeleted)
{
  	var selLength = theSelFrom.length;
  	var selectedText = new Array();
  	var selectedValues = new Array();
  	var selectedCount = 0;
  
  	var i;
  
  	// Find the selected Options in reverse order
  	// and delete them from the 'from' Select.
  	for(i=selLength-1; i>=0; i--)
  	{
    	if(theSelFrom.options[i].selected)
    	{
      		selectedText[selectedCount] = theSelFrom.options[i].text;
      		selectedValues[selectedCount] = theSelFrom.options[i].value;
      		
      		if(isOptionDeleted)
      		{
      			deleteOption(theSelFrom, i);
      		}
      		
      		selectedCount++;
    	}
  	}
  
  	// Add the selected text/values in reverse order.
  	// This will add the Options to the 'to' Select
  	// in the same order as they were in the 'from' Select.
  	for(i=selectedCount-1; i>=0; i--)
  	{
    	addOption(theSelTo, selectedText[i], selectedValues[i]);
  	}
  
  	if(NS4) history.go(0);
}

function selectedItemQuantity(selectedObj)
{
	var quantity = 0;
	var lenlist = selectedObj.length;
	
	for (i=lenlist-1;i>0;i--) 
            {
                	if(selectedObj.options[i].selected)
                	{
                		quantity ++;
                	}
            }
            
            return quantity; 
}
/**~2007/04/12	HaNT	Work with select_option_multiple	*/

/** 2007.07.12	HaNT	Check special character	*/
function checkSpecialCharacter(obj, kind)
{
	//var strEmail = document.frmSearchFriend.cboNameEmail.value;
	
	//frm = document.frmSearchFriend;
	//obj = frm.txtFriendName;
	if(kind=='email'){
		re = /[\~\!\#\$\%\<\>\^\&\*\(\)\-\=\+\?\"\']/i;
	}else{
		re = /[\~\!\@\#\$\%\<\>\^\&\*\(\)\-\=\+\?\"\']/i;
	}
	//re = /[~!@\#$%<>^&*\()\-=+_\?"']/gi;
	if (re.test(obj.value))
	{
		alert("Ký tự đặc biệt không được chấp nhận.");
		obj.focus();
		return false;
	}
	else
	{
		return true;
	}

} // end of checkCharacter()
/*~ 2007.07.12	HaNT	Check special character	*/

/** 2007.09.17	HaNT	Text: Limit number of characters allowed	*/
function limitlength(obj, length)
{
	var maxlength=length
	if (obj.value.length>maxlength)
	obj.value=obj.value.substring(0, maxlength)
}
/*~ 2007.09.17	HaNT	Text: Limit number of characters allowed	*/

/** 2007.09.27	HaNT	Get mod of division	*/
function getModOfDivision(dividend, divisor)
{
	quotient = Math.floor(dividend / divisor);
	
	return dividend - (quotient * divisor);
}

function getDivOfDivision(dividend, divisor) {
    return Math.floor(dividend / divisor);
}
/*~ 2007.09.17	HaNT	Get mod of division	*/

/**	2007.10.02	HaNT	Change parent page 's url.	*/


function open_new_window(url){
	
	var strUrl = url;
	
	var strUrlTmp = "about:blank";
	var WinWidth =screen.width;
	//var WinHeight = "574";
	var WinHeight =screen.height;
	var ScrollBar = "yes";
	var Resize = "yes";
	var WinGubun = "";
	var strProperty = "status=1,toolbar=1,location=1,menubar=1";
	
	
		if (!MyHompy_GSP && top.window.name == "MyHompy_GSP")
			MyHompy_GSP = top.window;

		var strName = "MyHompy_GSP";
		if(!MyHompy_GSP || MyHompy_GSP.closed || top.window.name != "MyHompy_GSP"){			
			MyHompy_GSP = WinOpenMyHome(strUrlTmp,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty);
		}
		MyHompy_GSP.focus(); 
		MyHompy_GSP.location.replace(strUrl);
		
	return MyHompy_GSP;
}

function changeURL(url, numberOfOuterLayer, isIntermediatePageClosed, isOpenNewWin)
{
	try
	{
		var offspringWin = window;
		
		if(numberOfOuterLayer != null)
		{
			var numTotalLayer = new Number(numberOfOuterLayer);
			
			if(numTotalLayer != NaN)
			{
				if(numTotalLayer > 0)
				{
					for(i = 0; i < numTotalLayer; i ++)
					{
						offspringWin = offspringWin.parent;
					}
					
					offspringWin.opener.document.location = url;
				}
				else if(numTotalLayer == 0)
				{
					offspringWin.document.location = url;
				}
			}
		}
		else
		{
			offspringWin.document.location = url;
		}
	}
	catch(e)
	{
		//alert("Rất tiếc, không thay đổi được địa chỉ của trang web.");
		
	
		if(offspringWin.opener == null)//FF : Can't check the opener was closed with IE.
		{	
			//alert("")
		}
		
/** If the opener was closed, open new window. But if the next time use this function, still open new window else because the opener is still null.*/		
		if(isOpenNewWin)
			new_win = open_new_window(url);
/**~If the opener was closed, open new window.	*/
		
		offspringWin.document.location = url;
		
		return false;
	}
	
	try
	{
		offspringWin.opener.focus();
	}
	catch(e)
	{
		if(isOpenNewWin)
			new_win.focus();
		else			
			self.focus();
	}
	
	if(isIntermediatePageClosed == true)
	{
		try
		{
			offspringWin.close();
		}
		catch(e)
		{
			//alert("Rất tiếc, không thể đóng trang web này.");
			
			return false;
		}
	}
	
	return true;
}
/**~2007.10.02	HaNT	Change parent page 's url.	*/

//Begin: minhnb 2007.10.07
//function checkCapsLock( e , id, viewL, viewT ) {
function checkCapsLock( e, viewL, viewT ) {
	var myKeyCode=0;
	var myShiftKey=false;

	// Internet Explorer 4+
	if ( document.all ) {
		myKeyCode=e.keyCode;
		myShiftKey=e.shiftKey;

	// Netscape 4
	} else if ( document.layers ) {
		myKeyCode=e.which;
		myShiftKey=( myKeyCode == 16 ) ? true : false;

	// Netscape 6
	} else if ( document.getElementById ) {
		myKeyCode=e.which;
		myShiftKey=( myKeyCode == 16 ) ? true : false;

	}

	// Upper case letters are seen without depressing the Shift key, therefore Caps Lock is on
//	if ( ( myKeyCode >= 65 && myKeyCode <= 90 ) && !myShiftKey ) {
//		showBalloonNew(1,id,str_login_caps_lock_alert, viewL, viewT );//alert( myMsg );
//
//	// Lower case letters are seen while depressing the Shift key, therefore Caps Lock is on
//	} else if ( ( myKeyCode >= 97 && myKeyCode <= 122 ) && myShiftKey ) {
//		showBalloonNew(1,id,str_login_caps_lock_alert, viewL, viewT );//alert( myMsg );
//
//	}else{
//		showBalloonNew(0,id);
//	}
}

function showBalloonNew (show,id,view_msg, viewL, viewT ){
	var ver = navigator.appVersion;	
	var eventTop,eventLeft;
	
	document.getElementById(id).style.left='0px';
	document.getElementById(id).style.top='0px';
	document.getElementById(id).innerHTML='</div>';
	document.getElementById(id).style.visibility="hidden";

	if (show==1) 
	{

		eventLeft	= viewL;
		eventTop	= viewT;
    	
		document.getElementById(id).style.left=eventLeft + 'px';
		document.getElementById(id).style.top=eventTop + 'px';
		document.getElementById(id).style.width=179 + 'px';
		
		document.getElementById(id).innerHTML=view_msg;
		document.getElementById('balloon_bg2').style.height=60+'px';
		document.getElementById('balloon_bg2').style.width=29+'px';
		document.getElementById('balloon_bg2').width=29+'px';
		//alert('minhnb2');
		document.getElementById(id).style.visibility="visible";
	}
	else if (show==0)
	{
		document.getElementById(id).style.visibility="hidden";
	}
}

//End: minhnb 2007.10.07


//add: quynhdn
//date: 2008.02.01
//do: Change image of collapse 
function switchSrcoll( collapseobj, imgID, imgNameUp, imgNameDown, Url)
{	
	try
	{
		state= false;
		imgType= 'none';
		if(typeof (collapseobj)!="undefined")
		{
			collapseobj.slideit();				
			state= collapseobj.getLoadState();				
			imgType= collapseobj.getActionType();								
		}			
		//not load
		if(state== false || imgType== 'none') return false;		
		obj= document.getElementById(imgID);
		file_name='';
		if(imgType=='up' )
		{
			file_name= imgNameDown;
			obj.title= "Mở rộng";
		}
		else if ( imgType=='down')
		{
			file_name= imgNameUp;
			obj.title= "Thu gọn";
		}			
		if( file_name != '')
		obj.src= Url+ file_name;	
		return true;		
	} catch (err) { }
}

//add: MInhnb
//date: 2008.08.05
function showMenu(targetId) {
   if (document.getElementById) {
    target = document.getElementById( targetId );
	target.style.display = "block";
   }
}
function hideMenu(targetId){
   if (document.getElementById) {
    target = document.getElementById( targetId );
	target.style.display = "none";
   }
}


function fadein(pic,opacity) {
	  if(pic!=null)
	  {
		    if (typeof opacity != 'undefined') fadein_opacity = opacity;
		    if(typeof pic.style.MozOpacity != 'undefined')//FF
		    {
			      if (fadein_opacity < 1 && pic && pic.style)
			      {
			         fadein_opacity += .05;
			         pic.style.MozOpacity = fadein_opacity;
			         setTimeout(function(){fadein(pic)}, 50);
			      }
		    }
		    else//IE
		    {
			        if(pic.style.filter=="") pic.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=0)";
		    	        if(pic.filters.item("DXImageTransform.Microsoft.Alpha").opacity<100)
			         {
			                 pic.filters.item("DXImageTransform.Microsoft.Alpha").opacity += 5;
			                setTimeout(function(){fadein(pic)}, 50);
			         }
		    }
	  }
}
function tgtTransitions(trans_div) {
        if (navigator.appName == "Microsoft Internet Explorer")
        {
	        var arrIrisStyles = ['DIAMOND','CIRCLE','CROSS','PLUS','SQUARE','STAR'];
	        var arrSlideStyles = ['HIDE','PUSH','SWAP'];
	        var arrStretchStyles = ['HIDE','PUSH','SPIN'];
	
	        var arr_filters = new Array();
	        arr_filters[0] = "progid:DXImageTransform.Microsoft.Blinds(direction='down',bands="+Math.random()*12 + 3+")";
	        arr_filters[1] = "progid:DXImageTransform.Microsoft.Barn(motion='out',orientation='vertical')";
	        arr_filters[2] = "progid:DXImageTransform.Microsoft.CheckerBoard(direction='left')";
	        arr_filters[3] = "progid:DXImageTransform.Microsoft.gradientWipe(gradientsize=0.5)";
	        arr_filters[4] = "progid:DXImageTransform.Microsoft.Inset()";
	        arr_filters[5] = "progid:DXImageTransform.Microsoft.Iris(irisstyle ='"+arrIrisStyles[Math.floor(Math.random()*6)] +"')";
	        arr_filters[6] = "progid:DXImageTransform.Microsoft.Pixelate(enabled='true')";
	        arr_filters[7] = "progid:DXImageTransform.Microsoft.RadialWipe()";
	        arr_filters[8] = "progid:DXImageTransform.Microsoft.RandomBars()";
	        arr_filters[9] = "progid:DXImageTransform.Microsoft.RandomDissolve()";
	        arr_filters[10] = "progid:DXImageTransform.Microsoft.Slide(bands='8',SlideStyle ='"+arrSlideStyles[Math.floor(Math.random()*3)]+"')";
	        arr_filters[11] = "progid:DXImageTransform.Microsoft.Spiral(GridSizeX=25, GridSizeY=25)";
	        arr_filters[12] = "progid:DXImageTransform.Microsoft.Stretch(StretchStyle ='"+arrStretchStyles[Math.floor(Math.random()*3)]+"')";
	        arr_filters[13] = "progid:DXImageTransform.Microsoft.Wheel(spokes=8)";
	        arr_filters[14] = "progid:DXImageTransform.Microsoft.Zigzag(GridSizeX=25, GridSizeY=25)";
	        var idx = Math.floor(Math.random()*15);
	        trans_div.style.filter = arr_filters[idx];
	        trans_div.filters[0].Apply();
	        // After you set Apply, changes to the object
	        //  are not displayed until Play is called.
	        trans_div.filters[0].Play(duration=2);
        }
}


function isEmpty(val, isExceptedWhiteSpace)
{
	if(typeof(val) != "undefined")
	{
		val = "" + val;
		
		if(typeof(isExceptedWhiteSpace) == "undefined")
			isExceptedWhiteSpace = false;
			
		if(isExceptedWhiteSpace == true)
			val = trim(val);
			
		if (val.match(/^s+$/) || val == "")
		{
			return true;
		}
		else
		{
			return false;
		} 
	}
	else
	{
		return true;
	}
}


function isNumber(val, isExceptedWhiteSpace)
{
	if(typeof(val) != "undefined")
	{
		if(typeof(isExceptedWhiteSpace) == "undefined")
			isExceptedWhiteSpace = false;
			
		if(isEmpty(val, isExceptedWhiteSpace))
			return false;
//	
		if (isNaN(val))
		{
			return false;
		}
		else
		{
			return true;
		} 
	}
	else
	{
		return false;
	}
}


/**	2008.09.24	HaNT	This function is used for Poke.	*/
//function getPokeEmoticonTrans(str_poke, type, size, isChecked)
//{				
//	var arr_macdinh = array 		(
//									 "macdinh"=>"Mặc định"	
//								);
//		
//	var arr_lamquen = array 		(
//									 "chocuoi"=>"Chó cười"
//									,"chonhaymat"=>"Chó nháy mắt"
//									,"chotanghoa"=>"Chó tặng hoa"
//									,"chotangqua"=>"Chó tặng quà"
//									,"cuoi"=>"Cười"
//									,"lonbattay"=>"Lợn bắt tay"
//									,"lonchao"=>"Lợn chào"
//									,"longuithiep"=>"Lợn gửi thiệp"
//									,"lonnhaymat"=>"Lợn nhắy mắt"
//									,"lontanghoa"=>"Lợn tặng hoa"
//									,"vitnhaymat"=>"Vịt nhắy mắt"
//								);
//		
//	var arr_henho = array 			(
//									 "chohon"=>"Chó hôn"
//									,"chohonrua"=>"Chó hôn rùa"
//									,"chokhoacvai"=>"Chó khoác vai"
//									,"choleluoi"=>"Chó lè lưỡi"
//									,"choomvit"=>"Chó ôm vịt"
//									,"leluoi"=>"Lè lưỡi"
//									,"nguoikhoacvai"=>"Người khoác vai"
//									,"ruadomat"=>"Rùa đỏ mặt"
//									,"vithon"=>"Vịt hôn"
//								);
//		
//	var arr_quayroi = array 		(
//									 "can"=>"Cắn"
//									,"chochamtran"=>"Chó chạm trán"
//									,"choliecxeo"=>"Chó liếc xéo"
//									,"chongangchan"=>"Chó ngáng chân"
//									,"chonhindeu"=>"Chó nhìn đểu"
//									,"da"=>"Đá"
//									,"dai"=>"Đái"
//									,"dam"=>"Đấm"
//									,"dedacho"=>"Dê đá chó"
//									,"khidacho"=>"Khỉ đá chó"
//									,"khidaditcho"=>"Khỉ đá đít chó"
//									,"khidagayrang"=>"Khỉ đá gẵy răng"
//									,"khidamatcho"=>"Khỉ đá mặt chó"
//									,"khinemcho"=>"Khỉ ném chó"
//									,"khilengoicho"=>"Khỉ lên gối chó"
//									,"khinemda"=>"Khỉ ném đá"
//									,"khinhodaude"=>"Khỉ nhổ dâu dê"
//									,"khitocvay"=>"Khỉ tốc váy"
//									,"longiaothong"=>"Lợn giao thông"
//									,"lontebay"=>"Lợn tè bậy"
//									,"lonthanchet"=>"Lợn thần chết"
//									,"nemtrungthoi"=>"Ném trứng thối"
//									,"nhonuocbot"=>"Nhổ nước bọt"
//									,"soden"=>"Sổ đen"
//									,"tat"=>"Tát"
//									,"tebay"=>"Tè bậy"
//									,"tutquan"=>"Tụt quần"
//									,"vitnemda"=>"Vịt ném đá"
//									,"vitngangchan"=>"Vịt ngáng chân"
//								);
//		
//	var arr_kynghi = array 		(
//									 "chohalowin"=>"Chó halowin"
//									,"giangsinh"=>"Giáng sinh"
//									,"lontambien"=>"Lợn tắm biển"
//									,"lonvalentine"=>"Lợn valentime"
//									,"vit8.3"=>"Vịt"
//								);
//		
//	var arr_thethao = array 		(
//									 "boi"=>"bơi"
//									,"bowling"=>"bowling"
//									,"choboxing"=>"Chó boxing"
//									,"chohat"=>"Chó hát"
//									,"chohitdat"=>"Chó hít đất"
//									,"hatkaraoke"=>"Hát karaoke"
//									,"hitdat"=>"Hít đất"
//									,"londapxe"=>"Lợn đạp xe"
//									,"lonhatkaraoke"=>"Lợn hát karaoke"
//									,"lonlaixe"=>"Lợn lái xe"
//									,"vitkaraoke"=>"Vịt karaoke"
//								);
//		
//	var arr_chucmung = array 		(
//									 "chouongbia"=>"Chó uống bia"
//									,"lonuong bia"=>"Lợn uống bia"
//									,"ruatangqua"=>"Rùa tặng quà"
//									,"tangbanhsinhnhat"=>"Tặng bánh sinh nhật"
//									,"votay"=>"Vỗ tay"
//								);
//		
//	var arr_matcuoi = array 		(
//									 "chocuoinherang"=>"Chó cười nhe răng"
//									,"chosuynghi"=>"Chó suy nghĩ"
//									,"cuoinherang"=>"Cười nhe răng"
//									,"loncuoi"=>"Lợn cười"
//									,"longoidien"=>"Lợn gọi điện"
//									,"lonkhoc"=>"Lợn khóc"
//									,"lonleluoi"=>"Lợn lè lưỡi"
//									,"lonom"=>"Lợn ốm"
//								);
//		
//		
//	var arr_category = array 		(
//										"macdinh" 		=> array(
//																		"tooltip" 		=> 	"Mặc định"
//																	,	"array"			=>	arr_macdinh
//																)
//									,	"lamquen" 		=> array(
//																		"tooltip" 		=> 	"Làm quen"
//																	,	"array"			=>	arr_lamquen
//																)
//									,	"henho" 		=> array(
//																		"tooltip" 		=> 	"Hẹn hò"
//																	,	"array"			=>	arr_henho
//																)
//									,	"quayroi" 		=> array(
//																		"tooltip" 		=> 	"Quấy rối"
//																	,	"array"			=>	arr_quayroi
//																)
//									,	"kynghi" 		=> array(
//																		"tooltip" 		=> 	"Kỳ nghỉ"
//																	,	"array"			=>	arr_kynghi
//																)
//									,	"thethao" 		=> array(
//																		"tooltip" 		=> 	"Thể thao"
//																	,	"array"			=>	arr_thethao
//																)
//									,	"chucmung" 		=> array(
//																		"tooltip" 		=> 	"Chúc mừng"
//																	,	"array"			=>	arr_chucmung
//																)
//									,	"matcuoi" 		=> array(
//																		"tooltip" 		=> 	"Mặt cười"
//																	,	"array"			=>	arr_matcuoi
//																)
//								);
//								
//								
//	var arr_poke_content 			= split("_", str_poke);
//	var str_category 				= arr_poke_content[0];
//	var str_emotion 				= arr_poke_content[1];
//	
//	var str_height_width	= '';
//	var str_extra_url		= '';
//	var str_extra_class		= '';
//	
//	
//	if(type == "img" || type == "div")
//	{
//		if(size == 'b')
//		{
//			str_height_width	= ' width="50px" height="50px"';
//			str_extra_url		= '.gif';
//			str_extra_class	= '';
//		}
//		else 
//		{
//			str_height_width	= ' width="16px" height="16px"';	
//			str_extra_url		= '_thumb.gif';
//			str_extra_class	= ' class="pok_psiimgpoke"';
//		}
//	}
//	
//
//	var strRtnContent = '';
//	switch ( type)
//	{
//		case 'img':
//			strRtnContent = '<img src="http://img.cyworld.vn/image/pock/'. str_category .'/'. str_emotion .'/'. str_emotion .''. str_extra_url .'"'. str_height_width . str_extra_class .'>';			
//			break;
//		case 'p':
//			strRtnContent = '<p class="pok_psittcont">'. arr_category[str_category]["array"][str_emotion] .'</p>';
//			break;
//		case 'div':
//			if(size == "s")
//			{
//				strRtnContent  = 		'	
//											<div url="http://img.cyworld.vn/image/pock/'. str_category .'/'. str_emotion .'/'. str_emotion . str_extra_url .'" content="'. arr_category[str_category]["array"][str_emotion] .'" class="pok_psiviewpok">';
//				strRtnContent .=		'	
//												<input type="radio" id="'. str_category .'_'. str_emotion .'" onclick="javascript:changePoke(this)" '. (isChecked?'checked':'') .' name="poke_radio" class="pok_vpsiradio"  >';
//				strRtnContent .=		'		
//												<img src="http://img.cyworld.vn/image/pock/'. str_category .'/'. str_emotion .'/'. str_emotion . str_extra_url .'"'. str_height_width . str_extra_class .'>';
//				strRtnContent .=		'		
//												<p class="pok_psittcont">'. arr_category[str_category]["array"][str_emotion] .'</p>';
//				strRtnContent .=		'	
//											</div>';
//			}
//			else 
//			{
////				strRtnContent .=		'	
////											<span class="selected_poke">	
////												<div  class="pok_ttbig"><b id="selected_poke_b">'. arr_category[str_category]["array"][str_emotion] .'</b></div>';
////				strRtnContent .=		'		
////												<a class="pok_img"><img id="selected_poke_img" src="http://img.cyworld.vn/image/pock/'. str_category .'/'. str_emotion .'/'. str_emotion . str_extra_url .'"'. str_height_width . str_extra_class .'></a>
////											</span>';
//				strRtnContent .=		'	
//												<div  class="pok_ttbig"><b id="selected_poke_b" poke="'. str_category .'/'. str_emotion .'" >'. arr_category[str_category]["array"][str_emotion] .'</b></div>';
//				strRtnContent .=		'		
//												<a class="pok_img"><img id="selected_poke_img" src="http://img.cyworld.vn/image/pock/'. str_category .'/'. str_emotion .'/'. str_emotion . str_extra_url .'"'. str_height_width . str_extra_class .'></a>';
//			}
//			break;
//	}
//								
//	return 	strRtnContent;
//}
/**~2008.09.24	HaNT	This function is used for Poke.	*/




//Handle register button click!
function registerOnClick(initial){
	var backUrl;
	var objLocation;
	var registerUrl
	if(self.parent)
		objLocation= self.parent.document.location;
	else
		objLocation= document.location;	
	backUrl= objLocation.href;
	if(typeof(initial)=='undefined' || !initial || initial=='')
		initial='cyworld';
	registerUrl= 'http://www.cyworld.vn/main/register.php?init='+initial+'&back='+encodeURIComponent(backUrl);
	objLocation.href= registerUrl; 
	return false;
}