
/**
* @ GSP ???? ???? Javascript
* @ Athor : johosug
* @ CreateDate		: 2006-02-07
* @ Change History	: 2006-11-22 Eugene Voznesensky <eugene.voznesensky@cyworldinc.com> added str_msg__quotes_group_names
* @ Change History	: 2006-12-20 Wendy added TextAreaMaxLength() function
* @ Change History	: 2006-12-20 Wendy added TextAreaMaxLength_Editor() Dec. 21, 2006	
**/
//------------------------------------------------
// ??? ?? ?? 
//------------------------------------------------
//common.js


////////////////// new msg variables //////////////////////////
var str_msg_email_none = "We couldn't find the email address you entered. Please try again.";
var str_msg_password_none = "The password doesn't match the email address you entered. Please try again.";
var str_msg_exit_member = "We're sorry. That account has been terminated. Please contact a Cyworld administrator at info@cyworldinc.com.";
var str_msg_suspend_member = "We're sorry. That account has been suspended. Please contact a Cyworld administrator at info@cyworldinc.com.";
var str_msg_warning_member = "We're sorry. Your membership has been temporarily suspended due to reports of abusive activity. \nIf you have questions or would like more information, please email support@cyworldinc.com.";
var str_msg_delete = "Are you sure you want to delete that? \nYou won't be able to change your mind once you do.";
var str_msg_cancel = "Are you sure you want to cancel that?";
var str_msg_delete_select = "Please select the item(s) you'd like to delete.";
var str_msg_email_input = "Please enter your email address.";
var str_msg_email_search = "Please enter an email address.";
var str_msg_an_email_input = "Please enter a valid email address.";
var str_msg_password_length = "Your password must be 4-16 characters. Please try again.";
var str_msg_password_input = "Please enter your password.";
var str_msg_repassword_input = "Please re-type your password.";
var str_msg_search_input = "Please enter a search term.";
var str_msg_id_input = "Please enter an address for your Profile.";
var str_msg_id_invalid_id = "You may only use letters and numbers in your address.";
var str_msg_none_concent = "Please enter text in the body of the message.";
var str_msg_none_txtSendName = "Please select a recipient.";
var str_msg_cp_input = "Please enter your cell phone number.";
var str_msg_buddy_self = "You cannot be a friend to yourself, so you do not need to add yourself to your list of friends.";
var str_msg_buddy_end_self = "We're sorry. You can't cut off a relationship with yourself.";
var str_msg_memo_send_self = "We're sorry. You can't send a Message to yourself.";
var str_msg_invte_send_self = "We're sorry. You can't invite yourself.";
var str_msg_chat_send_self = "We’re sorry. You can’t request to chat by yourself.";
var str_msg_memo_send_ok = "Are you sure you want to send this Message?";
var str_msg_memo_end_self = "You cannot block yourself from receiving Messages from yourself.";
var str_msg_buddy_friend_id_none = "We couldn't find that Cyworld member. Please check the name or email address and try again.";
var str_msg_email_send_process_ok = "Your message has been sent.";
var str_msg_send_cut = "We're sorry. You can't send to more than 100 people at a time. Remove some recipients and try again.";
var str_msg_memo_cut = "We're sorry. Your message cannot exceed 10,000 characters."; 
var msg_move_minihompy = "Would you like to go to your Profile?";
var str_login_msg=" You must log in to access this feature.";
var str_msg_filling_completed = "Your acorns have been refilled. Thanks and happy shopping!";
var str_msg_filling_fail = "We weren't able to refill acorns. Please try again.";
var str_msg_appeal = "Do you want to ask your friend for this item? Are you sure you'd like to ask for this item?";
var str_msg_select_friend = "Please select a friend.";
var str_msg_input_message = "Please enter a message.";
var str_msg_cymoney_spent = "We're sorry. You don't have enough acorns for that item. Please refill acorns and try again.";
var str_msg_wishbox_cant_use_coupon = "You cannot use coupons to send items to your Wish List.";
var str_msg_appeal_cant_use_coupon = "You cannot use a coupon to receive this item as a gift.";
var str_msg_select_items = "Please choose an item.";
var str_msg_check_one = "Please select from the list.";
var str_apply_music_item = "Your music has been applied. Thanks and enjoy!";
var str_search_text_short = "Please enter a keyword at least two characters long.";
var str_gift_reject_confirm = "Are you sure you'd like to reject this gift?";
var str_item_id_is_null = "We're sorry. That item doesn't exist.";
var str_gift_later = "Do you want to send the request later? We'll save the message for 30 days.";
var str_msg_no_quest = "No request received.";
var str_msg_no_gift = "No gift received.";
var str_msg_none_name = "Please enter your name.";
var str_msg_none_display_name = "Please enter a new screen name.";
var str_msg_valid_name = "You may not use special characters or text other than English.";
var str_msg_valid_display_name = "You may not use special characters or text other than English.";
var str_msg_none_name_search = "Please enter a name to search for.";
var str_msg_none_miniid = "Please enter the address of your Profile.";
var str_msg_save_box_move = "Do you want to save this Message in your archive?";
var str_msg_save_box_move_select = "Please select the Message you'd like to move.";
var str_msg_memo_send_select = "Please select the friend you'd like to send a Message to.";
var str_msg_receive_select = "Please select a person or group you want to block from sending you Messages.";
var str_msg_my_nickname = "Please enter your relationship.";
var str_msg_other_nickname = "Please enter a relationship for your friend.";
var str_msg_memo_delete = " Are you sure you want to delete this Message?";
var str_msg_memo_save_move = "Would you like to move that Message to the archive?";
var str_msg_buddy_invite_ok = "Are you sure you'd like to accept this invitation?";
var str_msg_buddy_invite_no = "Are you sure you want to reject this invitation?";
var str_msg_buddy_invite_reserve = "Should we hold this invitation and let you decide later?";
var str_msg_buddy_invite_search_cancel = "We're sorry. You can only cancel invitations from the 'Pending Invitations' list.";
var str_msg_buddy_invite_search_select = "Please select the invitation you'd like to cancel.";
var str_msg_buddy_invite_max = "We're sorry. You can't have more than 30 pending invitations. Should we delete the oldest one to make room for the one you're trying to send?";
var str_msg_buddy_management_group_name_input = "Please enter a name for the group.";
var str_msg_buddy_management_group_member_select = "Please select a member from your Friends List."; //var str_msg_buddy_management_group_member_select = "Please select a member from the group.";
var str_msg_buddy_management_group_name_change = "Please enter a new name for this group.";
var str_msg_member_key = "That is not a valid certificate key.";
var str_msg_not_eq_password = "Incorrect password.";
var str_msg_reg_email = "We're sorry. There's already a Cyworld account with that email address.";
var str_msg_process_ok = "Process has been completed.";
var str_msg_icon_warning = "Icon cannot be put in.";
var str_msg_memo_blacklist_warning = "That name is already on your blacklist.";
var str_msg_school_input = "Please enter the name of your school.";
var str_msg_year_select = "Please select a year.";
var str_msg_month_select = "Please select a month.";
var str_msg_day_select = "Please select a day.";
var str_msg_birthday_select = "Please select your birthday.";
var str_msg_address_select = "Please enter your address.";
var str_msg_friend_email_input = " Please enter your friend's email address.";
var str_msg_reg_minihp = "We're sorry. That Profile address is not available. Please try again.";
var str_msg_other_error = "We're sorry. We weren't able to complete your registration. Please contact a Cyworld administrator at info@cyworldinc.com.";
var str_msg_no_minihpdomain = "Please enter an address for your Profile.";
var str_msg_no_screenname = "Please enter a screen name.";
var str_msg_invite_history_delete = " Are you sure you want to delete selected invitee(s)?";
var str_msg_invite_history_select = "Please select the invitee(s) you'd like to delete."; 

