/**
* @ GSP Javascript
* @ athor : Joung-Won, Lee
* @ createdate		: 2005-03-18
* @ changehistory	: 2005-03-18
**/

//------------------------------------------------
// ??? ?? ??
//------------------------------------------------
//common.js
var str_msg_select_member = "请选择一个成员.";
var str_msg_email_none = "请输入你的邮箱及密码.";
var str_msg_password_none = "密码错误.";
var str_msg_exit_member = "已退出会员，请咨询cyworld管理员.";
var str_msg_suspend_member = "被暂时禁止使用的会员，请咨询Cyworld管理员.";
var str_msg_warning_member = "您的帐户暂时无法使用。请咨询Cyworld管理员.";
var str_msg_delete = "确实要删除吗?";
var str_msg_delete_select = "选择您要删除的选项.";
var str_msg_email_input = "输入您的邮件地址.";
var str_msg_an_email_input = "输入一个邮件地址.";
var str_msg_password_length = "密码长度为4－16位.";
var str_msg_password_input = "输入密码.";
var str_msg_repassword_input = "输入确认密码.";
var str_msg_search_input = "请输入搜索内容.";
var str_msg_id_input = "输入您的迷你小窝地址.";
var str_msg_id_invalid_id = "无效的迷你小窝地址.";
var str_msg_none_concent = "请输入留言.";
var str_msg_none_txtSendName = "请选择收件人.";
var str_msg_cp_input = "输入您的手机号码.";
var str_msg_buddy_self = "您不能加自己为知己.";
var str_msg_buddy_end_self = "您不能和自己解除知己关系.";
var str_msg_memo_send_self = "您不能给自己发送留言.";
var str_msg_memo_send_ok = "发送小纸条?";
var str_msg_memo_end_self = "不能阻止自己给自己的留言.";
var str_msg_gift_send_self = "您不能给自己赠送礼物.";
var str_msg_buddy_friend_id_none = "没有该Cyworld用户.";
var str_msg_email_send_process_ok = "邮件已发送.";
var str_msg_user_name = "姓名为2-4个汉字,请查看您填写的内容是否正确.";//2005-08-02 adou
var str_msg_send_cut = " 收信人不能超过100人.";
var str_msg_memo_cut = "字数限制在400字以内.";
var msg_move_minihompy = "去迷你小窝?";
var str_login_msg="请登录后使用";
// MALL - by zmania

var str_msg_filling_completed = "红豆充值成功.";// ????
var str_msg_filling_fail = "红豆充值失败.";
var str_msg_appeal = "要求朋友付账吗?"; //???? ???????
var str_msg_select_friend = "选择知己.";
var str_msg_input_message = "输入留言.";
var str_msg_cymoney_spent = " 红豆不足.";
var str_msg_wishbox_cant_use_coupon = "您不能在希望箱里使用礼券.";
var str_msg_appeal_cant_use_coupon = "您的礼券不能使用.";
var str_msg_select_items = "选择物品.";
var str_msg_check_one = "必需选择列表.";
var str_apply_music_item = "音乐上传成功.";
var str_search_text_short = "您输入的关键词不能少于两个字.";
var str_gift_reject_confirm = "拒绝礼物?";
var str_item_id_is_null = "没有这个物品.";
var str_gift_later = " 以后赠送礼物? \r\n 请求信息将会保存30天";
var str_msg_no_quest = "没有朋友付账邀请";
var str_msg_no_gift = "没有收到的礼物)";
// main_only.js		- Writer : Joung-Won,Lee
var str_msg_none_name = "请输入您的姓名.";
var str_msg_none_miniid = "输入您的 Minihompy URL.";
var str_msg_save_box_move = "将留言保存在保管箱里";
var str_msg_save_box_move_select = "选择您想移动的留言.";
var str_msg_memo_send_select = "选择您想发送留言的知己.";
var str_msg_receive_select = "选择您不想接收留言的名单列表.";
var str_msg_my_nickname = "输入知己名称.";
var str_msg_other_nickname = "输入知己的昵称.";
var str_msg_memo_delete = "删除的留言将不会恢复.\n确实要删除吗?";
var str_msg_memo_save_move = "移动到我的保管箱吗?";
var str_msg_buddy_invite_ok = "接受邀请?";
var str_msg_buddy_invite_no = "拒绝邀请?";
var str_msg_buddy_invite_reserve = "以后决定?";
var str_msg_buddy_invite_search_cancel = "You can cancel the request only on your waiting list.";
var str_msg_buddy_invite_search_select = "选择您想取消等待的名单.";
var str_msg_buddy_invite_max = "您最多可以将30人加入到您的等待名单里.\n您是否想删除等待名单中最老的消息而加入新消息?";
var str_msg_buddy_management_group_name_input = "输入团体名称.";
var str_msg_buddy_management_group_member_select = "选择团体成员.";
var str_msg_buddy_management_group_name_change = "输入您想更改的团体名称.";
var str_msg_member_key = "验证码无效.";
var str_msg_not_eq_password = "密码错误";
var str_msg_reg_email = "邮件地址已注册.";
var str_msg_process_ok = "修改完毕.";
var str_msg_icon_warning = "无法加入图释.";
var str_msg_memo_blacklist_warning = "名字已列入黑名单.";
var str_msg_school_input = "输入学校名字.";
var str_msg_year_select = "请选择出生年度.";
var str_msg_month_select = "请选择出生年月.";
var str_msg_day_select = "请选择生日.";
var str_msg_birthday_select = "请选择出生年月日.";
var str_msg_address_select = "请选择住址的地方.";
var str_msg_friend_email_input = "输入电子邮件.";
var str_msg_reg_minihp = "Minihp domain already registered.";
var str_msg_other_error = "Other error! Contact web-master";