//ps_person_info.js
var str_msg_email_check_input = "Please check to be sure your email address is formatted correctly. For example: yourname@isp.com";
var str_msg_email_check_reinput = "Please verify your new email address.";
var str_msg_email_double = "You're already registered with that email address. To change it, enter a different one.";
var str_msg_password_reinput = "Please enter a new password.";
var str_msg_password_reinput_too ="Please enter a new password.";
var str_msg_password_double = "Please verify your new password.";
var str_msg_password_mismatch = "Your passwords must match. Please try again.";

//ps_profile_personal_info.php
var str_msg_authority = "We're sorry. You don't have access to this part of Cyworld.";
var str_msg_person_search_type = "Selecting 'Non-searchable' will prevent members from finding you through the People Finder.";
var str_msg_random_move_type = "Selecting 'Non-searchable' will prevent members from viewing your Profile through the Random Profile link.";

// ps_only.js
var str_msg_no_mh_title = "Please enter a title for your Profile.";
var str_msg_no_img = "Please upload an image.";
var str_msg_no_folder_name = "Please enter a name for the folder.";
var str_msg_no_menu_name = "Please enter a name for the tab.";


// ps phototool
var str_msg_no_photo_found = "Photo cannot be found or permission denied.";
var str_msg_photo_saved = "Photo has been saved successfully.";
var str_msg_photo_save_failed = "Photo cannot be saved or the process is cancelled.";
var str_msg_photo_window_opened = "A window has been opened for another image, please close the window and try again.";

// ps video 
var str_msg_video_saved = "Video has been saved successfully.";
var str_msg_video_save_failed = "Video failed to save.";


// ps ??? ?? by ???
var msg_item_appaly = "Your item has been applied.";
var msg_item_appaly_confirm = "Are you sure you want to apply the item?";
var msg_item_apply_confirm = "Are you sure you want to apply the item?";
var msg_item_disappaly_confirm = "Would you like to remove the item from your Miniroom?";
var msg_item_disappaly_charms_confirm = "Would you like to remove your current charm from your Profile?";
var msg_item_disappaly_skins_confirm = "Would you like to remove your current skin from your Profile?";
var msg_item_disappaly = "Your item has been removed from your Miniroom.";
var msg_item_disappaly_charms = "The charm has been removed.";
var msg_item_disappaly_skins = "The skin has been removed.";
var str_msg_item_enable = "Your item has been enabled.";
var str_msg_item_disable = "Your item has been disabled.";
var str_msg_item_delete = "Your item has been deleted.";
// PS ?? ??? - by ???
var str_msg_no_member = "Please login.";
var str_msg_plz_login = "Please login.";
var str_msg_no_selected_del_post = "Please select the item you'd like to delete.";
var str_msg_confirm_update =" Are you sure you'd like to update your Profile?";
var str_msg_confirm_delete = "Are you sure you want to delete that? \nYou won't be able to change your mind once you do.";
var str_msg_bookmark_no_title = "Please enter a name for this favorite.";
var str_msg_no_url = "Please enter a Web site address for this favorite.";
var str_msg_invalid_url = "The URL you entered is not valid.";
var str_msg_select_just_one = "Favorites can only be kept in one folder. Please choose one.";
var str_msg_no_title = "Please enter a title.";
var str_msg_no_content = "Please enter text in the body of the message.";
var str_msg_no_music_title = "No music title.";
var str_msg_no_artist = "No artist.";
var str_msg_no_img = "Please upload an image.";
var str_msg_no_comment = "Please enter a comment.";
var str_msg_no_search_value = "We're sorry. We couldn't find any results for your search.";
var str_msg_diary_no_emoticon = "Choose an emotion to let others know how you're feeling.";
var str_msg_diary_no_weather = "Please choose today's weather (either out your window or in Cyworld).";
var str_msg_no_selected_move_post = "Please select the item you'd like to move.";
var str_msg_no_friends_note = "Please leave a comment for or about your friend.";
var str_msg_no_select_folder = "Please select a folder.";
var str_msg_no_cp = "A cell phone number is required. Please enter yours to continue.";
var str_msg_no_anniverdary = "A birthday is required. Please enter yours to continue.";
var str_msg_no_message = "Please complete all required fields.";
var str_msg_cant_upload = "We're sorry. Your file could not be uploaded.";
var str_msg_over_file_size = "Attachments can't be larger than 2MB.";
var str_msg_public_view =  "Switchover as OPEN.";
var str_msg_private_view =  "Switchover as CLOSED.";
var str_msg_public_change =  "Are you sure you want to turn it to OPEN?";
var str_msg_private_change =  "Are you sure you want to turn it to CLOSED?";
var str_msg_img_none =  "Please select an image to upload.";
var str_msg_no_authority = "We're sorry. You don't have permission to read that.";
var str_msg_limit_tab_name = "Tab names are limited to eight characters.";
var str_msg_limit_creating_tab = "The maximum number of tabs you can create is seven.";
var str_msg_confirm_register_coverstory = "Would you like to save your cover story?";
var str_msg_over_max_string_length = "The maximum number of characters is ***.";

// 2008-03-27 Nimish for PS Album
var str_msg_no_album_selected = "Please select an album to move your photos.";

// ps miniroom
var str_msg_miniroom_description = "Please enter a description for this Miniroom.";

// PS ??? by ???
var str_msg_select_em_none = "Please choose an emotion to let others know how you're feeling.";
var str_msg_select_wea_none = "Please choose today's weather (either out your window or in Cyworld).";

// PS ??? by zmania
var str_msg_submit_with_file = "Please select a file to attach.";

// PS by adou
var str_msg_at_least_one_folder = "Please create at least one folder.";
//All contents in the folder will be deleted.\nAre you sure you want to delete? Are you sure you want to delete the contents of this folder? You won't be able to change your mind once you do.";
var str_msg_delete_folder_confirm = "Are you sure you want to delete this folder and its contents? You won't be able to change your mind once you do.";
var str_msg_at_least_one_tab = "Please use at least one tab on your Profile.";
//All contents in the tab will be deleted.\nAre you sure you want to delete? Are you sure you want to delete the contents of this tab? You won't be able to change your mind once you do.";
var str_msg_delete_tab_confirm = "Are you sure you want to delete this tab and its contents? You won't be able to change your mind once you do.";

var str_msg_bad_folder_name = "You cannot use these letters for a folder name.";

// 2005-06-21 by bate
var str_msg_gift_CyMoney_is_zero = "You don't have any acorns. Please refill acorns.";

//replaced old variable 2006-08-14  by Alton
var FOUND_DENY_WORDS = "Oh, my! That's not appropriate here in Cyworld (and we think you know that). Please have fun, but please keep it clean. Okay?";
var FOUND_DENY_CHARACTERS = "We're sorry. Currently Cyworld USA does not support the use of foreign language fonts.  For more information, please visit our help section.";


// Club > Club_gen_step1_proc.php by shlee
var str_msg_some_item_no_data = "You have not entered all the required information. Please go back and try again.";
var str_msg_clubkeyword_must_one_more = "Please enter at least one keyword to describe your club.";
var str_msg_cancel_clubclose = "Canceled club closing.";
var str_msg_clubclose = "Your club has been closed.";
// 2006.08.02 by Alex
var str_msg_choose_board_to_add = "Choose board to add.";
var str_msg_choose_board_to_delete = "Select board to delete";
var str_msg_confirm_delete_board = "Are you sure you\'d like to delete this board?";
var str_msg_open_board_cannot_delete = "Open Board can not be deleted.";
var str_msg_delete_all_board = "All the messages in the board will be deleted, too.";
var str_msg_select_title_folder = "Select title to folder.";
var str_msg_select_board_for_comment = "Select board to apply comments board.";
var str_msg_select_board_for_anounymous = "Select board to assign anounymous board.";
var str_msg_select_board_for_indent = "Select board to indent";
var str_msg_head_cannot_indent = "Header cannot be indented.";
var str_msg_select_board_to_move = "Select board to move";
var str_msg_select_board_for_rename = "Select board to modify name";

var str_msg_sure_accept = "Are you sure you'd like to accept?";
var str_msg_sure_deny = "Are you sure you'd like to decline?"; 
var str_msg_accept_clubhandover = "You've accepted the request to hand over leadership of the club.";
var str_msg_accept_clubinvite = "You've accepted the invitation to join this club and are now a member, have fun!";
var str_msg_deny_clubhandover = "You've declined the request to hand over leadership of the club.";
var str_msg_deny_clubinvite = "You've declined the invitation to join this club.";


// Mall > Music
// 2006.08.07
var str_msg_select_at_least_one = "Please select at least one music from the list";
var str_msg_confirmation_box = "Buy this items you have checked, or continue viewing another page. If you continue viewing another page, you will lose items checked on this page.";

// Mall > Send Gift
var str_msg_not_enough_money = "Sorry, you don't have enough acorns.";
var str_msg_select_at_least_one_item = "Please select at least one item";

// Main > buddy_management_group_{make_Wview.php|view_list.php}
var str_msg__quotes_group_names = "Single and double quotes are not allowed in group names.";


// Main > quickstart_validation
var str_msg_select_im_required = "Please select one of the IM options";
var str_msg_valid_im_required = "Please enter an IM account information";
var str_msg_valid_email_required = "Please enter a valid email address";
var str_msg_validate_code_required = "Please enter a validation code";
var str_msg_validate_failed_tryagain = "Validate failed and please try again.";
var str_msg_validate_msn_email_required = "Please enter username in form of email address.";
var str_msg_validate_completed = "Thanks for validating your account and being real.";


// PS > Plaza Submittion
var str_msg_plaza_sent = "Thanks for sharing! The Plaza is a great way to\nshow off your original creations. Our team will\nreview your submission. If it's Plaza-worthy,\nyou'll see it there soon.";
var str_msg_plaza_send_failed = "Sorry, the post cannot go to plaza due to system error. Please try again.";
var str_msg_plaza_video_already_posted = "Thanks for your submission to the Plaza. However, according\nto our records, it looks like you've already submitted this\nitem. Once you've submitted something to the Plaza it can't\nbe re-submitted or edited. Thanks again for sharing.";
var str_msg_plaza_photo_already_posted = "Thanks for your submission to the Plaza. However, according\nto our records, it looks like you've already submitted this\nitem. Once you've submitted something to the Plaza it can't\nbe re-submitted or edited. Thanks again for sharing.";
////////////////////////////////// new msg variables ////////////////////////////////////





// ???(??)
var int_star_sign_cnt = 12;
var str_my_star_name = new Array();
str_my_star_name[1] = new Array("Aquarius","Aquarius");
str_my_star_name[2] = new Array("Pisces","Pisces");
str_my_star_name[3] = new Array("Aries","Aries");
str_my_star_name[4] = new Array("Taurus","Taurus");
str_my_star_name[5] = new Array("Gemini","Gemini");
str_my_star_name[6] = new Array("Cancer","Cancer");
str_my_star_name[7] = new Array("Leo","Leo");
str_my_star_name[8] = new Array("Virgo","Virgo");
str_my_star_name[9] = new Array("Libra","Libra");
str_my_star_name[10] = new Array("Scorpio","Scorpio");
str_my_star_name[11] = new Array("Sagittarius","Sagittarius");
str_my_star_name[12] = new Array("Capricorn","Capricorn");

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 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; }
}