//ps_person_info.js
var str_msg_email_check_input = "请正确输入您的邮件地址";
var str_msg_email_check_reinput = "重复输入您的邮件地址";
var str_msg_email_double = "您不能用同样的地址更改邮件地址.\n请输入新的邮件地址";
var str_msg_password_reinput = "输入新密码.";
var str_msg_password_reinput_too = "输入新密码.";
var str_msg_password_double = "输入新的确认密码.";

//ps_profile_personal_info.php
var str_msg_authority = "不允许您访问.";
var str_msg_person_search_type = "关闭此功能，您将无法被其他人搜索到.";
var str_msg_random_move_type = "关闭此功能，您的迷你小窝将无法被其他人随机访问.";

// ps_only.js		- writer : Kim, Hyunsoo
var str_msg_no_mh_title = "输入minihompy的题目.";
var str_msg_no_folder_name = "输入目录名.";
var str_msg_no_menu_name = "输入菜单名.";

// ps ??? ?? by ???
var msg_item_appaly = "成功使用物品.";
var msg_item_appaly_confirm = "您想使用物品吗?";
var msg_item_disappaly_confirm = "您想取消使用物品吗?";
var msg_item_disappaly = "取消使用中的物品";
var str_msg_item_enable = "有效物品";
var str_msg_item_disable = "失效物品";
var str_msg_item_delete = "该物品已删除";

// PS ?? ??? - by ???
var str_msg_no_member = "请登录";
var str_msg_plz_login = "请您登录后执行此操作";
var str_msg_no_selected_del_post = "选择要删除的选项";
var str_msg_confirm_delete = "确实要删除吗?";
var str_msg_confirm_update = "确实要更新吗,这将覆盖原来的数据?";
var str_msg_bookmark_no_title = "请输入Mini Hompy的题目";
var str_msg_no_url = "请输入一个URL";
var str_msg_select_just_one = "请选择要修改的选项";
var str_msg_no_title = "请输入主题";
var str_msg_no_content = "留言不能为空!";
var str_msg_no_music_title = "请输入音乐名称";
var str_msg_no_artist = "请输入歌手名称";
var str_msg_no_img = "请上传图片";
var str_msg_no_comment = " 请输入评论!";
var str_msg_no_search_value = "请输入搜索内容";
var str_msg_diary_no_emoticon = "选择今天的情绪";
var str_msg_diary_no_weather = "选择今天的天气";
var str_msg_no_selected_move_post = "选择想移动的项目";
var str_msg_no_friends_note = "给您的知己留言!";
var str_msg_no_select_folder = "选择文件夹!";
var str_msg_no_cp = "请填写手机号码";
var str_msg_no_anniverdary = "纪念日为必填内容";
var str_msg_no_message = "请填写档案中要求必填的内容";
var str_msg_cant_upload = "不能上传";
var str_msg_over_file_size = "附件容量不能超过2MB";
var str_msg_public_view =  "设定为公开";
var str_msg_private_view =  "设定为非公开";
var str_msg_public_change =  "您确认要设定为公开吗？ ";
var str_msg_private_change =  "您确认要设定为非公开吗?";
var str_msg_img_none =  "选择上传图片";
var str_msg_no_authority = "不允许您阅读";
var str_msg_limit_tab_name = "每个标签名字最多包含6个字符";
var str_msg_limit_creating_tab = "只能生成7个标签.";
var str_msg_confirm_register_coverstory = "设置为封面故事?";