//??? ?? ??
function LoginCheck(fn){

	if (trim(fn.txtEmail.value) == "" || trim(fn.txtEmail.value) == "Email Address") { 
		alert(""+ str_msg_email_search +""); 
		fn.txtEmail.focus();
		return false; 
	}
	else if(!IsEmail(fn.txtEmail.value)) {
		alert(""+ str_msg_an_email_input +"");
		fn.txtEmail.focus();
		return false;
	}
	else if (fn.txtPassword.value == "") { 
		alert(""+ str_msg_password_input +""); 
		fn.txtPassword.focus();
		return false; 
	}
	else {
		fn.action="/common/include/login_check_proc.php";
		//fn.submit();
	}
}


// ?? ?? ???? ??(??)
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;

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

	if(OpBrWin){
		OpBrWin.focus();
	}
	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 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_minihompy(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 friend_edit(login_id, friend_id) {
	var str_mh_name = "";
	OpenNameUIPublic('WinBuddyInvite','?buddy=modify&login_id=' + login_id + '&mh_id=' + friend_id + '&mh_name=' + str_mh_name + '');
}
function message_send(login_id, friend_id, friend_name) {
	OpenNameUIPublic('WinMemoSend','?login_id=' + login_id + '&send_cyid=' + friend_id + '&hidSendName=' + friend_name + '');
}
function friend_remove(login_id, friend_id) {
	var str_mh_name = "";
	var str_return_path = "";
	OpenNameUIPublic('WinBuddyInvite','?buddy=remove&login_id=' + login_id + '&mh_name=' + str_mh_name + '&mh_id=' + friend_id + '&hidReturnURL=' + str_return_path + '');
}

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 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
		if ( restrictAccessCheck() == false ) {
			return;
		}
		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 = "Normal";
	var strProperty = "";
	WinOpen(strUrl,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty);
}


//??? ? ???(??)
function OpenPublic(fn, strName, strGetData){
	//???? > ??? ?? ?? ???
	if(strName == "WinEmailCkeck"){
		if(fn.txtEmail.value == "") { alert("??? ??? ?????."); fn.txtEmail.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"){
//		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 == "WinUrlCheckSuggest"){
		//alert(strName);
//		if(fn.txtID.value == "") { alert("" + str_msg_id_input + ""); fn.txtID.focus(); return; }
		var strUrl = "/main/member_idcheck_inline_suggest.php" + strGetData;
		var WinWidth = "0";
		var WinHeight = "0";
		//alert(strUrl);
	}
	//???? > ?? ?? ???
	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";

		var browserVer = navigator.userAgent;
		if ( browserVer.indexOf("MSIE") > 0 ) {
			var ScrollBar = "no";
		} else {
			var ScrollBar = "yes";
		}			
		//var ScrollBar = "yes";
		var Resize = "yes";
		var WinGubun = "";
		var strProperty = "";
		Online = WinOpen(strUrl,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty);
		Online.focus(); 
		return;		
		
		
	}
	//?? ??? > ??/?? > ???? ?? ???
	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 == "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";
	}
	
	else if(strName == "WinReply"){
		var strUrl = "/main/memo_writeC_Wview.php" + strGetData;
		var WinWidth = "438";
		var WinHeight = "475";
	}


	else if(strName == "WinOnline"){
		var strUrl = "/main/neighbor_on_C_view.php" + strGetData;
		var WinWidth = "360";
		var WinHeight = "310";
		
		var ScrollBar = "yes";
		var Resize = "no";
		var WinGubun = "";
		var strProperty = "";
		Online = WinOpen(strUrl,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty);
		Online.focus(); 
		//Online.location.replace(strUrl);
		return;
	}
	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){
	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.opener || top.opener.closed)
			{
				if (!top.Top_Window || top.Top_Window.closed)
				{
					top.Top_Window = top.window.open('', 'CyWorld_GSP');
				}
				win = top.Top_Window;
			}
			else
			{
				win = top.opener;
			}
			
			if(win.top.frames["GSP_BASE_MAIN"]){
				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;

		default:
			document.location.href = url;
		break;		
	}
}

/* ???? ? ?? (????)
??	:	???? ?? ??
??	:	open_minihompy(MH_ID, LOGIN_ID, redirect_url);
??	:	???
??	:	MH_ID <- ???? , LOGIN_ID <- ???? ????  
*/
function open_minihompy(mh_id, login_id, redirect_url){
	var domain = "http://us.cyworld.com";
	var strUrl = domain + "/ps/ps_gate.php?mh_id=" + mh_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 = "";
	
	
		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);
		}
		MyHompy_GSP.focus(); 
		MyHompy_GSP.location.replace(strUrl);
}

function switch_minihome(mh_id, login_id,redirect_url){
	var domain = "http://us.cyworld.com";
	
	var strUrl = domain + "/ps/ps_index.php?mh_id=" + mh_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 = "";
	
	
		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);
		}
		MyHompy_GSP.focus(); 
		MyHompy_GSP.location.replace(strUrl);
}

/* ?? 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 = "";
	// previous empty field checks removed
		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.constellation_type.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){
	return s.replace(/(^\s*)|(\s*$)/g, "");
}

// 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" : "");

}

/* Cookies */

function getUniCookie(name) {
  	var arg = name + "=";
  	var alen = arg.length;
  	var clen = document.cookie.length;
  	var i = 0;
  	while (i < clen) {
    	var j = i + alen;
    	if (document.cookie.substring(i, j) == arg)
     		return getUniCookieVal (j);
    		i = document.cookie.indexOf(" ", i) + 1;
    		if (i == 0) break; 
  		}
 	 return 0;
}

function getUniCookieVal(offset) {
	var endstr = document.cookie.indexOf (";", offset);
  	if (endstr == -1) {
    	endstr = document.cookie.length;
	}
  	return unescape(document.cookie.substring(offset, endstr));
}

function getUniCookieVar(strCookieName, arg) {
	var cookievalue = getUniCookie(strCookieName)
	if (cookievalue == 0) {
		cookieString = ""
	}
	else {
		cookieString = cookievalue;
	}
	if (cookieString.indexOf(arg) != -1) {
		var x = cookieString.indexOf(arg)
		var y = cookieString.indexOf("&", x)
		if (y == -1) {
			y = cookieString.length
		}
		var stringVariables = cookieString.substring(x,y)
		var x = (stringVariables.indexOf("=") + 1)
		var y = stringVariables.length
		var stringVariables = stringVariables.substring(x,y)
		stringVariables = unescape(stringVariables)
	}
	else {
		var stringVariables = ""
	}
	return stringVariables
}

function cookie_object(strCookieName, strCookieValue, strCookieDate, strCookiePath, strCookieDomain, IsCookieSecure) {
	this.strCookieName = strCookieName
	this.strCookieValue = strCookieValue
	this.strCookieDate = strCookieDate 
	this.strCookiePath = strCookiePath
	this.strCookieDomain = strCookieDomain
	this.IsCookieSecure = IsCookieSecure
}

function setUniCookieVar(strCookieName,strCookieVariable,strCookieVariableValue,intCookieExpiration) {
	var IsEndOfString = false
	var IsPersistCookie = false
	var IsSessionCookie = false
	var arrCookieStringPart = new Array()
	arrCookieStringPart[0] = ""
	arrCookieStringPart[1] = ""
	strCookieVariableValue = escape(strCookieVariableValue)
	
	if (intCookieExpiration != null) {
		var datExpiresDate = intCookieExpiration;
	}
	else {
		var datNextFiveYearDate = new Date();
		var datExpiresDate = new Date();
		datNextFiveYearDate.setFullYear(datNextFiveYearDate.getFullYear() + 5);
		var datExpiresDate = datNextFiveYearDate;
	}
	var strHostName = location.hostname;
	var strCookieDomain = strHostName;
	if (strHostName.indexOf(".")) {
		var arrayHostName = strHostName.split(".");
		arrayHostName.reverse();
		if ((arrayHostName.length == 4) && (arrayHostName[0] != "com")) {
			var strCookieDomain = strHostName;
		}
		else if ((arrayHostName.length > 1) && (arrayHostName[0] == "com")) {
			var strCookieDomain = "." + arrayHostName[2] + "." + arrayHostName[1] + "." + arrayHostName[0];
		}
		else if (arrayHostName.length == 1) {
			var strCookieDomain = "." + arrayHostName[1] + "." + arrayHostName[0];
		}
	}
	
	var objPersistCookie = new cookie_object(null,null,datExpiresDate,"/",strCookieDomain,false)
	
	var objSessionCookie = new cookie_object(null,null,null,"/",strCookieDomain,false)
	var strObjCookie = ""
	
	if ((strCookieName.toLowerCase()).indexOf("persist") != -1) {
		IsPersistCookie = true;
		strObjCookie = "objPersistCookie";
	}
	else if ((strCookieName.toLowerCase()).indexOf("session") != -1) {
		IsSessionCookie = true;
		strObjCookie = "objSessionCookie";
	}
	else {
		IsSessionCookie = true;
		strObjCookie = "objSessionCookie";	
	}
	
	strCookieValue = getUniCookie(strCookieName);
	if (strCookieValue == 0) {
		strCookieValue = strCookieVariable + "=" + strCookieVariableValue
		setUniCookie(strCookieName,strCookieValue,(eval((strObjCookie) + ".strCookieDate")),(eval((strObjCookie) + ".strCookiePath")),(eval((strObjCookie) + ".strCookieDomain")),(eval((strObjCookie) + ".IsCookieSecure")));
	}
	else {
		if (strCookieValue.indexOf(strCookieVariable) != -1) {
			var x = strCookieValue.indexOf(strCookieVariable)
			var y = strCookieValue.indexOf("&", x)
			if (y == -1) {
				y = strCookieValue.length
				IsEndOfString = true
			}
			else {
				arrCookieStringPart[1] = strCookieValue.substring(y,strCookieValue.length)
			}
			arrCookieStringPart[0] = strCookieValue.substring(0,x)
			var strCurrentVariableValuePair = strCookieValue.substring(x,y)
			var x = (strCurrentVariableValuePair.indexOf("=") + 1)
			var y = strCurrentVariableValuePair.length
			var strCurrentVariableValue = strCurrentVariableValuePair.substring(x,y)
			strCompleteCookieValue = arrCookieStringPart[0] + strCookieVariable + "=" + strCookieVariableValue + arrCookieStringPart[1]
			strCookieValue = strCompleteCookieValue
			setUniCookie(strCookieName,strCookieValue,(eval((strObjCookie) + ".strCookieDate")),(eval((strObjCookie) + ".strCookiePath")),(eval((strObjCookie) + ".strCookieDomain")),(eval((strObjCookie) + ".IsCookieSecure")));
			
		}
		else {
			if (strCookieValue.indexOf("=") != -1) {
				strCookieValue = strCookieValue + "&" + strCookieVariable + "=" + strCookieVariableValue
			}
			else {
				strCookieValue = strCookieVariable + "=" + strCookieVariableValue
			}
			setUniCookie(strCookieName,strCookieValue,(eval((strObjCookie) + ".strCookieDate")),(eval((strObjCookie) + ".strCookiePath")),(eval((strObjCookie) + ".strCookieDomain")),(eval((strObjCookie) + ".IsCookieSecure")));
		}	
	}
	return true
}

function setUniCookie (name,value,expires,path,domain,secure) {
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; 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, "/", ".us.cyworld.com", 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 == "block") {
		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;
	var searchObj;	// required for fixing a bug

	switch(lang){
		//case 'HAN':
		//	regex_pattern = /[\u3000-\u303f]|[\u1100-\u11ff]|[\u3130-\u318f]|[\uac00-\ud7a3]/g;
		//	break;
		default:
			regex_pattern = /[\u0400-\u1FFFF]|[\u2f00-\uffff]/g;
			searchObj = obj.replace(/F/g, "f");
			break;
	}

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

}