// PS ??? by ???
var str_msg_diary_no_title = "填写日记题目";
var str_msg_select_em_none = "选择今日情绪";
var str_msg_select_wea_none = "选择今日天气";

// PS ??? by zmania
var str_msg_submit_with_file = "请添加文件";

//PS by Lcs
var str_msg_no_folder = "请选择文件夹";
// PS by adou
var str_msg_at_least_one_folder = "至少需要一个文件夹!";
//All contents in the folder will be deleted.\nAre you sure to delete?
var str_msg_delete_folder_confirm = "该文件夹下所有内容都会被删除\n是否真的要删除？";
var str_msg_at_least_one_tab = "至少需要一个标签!";
//All contents in the tab will be deleted.\nAre you sure to delete?
var str_msg_delete_tab_confirm = "该标签下所有内容都会被删除\n是否真的要删除？";

var str_msg_bad_folder_name = "文件夹名称不能包含非法字符!";

// 2005-06-21 by bate
var str_msg_gift_CyMoney_is_zero = "您的礼卷不能用于支付礼品赠送，请选择红豆支付。";
// 2005-05-26 by adou
var FOUND_DENY_WORDS = "对不起，您输入的内容与网站要求不符。";
var CONFIRM_DENY_WORDS = "对不起，您输入的内容与网站要求不符，\n请复制（Ctrl+C）内容，粘贴（Ctrl+V）到弹出的确认页面进行确认。";

// ???(??)
var int_star_sign_cnt = 12;
var str_my_star_name = [];
str_my_star_name[1] = ["水瓶座","水瓶座"];
str_my_star_name[2] = ["双鱼座","双鱼座"];
str_my_star_name[3] = ["白羊座","白羊座"];
str_my_star_name[4] = ["金牛座","金牛座"];
str_my_star_name[5] = ["双子座","双子座"];
str_my_star_name[6] = ["巨蟹座","巨蟹座"];
str_my_star_name[7] = ["狮子座","狮子座"];
str_my_star_name[8] = ["处女座","处女座"];
str_my_star_name[9] = ["天枰座","天枰座"];
str_my_star_name[10] = ["天蝎座","天蝎座"];
str_my_star_name[11] = ["人马座","人马座"];
str_my_star_name[12] = ["摩羯座","摩羯座"];
str_my_star_name[13] = [" "," "];

var str_my_star_chk = [];
str_my_star_chk[1] = [120,218];
str_my_star_chk[2] = [219,320];
str_my_star_chk[3] = [321,419];
str_my_star_chk[4] = [420,520];
str_my_star_chk[5] = [521,621];
str_my_star_chk[6] = [622,722];
str_my_star_chk[7] = [723,822];
str_my_star_chk[8] = [823,923];
str_my_star_chk[9] = [924,1022];
str_my_star_chk[10] = [1023,1122];
str_my_star_chk[11] = [1123,1224];

var MyHompy_GSP;
var CyWorld_GSP;
var YourHompy_GSP;
var opener_chk;

if(!window.name){
	window.name = "GSP_BASE_MAIN";
	CyWorld_GSP = this.window;
}
else{
	if(window.name == "GSP_BASE_MAIN"){
		CyWorld_GSP = this.window;
	}
}

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++) { if(IsChecked == true) { ChkObj[i].checked = true; } else { ChkObj[i].checked = false; } } }
}

function ChkBoxALL()
{
	var IsChecked = document.all["ChkBoxAll"].checked;
	var ChkObj = document.all["ChkBox"];
	if(ChkObj){
		var ChkBoxCnt = ChkObj.length;
		if(!ChkBoxCnt) { if(IsChecked == true) { ChkObj.checked = true; } else { ChkObj.checked = false; } }
		else { for(var i=0; i < ChkBoxCnt; i++) { if(IsChecked == true) { ChkObj[i].checked = true; } else { ChkObj[i].checked = false; } } }
	}
}

function ChkStateCheck()
{
	var ChkObj = document.all["ChkBox"];
	if(ChkObj){
		var ChkBoxCnt = ChkObj.length;
		if(ChkBoxCnt) {
			for(var i=0; i < ChkBoxCnt; i++) { if(ChkObj[i].checked == true) { return true; } }
		}
		else{
			if(ChkObj.checked == true) { return true; }
			else{return false;}
		}
	}
}

function ChkSelValues(fn){
	var ChkValues = "";
	var ChkObj = document.all["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(){
	var fn = document.frmLogin;

	if (trim(fn.txtEmail.value) == "") { alert(""+ str_msg_email_input +""); fn.txtEmail.focus(); return false; }

	if(!IsEmail(fn.txtEmail.value)){alert("输入的Email格式不正确");fn.txtEmail.focus();return false;}
	if (fn.txtPassword.value == "") { alert(""+ str_msg_password_input +""); fn.txtPassword.focus(); return false; }
}
// ?? ?? ???? ??(??)
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 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 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(frmMy_buddy.my_buddy.selectedIndex);
	var mh_id = frmMy_buddy.my_buddy.options[frmMy_buddy.my_buddy.selectedIndex].value;
	if(mh_id){
		open_minihompy(mh_id, login_id);
	}
}
//???? ???(??)############## ???? ?? #############
function OpenPSHome(strName,strGetData){

}
//?? => ?? ??(??)
function LeftPersonSearchPro(strMode){
	var fn = document.frmLeftPersonSearch;

	fn.hidMode.value = strMode;

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

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

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

		if (strData == "name") { fn.action = "person_search.php?rdoSearchChoice="+strData+"&txtName=" + strSearchText; fn.submit(); }
		else if (strData == "email") { fn.action = "person_search.php?rdoSearchChoice="+strData+"&txtEmail=" + strSearchText; fn.submit(); }
		else if (strData == "cp") { fn.action = "person_search.php?rdoSearchChoice="+strData+"&txtCPAll=" + strSearchText; fn.submit(); }
	}
}
//?? UI ???(??)
function OpenNameUIPublic(strName, strGetData){
	//???? ?? ???
	if(strName == "WinBuddyMake"){
		var strUrl = "/common/include/buddy_invite_makeC_Wview.php" + strGetData;
		//		var strUrl = "/common/include/buddy_invite_requestedC_Wview.php" + strGetData;	// ?? ?? ??
		var WinWidth = "438";
		var WinHeight = "478";
	}
	//???? ?? > ??? ?? ?? ???
	else if(strName == "WinBuddyReceiver"){
		var strUrl = "/common/include/buddy_invite_receiverC_Mview.php" + strGetData;
		var WinWidth = "438";
		var WinHeight = "450";
	}
	//?? ???
	else if(strName == "WinMemoSend"){
		var strUrl = "/main/memo_writeC_Wview.php" + strGetData;
		var WinWidth = "388";
		var WinHeight = "550";
	}
	//?? ??? ???? ???
	else if(strName == "WinBuddyNameChange"){

		var strUrl = "/common/include/buddy_change_makeC_Wview.php" + strGetData;
		var WinWidth = "388";
		var WinHeight = "410";

	}
	else if(strName == "WinBuddyNameChange_re"){
		//alert(strGetData);
		//var strUrl = "/main/buddy_name_changeC_Wview.php" + strGetData;

		var strUrl = "/common/include/buddy_change_re_makeC_Wview.php" + strGetData;
		var WinWidth = "388";
		var WinHeight = "410";

	}

	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 == "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 = "348";
		var WinHeight = "512";
	}
	//?? ??? > ??/?? > ???? ?? ???
	else if(strName == "WinMemoAddReceiver"){
		var strUrl = "/main/memo_write_add_receiverC_Mview.php" + strGetData;
		var WinWidth = "438";
		var WinHeight = "475";
	}
	//?? ??? > ?? ??? ?? ?? ?? ???
	else if(strName == "WinBuddyInviteI"){
		var strUrl = "/main/buddy_invite_i_requestedC_view.php" + strGetData;
		var WinWidth = "388";
		var WinHeight = "410";
	}
	//?? ??? > ?? ??? ?? ?? ?? ???
	else if(strName == "WinBuddyInviteMe"){
		//		var strUrl = "/main/buddy_invite_me_requestedC_view.php" + strGetData;
		var strUrl = "/main/buddy_invite_me_requestedC_Wview.php" + strGetData;
		var WinWidth = "388";
		var WinHeight = "410";
	}
	//?? ??? > ??? ?? > ?? ?? ???
	else if(strName == "WinBuddyInviteReSearch"){
		var strUrl = "/main/buddy_invite_researchedC_Wview.php" + strGetData;
		var WinWidth = "438";
		var WinHeight = "440";
	}
	//???? > ???? > ???? ???
	else if(strName == "WinBuddyManMemo"){
		var strUrl = "/main/buddy_management_viewlist_memoC_view.php" + strGetData;
		var WinWidth = "388";
		var WinHeight = "380";
	}
	//???? > ???? > ? ?? ??? ???
	else if(strName == "WinBuddyManGroupMake"){
		var strUrl = "/main/buddy_management_group_makeC_Wview.php" + strGetData;
		var WinWidth = "438";
		var WinHeight = "440";
	}
	//???? > ???? > ?? ?? ?? ???
	else if(strName == "WinBuddyManGroupModify"){
		var strUrl = "/main/buddy_management_group_modifyC_Wview.php" + strGetData;
		var WinWidth = "438";
		var WinHeight = "440";
	}
	//???? > ???? > ?? ?? ???
	else if(strName == "WinBuddyManGroupDelete"){
		var strUrl = "/main/buddy_management_group_deleteC_view.php" + strGetData;
		var WinWidth = "438";
		var WinHeight = "440";
	}
	//?? ??? ??? ??
	else if(strName == "WinIndexMyHompy_GSP"){
		var strUrl = "/ps/ps_gate.php" + strGetData;
		var strUrlTmp = "about:blank";
		var strName = "MyHompy_GSP";
		var WinWidth = "932";
		var WinHeight = "572";
		var ScrollBar = "no";
		var Resize = "no";
		var WinGubun = "Center";
		var strProperty = "";
		MyHompy_GSP = WinOpen(strUrlTmp,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty);
		MyHompy_GSP.location.replace(strUrl);
		return;
	}
	//???? > ???? > ???? ?? ???
	else if(strName == "WinWaitView"){
		var strUrl = "/main/buddy_invite_waitingC_view.php" + strGetData;
		var WinWidth = "388";
		var WinHeight = "380";
	}
	//?? > ??? ????? ??? ?? ???
	else if(strName == "WinOutLook"){
		var strUrl = "/main/buddy_invite_outlookC_Wview.php" + strGetData;
		var WinWidth = "438";
		var WinHeight = "475";
	}

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

	WinOpen(strUrl,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty);
}
//???? > ??? ?? ??(???/ ????)
function 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){
		default:
		location.href = url;
		break;
		case("b"):
		var str_redirect_code;
		var str_redirect_code_old;
		if(!MyHompy_GSP || MyHompy_GSP.closed ){
			str_redirect_code = "<form name='frmRedirect' method='post' action=" + url + " target='_blank'></form>";
		}else{
			str_redirect_code = "<form name='frmRedirect' method='post' action=" + url + " target='GSP_BASE_MAIN'></form>";
		}		
		str_redirect_code_old = document.body.innerHTML;
		document.body.innerHTML = document.body.innerHTML + str_redirect_code;
		document.frmRedirect.submit();
		document.body.innerHTML = str_redirect_code_old;
		//alert("hohoho");
		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;

	}
}