function filterCharacter(level,obj) {

		var str_name = trim(obj);

		switch (level) {
			// allow letter and number only
			case 0:
				var exp = /[\W\s]/g;
				break;
			
			// allow letter, number and basic punct
			case 1:
				var exp = /[^\s\w\?\*\+\.\|\{\}\\\[\]\(\)\-!@#\$&_=;',:<>~]/g;
				break;
				
			// allow letter and number and spaces only
			case 2:
				var exp = /[^\w\s]/g;
				break;
		}
		
		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 ="club name";
    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.asp?etc='+str_national+'&chk='+str_chk,'CyWorld_GSP','');
	window.open ('http://www.cyworld.com/global_locale.asp?etc='+str_national+'&chk='+str_chk,'CyWorld_GSP','');
	//eval(v).window.location.replace('http://www.cyworld.com/global_locale.asp?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.XMLHttpRequest){
		    (isJSDebugEnabled()? alert("XMLHttpRequest"):"");
		    return new XMLHttpRequest();
            //Win Mac Linux m1,f1,o8 Mac s1 Linux k3�?ö© IE7
		} else if(window.ActiveXObject){
		    //Win e4,e5,e6�?ö©
			 try {
				(isJSDebugEnabled()? alert("Msxml2.XMLHTTP"):"");
			     return new ActiveXObject("Msxml2.XMLHTTP") ;
				
			} catch (e) {
				try {
					(isJSDebugEnabled()? alert("Microsoft.XMLHTTP"):"");
				    return new ActiveXObject("Microsoft.XMLHTTP") ;
					
				} catch (e2) {
				    (isJSDebugEnabled()? alert("null 1"):"");
					return null ;
	 			}
	 		}
		} else {
		    (isJSDebugEnabled()? alert("null 2"):"");
			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://us.cyworld.com/main/aboutus/terms_popup.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 popUp_PrivacyPolicy(URLStr, left, top, width, height) {
  URLStr = "http://us.cyworld.com/main/aboutus/privacy_popup.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 popUp_AboutUs(URLStr, left, top, width, height) {
  URLStr = "http://us.cyworld.com/main/aboutus/aboutus_popup.php";
  left=20;
  top=20;
  width =590;
  height=500;
	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 popUp_ContactUs(URLStr, left, top, width, height) {
  URLStr = "http://us.cyworld.com/main/aboutus/contact_popup.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 popUp_SafetyGuidelines(URLStr, left, top, width, height) {
  URLStr = "http://us.cyworld.com/main/aboutus/safety_popup.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 popUp_TermsOfTalk(URLStr, left, top, width, height) {
  URLStr = "http://us.cyworld.com/main/aboutus/talk_guideLine.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=500,left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}
function goto_club(clubid,window_mode){
	if(window_mode == 1){
		window.top.location.href='http://us.cyworld.com/club/clubmain.php?clubid='+clubid;
	}else{
		document.frm_gotoclub.action ='http://us.cyworld.com/club/clubmain.php?clubid='+clubid;
		document.frm_gotoclub.target = "_blank";
		document.frm_gotoclub.submit();
	}
}

// some compatibility functions
/* commented out on 2007-12-03
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 () {
	   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 + ">";
	});
}
*/

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');
				
}

function isJSDebugEnabled() {
    if (getCookie("jsDebug") == "true") return true;
    return false;
}


//canbe called by onkeyup="TextAreaMaxLength(this.id, 1000)"

function TextAreaMaxLength(field, maxlen){
	if(maxlen >0)
		MaxLength=maxlen;
	else
		MaxLength=1000;
	
	if (document.getElementById(field).value.length > MaxLength) // if too long...trim it!		
		document.getElementById(field).value= document.getElementById(field).value.substring(0, MaxLength);
}


//Check the length of textarea of web editor

function TextAreaMaxLength_Editor(maxLen){
	var oEditor = FCKeditorAPI.GetInstance('content');
	if (document.all) 
		var HTMLlength=oEditor.EditorDocument.body.innerText.length;//IE
	else
		{
			//var html = oEditor.EditorDocument.body.ownerDocument.createRange();
			var html = oEditor.EditorDocument.body.createRange();
			html.selectNodeContents(oEditor.EditorDocument.body);
			var contentStr = html.toString();
			var HTMLlength=contentStr.length;
		}//fireFox
	
	if (HTMLlength >maxLen){
		alert("Maximum characters for Text Area is " +maxLen );
		//oEditor.EditorDocument.body.focus();
		return false;
	}  	
	return true;
}	

// validation pop up window
function isRestrictAccess() {
	return false;
	/*
	var valPopup = getUniCookieVar("omniSession","valpopup");
	if ( valPopup == 'T' ) {
		return true;
	} else {
		return false;
	}
	*/
}

function restrictAccessCheck() {
	restrict = isRestrictAccess();
	if ( restrict ) {
		//showShader('QS_step1');
		//showQuickValidate();
		return true;
	} else {
		return true;
	}
}

function quickLogin() {
		showQuickLogin();
		window.frmQuickLogin.txtEmail.focus();
		return false;
}

function setTextReadonly(me) {
	restrict = isRestrictAccess();
	if ( restrict ) {
		me.readOnly = true;
	} else {
		me.readOnly = false;
	}
}

// Shader in OOP
function Shader () {
	
	this.shd = new Object();
	this.con = new Object();
	this.shim = new Object();

	this.findPos = function(obj) {
		var curleft = curtop = 0;
		if (obj.offsetParent) {
			curleft = obj.offsetLeft
			curtop = obj.offsetTop
			while (obj = obj.offsetParent) {
				curleft += obj.offsetLeft
				curtop += obj.offsetTop
			}
		}
		return [curleft,curtop];
	}
	
	this.showShd = function() {
		// Div 'content' is the container	
		var conDiv = document.getElementById('content');
		try {
			var conDivPos = shader.findPos(conDiv);
			shader.shd.style.left = conDivPos[0];
			shader.shd.style.Top = conDivPos[1];
			shader.shd.style.width = conDiv.offsetWidth;
			shader.shd.style.height = conDiv.offsetHeight;
		} catch(e){}
		shader.shd.style.top = "0";
		shader.shd.style.display = "block";
	}

	this.closeShd = function() {
		shader.shd.style.top = "-100px";
		shader.shd.style.display = "none";
	}

	this.showCon = function() {
	
		var _winwidth;
		var _winheight;
		var _conwidth = shader.con.style.width;
		var _conheight = shader.con.style.height;
		
		if (window.innerWidth) {
			_winwidth = window.innerWidth;
		} else if (document.documentElement && document.documentElement.clientWidth) {
			_winwidth = document.documentElement.clientWidth;
		} else if (document.body) {
			_winwidth = document.body.clientWidth;
		}
		
		if (window.innerHeight) {
			_winheight = window.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) {
			_winheight = document.documentElement.clientHeight;
		} else if (document.body) {
			_winheight = document.body.clientHeight;
		}

		shader.con.style.display = "block";
		shader.con.style.left = (_winwidth - shader.con.offsetWidth) / 2;
		shader.con.style.top = (_winheight - shader.con.offsetHeight) / 3;
	}
	
	this.closeCon = function() {
		shader.con.style.display = "none";
	}
	
	this.showShim = function() {
		shader.shim.style.display = "block";
		try {
			var conDivPos = shader.findPos(shader.con);
			shader.shim.style.left = conDivPos[0];
			shader.shim.style.top = conDivPos[1];
			shader.shim.style.width = shader.con.offsetWidth;
			shader.shim.style.height = shader.con.offsetHeight;
		} catch(e){}
	}
	
	this.closeShim = function() {
		shader.shim.style.display = "none";
	}
	
	this.open = function(shdId,conId,shimId) {
		shader.shd = document.getElementById(shdId);
		shader.con = document.getElementById(conId);
		if(shimId) shader.shim = document.getElementById(shimId);
		shader.showShd();
		shader.showCon();
		if(shimId) shader.showShim();
	}
	
	this.close = function(shdId,conId,shimId) {
		shader.shd = document.getElementById(shdId);
		shader.con = document.getElementById(conId);
		if(shimId) shader.shim = document.getElementById(shimId);
		if(shimId) shader.closeShim();
		shader.closeCon();
		shader.closeShd();
	}
}

function addField(formElement, fieldType, fieldName, fieldValue, classValue, onclickValue, onblurValue) {
	var inputElement = document.createElement("input")
	inputElement.setAttributeNode(createHtmlAttribute("type", fieldType))
	inputElement.setAttributeNode(createHtmlAttribute("name", fieldName))
	inputElement.setAttributeNode(createHtmlAttribute("value", fieldValue))
	inputElement.setAttributeNode(createHtmlAttribute("class", classValue))
	inputElement.setAttributeNode(createHtmlAttribute("onclick", onclickValue))
	inputElement.setAttributeNode(createHtmlAttribute("onblur", onblurValue))
	formElement.appendChild(inputElement)
	return
}

function getField (form, fieldName) {
	if (!document.all)
		return form[fieldName];
	else
		for (var e = 0; e < form.elements.length; e++)
			if (form.elements[e].name == fieldName)
			return form.elements[e];
	return null;
}
     
function removeField (form, fieldName) {
	var field = getField (form, fieldName);
	if (field && !field.length)
		field.parentNode.removeChild(field);
}

function startRegProcess() {
	if(top.window.name == "MyHompy_GSP" || top.window.name=="YourHompy_GSP"){

		if (top.opener && top.opener.frmInviteProcess){
			top.opener.frmInviteProcess.submit();
			top.opener.focus();
		} 
	} else {
	document.frmInviteProcess.submit();
	}
}

function quickStartNextProcess(n) {
	fn = document.frmQuickStartNextProcess;
	
	switch(n) {
		case 1:
			fn.action = "/main/quickstart_validate.php";
			break;
		case 2:
			fn.action = "/main/quickstart_profile.php";
			break;
		case 3:
			fn.action = "/main/quickstart_connect.php";
			break;	
	}

	fn.submit();
}


// plaza publish - 2007.04.05
function submitPlazaSend() {
	if ( validatePlazaSend() ) {
		document.frmPlaza.submit();
	}
}

function validatePlazaSend() {
	fn = document.frmPlaza;

	try {

		if ( fn.highcategory.selectedIndex == 0 ) {
			alert("Please select the category");
			fn.highcategory.focus();
			return false;
		}

		tags = trim(fn.tags.value);

		if ( tags.length == 0  ) {
			alert('Please enter at least one tag.');
			fn.tags.focus();
			return false;	
		}
			
		if(wordFilter(tags, 'T')){
			fn.title.focus();
			return false;
		}
			
		if(FilterPattern('HAN',tags)){
			fn.title.focus();
			return false;
		}
		
		fn.action = "ps_plaza_publish_proc.php";
		
		if ( fn.menuid.value == 15 ) {
			alert("Thanks! We'll keep in touch by Message to let you know the status of your video. In the meantime, your video has been posted to your Profile.");
		} else {
			alert("Thanks for submitting your photo to the Plaza.");
		}
		return true;
		
	} catch(e) {return false;}
	
	return false;
}

// video publish 
function validateVideoUpload() {

	fn = document.frmVideo;

	try {

		title = trim(fn.title.value);
		//author = trim(fn.author.value);
		content = trim(fn.content.value);

		if ( title.length == 0  ) {
			alert('Please enter a title.');
			fn.title.focus();
			return false;
		/*
		} else if ( author.length == 0 ) {
			alert('Please enter an author.');
			fn.author.focus();
			return false;
		*/
		} else if ( content.length == 0 ) {
			alert('Please enter a description.');
			fn.content.focus();
			return false;	
		}
			
		if(wordFilter(title, 'T')){
			fn.title.focus();
			return false;
		}
		/*
		if(wordFilter(author, 'T')){
			fn.author.focus();
			return false;
		}
		*/
		if(wordFilter(content, 'B')){
			fn.content.focus();
			return false;
		}
			
		if(FilterPattern('HAN',title)){
			fn.title.focus();
			return false;
		}
		/*
		if(FilterPattern('HAN',author)){
			fn.author.focus();
			return false;
		}
		*/
		if(FilterPattern('HAN',content)){
			fn.content.focus();
			return false;
		}

		
		// enable all checkbox
		fn.scrap_yn.checked = true;


		if ( fn.folderid.selectedIndex == 0 ) {
			alert("Please select the folder");
			fn.folderid.focus();
			return false;
		}
		
		fn.action = "ps_video_publish_proc.php";
		return true;
		
	} catch(e) {return false;}
	
	return false;
}

function submitVideoUpload() {

	if ( validateVideoUpload() ) {
		document.frmVideo.submit();
	}
}

function validateSendToPlaza(menuid, anchorid, url, width, height) {

	plaza_yn = document.getElementById('plaza_yn'+anchorid).value;
	
	if ( plaza_yn == "N" ) {
		openMHPopup2(url, width, height);
	} else {
		if ( menuid == 11 ) 
			alert(str_msg_plaza_photo_already_posted);
		else 
			alert(str_msg_plaza_video_already_posted);
	}

}

function launchPopup (url,windowname,width,height,top,left) {
	
	windowname = (windowname)?windowname:"cypopup";
	w=(width)?width:"398";
	h=(height)?height:"260";
	x=(top)?top:"100";
	y=(left)?left:"100";

	OpenWin = window.open(''+url+'',''+windowname+'','left='+x+', top='+y+', width='+w+', height='+h+''); 
	
}

// toggle Layer
function toggleLayer(id) {
 try {
 var obj = document.getElementById(id);
 obj.style.display = (obj.style.display == "none") ? "block" : "none";
 } catch (e) {

 }
 return true;
}
function showLayer(id) {
 document.getElementById(id).style.display = "block";
 return true;
}
function hideLayer(id) {
 document.getElementById(id).style.display = "none";
 return true;
}


function share_this (loggedin,params,imgsrc,mediatype) {
			if (loggedin == 1) {
				if ( restrictAccessCheck()==true) {
					strUrl = "/main/share_this.php?" + params + "&imgsrc=" + imgsrc + "&mediatype=" + mediatype;
					WinWidth = 615 //1024; 
					WinHeight = 520;
					
					strName = "ShareThis";
					ScrollBar = "yes";
					Resize = "no";
					WinGubun = "Normal";
					strProperty = "";
					WinOpen(strUrl,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty);
				}
				else {
					return;
				}
			}
			else {
				quickLogin();
			}

}

function share_code (params,url,mediatype) {

		strUrl = "/main/share_code.php?" + params +"&url=" + url + "&mediatype=" + mediatype;
		WinWidth = 350;
		WinHeight = 200;

		strName = "ShareCode";
		ScrollBar = "no";
		Resize = "no";
		WinGubun = "Normal";
		strProperty = "";
		WinOpen(strUrl,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty);		
}


function button_over(obj, img){
    obj.src = img;
    obj.style.cursor = "pointer"
}
    
function button_out(obj, img){
 obj.src = img;
}  

function showVideoStudio() {
		launchPopup("http://upload1.us.cyworld.com/upload","VideoStudio",840,670);
}
	
function resizeIfr(obj, minHeight) {
	minHeight = minHeight || 10;
	try {
		var getHeightByElement = function(body) {
			var last = body.lastChild;
			try {
				while (last && last.nodeType != 1 || !last.offsetTop) last = last.previousSibling;
				return last.offsetTop+last.offsetHeight;
			} catch(e) {
				return 0;
			}

		}

		var doc = obj.contentDocument || obj.contentWindow.document;
		if (doc.location.href == 'about:blank') {
			obj.style.height = minHeight+'px';
			return;
		}

		//var h = Math.max(doc.body.scrollHeight,getHeightByElement(doc.body));
		//var h = doc.body.scrollHeight;
		if (/MSIE/.test(navigator.userAgent)) {
			var h = doc.body.scrollHeight;
		} else {
			var s = doc.body.appendChild(document.createElement('DIV'))
			s.style.clear = 'both';
			var h = s.offsetTop;
			s.parentNode.removeChild(s);
		}

		//if (/MSIE/.test(navigator.userAgent)) h += doc.body.offsetHeight - doc.body.clientHeight;
		if (h < minHeight) h = minHeight;

		obj.style.height = h + 'px';
		if (typeof resizeIfr.check == 'undefined') resizeIfr.check = 0;
		if (typeof obj._check == 'undefined') obj._check = 0;
		//  if (obj._check < 5) {
		//   obj._check++;
		setTimeout(function(){ resizeIfr(obj,minHeight) }, 200); // check 5 times for IE bug
		//  } else {
		//obj._check = 0;
		//  }
	} catch (e) {
		//alert(e);
	}

}

function checkChatStatus(login_id, cyid, buddy_name){
	// popup
	strUrl = "/chat/pop_chat_status.php?fcyid=" + cyid + "&fname=" +encodeURIComponent(buddy_name);
	strName = "chat_"+cyid+"_"+login_id;
	WinWidth = 300;
	WinHeight = 280;
	//WinHeight = 667; // debug
	ScrollBar = "no";
	Resize = "no";
	WinGubun = "Center";
	strProperty = "status=yes,toolbar=no,menubar=no,location=no";
	WinOpen(strUrl,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty);
	
}

var direct_url = function(cyid, type, extra) {
	if(cyid) {
		$jq.ajax({
			type: "GET",
			url: "/profile/direct_url.php",
			cache: false,
			data: "cyid=" + cyid,
			success: function(domain){		
				rel_url = (extra) ? domain + extra : domain;
				
				if(type == 'opener') {
					window.opener.location="http://us.cyworld.com/"+rel_url;
				}
				else if (type == 'topopener') {
					top.window.opener.location.href="http://us.cyworld.com/"+rel_url;
				}
				else {
					location.href="http://us.cyworld.com/"+rel_url;
				}			
			}
		});
	}
}

// double clicking feed delete button causes an errror, so keep 
// track of what's been clicked so we can limit to one
var feed_items_deleted = new Array();

function delFeed(feedid, viewall) {
	if (feed_items_deleted['fid_' + feedid]) {
		return false;
	}
	feed_items_deleted['fid_' + feedid] = true;
	$jq.ajax({
		type: "POST",
		url:  "/profile/feed/delete_event.php", 
		data: "feedid=" + feedid + "&viewall=" + viewall,
		cache: false,
		async: false,
		success: function(body, status) {
			document.getElementById('cyfeed').innerHTML = body;
		},
		error: function() {}
	});
}


function profileStickyNote() {

	this.text = '<div class="border">Skin Designed by: <a href="http://us.cyworld.com/DOMAIN">DOMAIN</a></div>';
	
	this.display = function(domain) {
		var stickynote = document.getElementById('stickynote') || document.createElement('div');
		stickynote.id = 'stickynote';
		if (!document.getElementById('stickynote')) {
			$jq('body').append(stickynote);
		}
		
		if ( domain != "" && domain != undefined ) {
			displayText = this.text.replace(/DOMAIN/g, domain);
			stickynote.style.display = 'inline';
			stickynote.innerHTML = displayText;
		} else {
			stickynote.style.display = 'none';
		}
	}
	
	this.remove = function() {
		var stickynote = document.getElementById('stickynote'); 
		if ( stickynote ) {
			document.getElementById('stickynote').style.display = 'none';
		}
	}
	
} 

function archivelist(id, mh_id, page_user_name, year, month) {	
	if(document.getElementById(id).style.display == 'block') {
		document.getElementById(id).style.display = 'none';
	}
	else {
	$jq.ajax({
		type: "POST",
		url:  "/profile/blog/archive_list.php", 
		data: "mh_id=" + mh_id + "&page_user_name=" + page_user_name + "&year=" + year + "&month=" + month,
		cache: false,
		async: false,
		success: function(body, status) {
			document.getElementById(id).innerHTML = body;
			document.getElementById(id).style.display = "block";
		},
		error: function() {}
	});
	}
}