/* ???? ? ?? (????)
??	:	???? ?? ??
??	:	open_minihompy(MH_ID, LOGIN_ID, redirect_url);
??	:	???
??	:	MH_ID <- ???? , LOGIN_ID <- ???? ????
*/
function open_minihompy(mh_id, login_id, redirect_url){
	var strUrl = "/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 = "572";//"564";
	var ScrollBar = "yes";
	var Resize = "no";
	var WinGubun = "";
	var strProperty = "";

	if(mh_id == login_id){
		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);
	}
	else{
		var strName = "YourHompy_GSP";
		if(!YourHompy_GSP || YourHompy_GSP.closed || top.window.name != "YourHompy_GSP"){
			YourHompy_GSP = WinOpen(strUrlTmp,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty);
		}
		YourHompy_GSP.focus();
		YourHompy_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);
	}
}

//新的fncStarSign BY YT
function fncStarSign(intMonth, intDay)
{
	var fn = document.frmMember;
	var intDateVal = 0;
	var strStarName = "";

	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[13][1]; intStarType = 13;
	}
	star_sign_text.innerHTML = strStarName;
	document.frmMember.hidConstellationType.value = intStarType;
}

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

//  ?? ??? ? ? ??? ????? by zmania
function access_fail_redirect(mode){

	if(mode == "ps"){
		top.window.ps_main.location = "./ps_home1_view.php";
	}
}

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

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

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

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

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

	intYear4 = intYear % 4;
	intYear100 = intYear % 100;
	intYear400 = intYear % 400;

	switch (parseInt(intMonth)){
		case 1:	intDayCnt = 31;	break;

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

function person_choose(){
	if(document.frmPersonSearch.SelPerson){
		var person_info = new Array();
		var recive_info;
		sel_ele = document.frmPersonSearch.SelPerson;
		sel_num = sel_ele.length;
		if(!sel_num){
			sel_num = 1;
			person_info = sel_ele.value.split("|");
			recive_info = sel_ele.value;

		}
		else{
			for(i = 0; i<sel_num; i++){
				if(sel_ele[i].checked == true){
					opener.document.frmGift.recive_info.value = sel_ele[i].value;
					person_info = sel_ele[i].value.split("|");
					recive_info = sel_ele[i].value;
					break;
				}
			}
		}
		opener.document.frmGift.recive_info_display.value = person_info[1];
		opener.document.frmGift.recive_info.value = recive_info;
		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))) }

//显示评论用自定义表情 2005-05-16 adou
function showPersonacon(persona_view_id) {
	var span_name = "persona"+persona_view_id;
	var open = document.getElementById(span_name).style.display;

	if(open == "none") {
		document.getElementById(span_name).style.display = '';
	}
	else {
		document.getElementById(span_name).style.display = 'none';
	}
}

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

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

		alert("最少" + minLength + "个字符");
		return false;
	}
}

function inputCheckCommon(element,maxLength,filter){
	var temp;
	var charcount;
	var reserve;
	var currentLenght = 0;
	var inputLength = element.value.length;
	if(filter=='B'||filter=='T'||filter=='U'){
		if (wordFilter(element.value,filter)){
			return false;
		}
	}
	for(k=0; k<inputLength; k++){
		temp = element.value.charAt(k);
		if(escape(temp).length > 4)
		currentLenght += 2;
		else
		currentLenght++;
	}
	if(currentLenght > maxLength){
		element.value = cutInputStr(element.value,maxLength);

		alert("最多" + 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 openSearchSchool(strData) {
	var strUrl = "/main/search/pop_school_search.php" + strData;
	var WinName = "WinSearchSchool";	
	var WinWidth = 450;
	var WinHeight = 378;

	WinOpen(strUrl,WinName,WinWidth,WinHeight);
}

function showPicture(src){
	var imgObj = new Image();
	imgObj.src = src;
	var wopt = "scrollbars=no,status=no,resizable=yes";
	wopt += ",width=" + imgObj.width;
	wopt += ",height=" + imgObj.height;
	var wbody = "<head><title>Cyworld</title>";
	wbody += "<script language='javascript'>";
	wbody += "function finalResize(){";
	wbody += "  var oBody=document.body;";
	wbody += "  var oImg=document.images[0];";
	wbody += "  var xdiff=oImg.width-oBody.clientWidth;";
	wbody += "  var ydiff=oImg.height-oBody.clientHeight;";
	wbody += "  window.resizeBy(xdiff,ydiff);";
	wbody += "}";
	wbody += "</"+"script>";
	wbody += "</head>";
	wbody += "<body onLoad='finalResize()' style='margin:0'>";
	wbody += "<a href='javascript:window.close()'><img src='" + src + "' border=0></a>";
	wbody += "</body>";
	winResult = window.open("about:blank","",wopt);
	winResult.document.open("text/html", "replace");
	winResult.document.write(wbody);
	winResult.document.close();
}

//显示flash
function showFlash(url,width,height){
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,65,0" width="'+width+'" height="'+height+'"  align="middle">');
document.write('<param name="allowScriptAccess" value="sameDomain" />');
document.write('<param name="movie" value="'+url+'" />');
document.write('<param name="quality" value="high" />');
document.write('<param name="wmode" value="transparent">');
document.write('<embed src="'+url+'" quality="high" width="'+width+'" height="'+height+'" align="middle" swLiveConnect="true" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
document.write('</object>');
}

/*
	获取图片缩略图地址
*/
function getThumbnailPath(imgPath){
	if(!imgPath){
		return "";
	}
	var arrImage = imgPath.split("/");
	if(arrImage.length){
		var fileName = arrImage[arrImage.length-1];
		var thumbName = "thumb-" + fileName;
		imgPath = imgPath.replace(fileName, thumbName);
		return imgPath;
	}else{
		return imgPath;
	}
}
