function isEmail(s)

{

  return s.search(/^\s*[\w\~\-\.]+\@[\w\~\-]+(\.[\w\~\-]+)+\s*$/g)>=0;

}

function Guild_KeyBoard_Character(Check_String)		

{		

	schar = new Array ('`','!','@','#','%','^','&','*','(',')','_','-','+','=','"',"'",'~','$','|','[',']',':','?','/','`', '{', '}',',','.');

	for (i=0; i<Check_String.length; i++)

	{

		for (j=0; j<schar.length; j++)		

		{

			

			if ( schar[j] == Check_String.charAt(i))

			{

				return true;

			}		

	    	}

	}	

}



function Special_Character_for_Intoroduce(Check_String)	// ?? ??? ???? ?? ??? '<' , '>' ?? ?? ???? ????

{

	schar= new Array('>',  '<');

	for (i=0; i<Check_String.length; i++)

	{

		for (j=0; j<schar.length; j++)

		{

			if (schar[j] == Check_String.charAt(i))

			{

		    		return true;

             		}

		}

	}

	return false;

}



function Get_Code_Value()		// Enter Key ?? ???? ????

{

	if (event.keyCode == 13 )

   	{ 

		event.returnValue=false;	

 	} 

}

function Korean_Character(Input_String)			// ÇÑ±Û ÀÔ·Â °Ë»ç

{

        for(i=0; i<=Input_String.length-1; i++)

        {

               if (((Input_String.charCodeAt(i) >= 4052) && (Input_String.charCodeAt(i) <= 4601)) || ((Input_String.charCodeAt(i) >= 12593) && (Input_String.charCodeAt(i) <= 12686)) || ((Input_String.charCodeAt(i) >= 44032) && (Input_String.charCodeAt(i) <= 55203)))

               {

                       return false;

               }

        }

}



function Get_String_Length(Check_String)		// ÀÔ·Â°ª ±æÀÌ ±¸ÇÏ±â

{

	var Check_String_Length = 0;	

	for ( i = 0 ; i < Check_String.length ; i++)

	{

		if ( (Check_String.charCodeAt(i) == 32) || (Check_String.charCodeAt(i) == 13) || (Check_String.charCodeAt(i) > 47 && Check_String.charCodeAt(i) < 58 ) || (Check_String.charCodeAt(i) > 31 && Check_String.charCodeAt(i) < 48 ))

		{			

			Check_String_Length += 1;

		}		

		else if ( ( Check_String.charCodeAt(i) > 64 && Check_String.charCodeAt(i) < 91 ) || ( Check_String.charCodeAt(i) > 96 && Check_String.charCodeAt(i) < 123 ) )

		{

			Check_String_Length += 1;		

		}		

		else 

		{			

			Check_String_Length += 2;		

		}

	}

	return Check_String_Length;

}



function Special_Character(Check_String)		// Æ¯º°È÷ ±ÝÁöµÈ ¸î°³ÀÇ Æ¯¼ö¹®ÀÚ

{

	schar= new Array(' ',' ','!','@','#','%','^','&','*','(',')','_','-','+','=','"',"'");

	for (i=0; i<Check_String.length; i++)

	{

		for (j=0; j<schar.length; j++)

		{

			if (schar[j] == Check_String.charAt(i))

			{

		    	return true;

			}

	    	}

	}

}



function Guild_Make_Check(Form_Name)

{

	var Submit_Count = 1;

	if ( Submit_Count > 1 )

	{

		alert(ProcessingCreateGuild);

		return false;

	}



	var Str_Guild_Name = Form_Name.Guild_Name.value;

	if ( Str_Guild_Name == "" )

	{

		alert(TypeGuildName);

		Form_Name.Guild_Name.focus();

		return false;

	}

	

	if ( Special_Character(Str_Guild_Name))

	{

		alert(GuildNameError);

		Form_Name.Guild_Name.value = "";

		Form_Name.Guild_Name.focus();

		return false;

	}



	if (Get_String_Length(Str_Guild_Name) > 8 )

	{

		alert(GuildNameLengthError);

		return false;

	}

			

	var Restricted_Word="gunbound,master,softnyx,?";

	var Restricted_Word_List=Restricted_Word.split(",");



	for (var i = 0 ; i < Restricted_Word_List.length ; i++)

    	{		   

		if ( Str_Guild_Name.toLowerCase().indexOf(Restricted_Word_List[i].toLowerCase()) != -1 )

		{

			alert(GuildNameError);				

			return false;

		}

    	}

	

	if( Form_Name.Introduce.value == "" )

	{

		alert(GuildIntroduceLengthError);

		Form_Name.Introduce.focus();

		return false;

	}

	

   	for(i=0;i<Form_Name.Introduce.value.length;i++) 				// ???? ??? ??? ???

   	{      		

	  	if ( (Korean_Character(Form_Name.Introduce.value.substring(i,i+1)) != false ) || (Guild_KeyBoard_Character(Form_Name.Introduce.value.substring(i,i+1)) == true ) || (Form_Name.Introduce.value.charCodeAt(i) == 10) || (Form_Name.Introduce.value.charCodeAt(i) == 32) || (Form_Name.Introduce.value.charCodeAt(i) == 13)  )

	   	{   	   		

		}

		else

		{ 

        		alert(GuildIntroduceCharacterError);

			Form_Name.Introduce.focus();

			return false;

		} 

	}  	

		

	if( Get_String_Length(Form_Name.Introduce.value) > 500)

	{

		alert(GuildIntroduceLengthError);

		Form_Name.Introduce.focus();

		return false;

	}

	

	if( Form_Name.Condition.value == "" )

	{

		alert(GuildRequirementLengthError);

		Form_Name.Condition.focus();

		return false;

	}

	

   	for(i=0;i<Form_Name.Condition.value.length;i++) 				// ???? ??? ??? ???

   	{      		

	  	if ( (Korean_Character(Form_Name.Condition.value.substring(i,i+1)) != false ) || (Guild_KeyBoard_Character(Form_Name.Condition.value.substring(i,i+1)) == true ) || (Form_Name.Condition.value.charCodeAt(i) == 10) || (Form_Name.Condition.value.charCodeAt(i) == 32) || (Form_Name.Condition.value.charCodeAt(i) == 13)  )

	   	{   	   		

		}

		else

		{ 

        		alert(GuildRequirementCharacterError);

			Form_Name.Condition.focus();

			return false;

		} 

	} 

			

	if( Get_String_Length(Form_Name.Condition.value) > 500)

	{

		alert(GuildRequirementLengthError);

		Form_Name.Introduce.focus();

		return false;

	}	

	

	if ( Special_Character_for_Intoroduce(Form_Name.Introduce.value) == true || Special_Character_for_Intoroduce(Form_Name.Condition.value) == true )

	{

		alert(YouCanNotUseSearchCharacterII);

		return false;

	}

	

	Submit_Count += 1;	

	return true;

}



function Eng_Change_Guild_Master(Form_Name)

{

	if ( Form_Name.Password.value == "" )

	{

		alert(TypeYourPassword);

		return false;

	}

	if ( Form_Name.E_Mail.value == "" )

	{

		alert(TypeYourEMail);

		return false;

	}	



	if (!isEmail(Form_Name.E_Mail.value))

	{

	      Form_Name.E_Mail.value="";

	      alert(TypeCollectEMailAddress); 

	      Form_Name.E_Mail.focus();

	      return false;		

	}



	var list=Form_Name.Next_Guild_Master.selectedIndex;

	var Search_String_Value=Form_Name.Next_Guild_Master.options[list].value;	



	if ( Search_String_Value == "" )

	{

		alert(SelectNextGuildMaster);

		return false;

	}

	var Change_MSG = confirm(ConfirmChangeGuildMaster);

	if(Change_MSG==true) 

	{

		return true;

	}

	else

	{

		return false;

	}

}

function Guild_Info_Update_Check(var_Guild_Name)

{	

	confirm(ConfirmRenameGuildName);

	if (confirm(ConfirmRenameGuildName) ==  true )

	{			

			return true;			

	}

				

}	



function Guild_Info(Form_Name)			// Guild_Make.asp ?? ???? ??? form submit ? ??

{

	var Submit_Count = 1;

	if ( Submit_Count > 1 )

	{

		alert(ProcessingCreateGuild);

		return false;

	}



	var Str_Guild_Name = Form_Name.Guild_Name.value;

	if ( Str_Guild_Name == "" )

	{

		alert(TypeGuildName);

		Form_Name.Guild_Name.focus();

		return false;

	}

	

	if ( Special_Character(Str_Guild_Name))

	{

		alert(GuildNameError);

		return false;

	}



	if (Get_String_Length(Str_Guild_Name) > 8 )

	{

		alert(GuildNameLengthError);

		return false;

	}

			

	var Restricted_Word="gunbound,master,softnyx,?";

	var Restricted_Word_List=Restricted_Word.split(",");



	for (var i = 0 ; i < Restricted_Word_List.length ; i++)

    	{		   

		if ( Str_Guild_Name.toLowerCase().indexOf(Restricted_Word_List[i].toLowerCase()) != -1 )

		{

			alert(restrict);				

			return false;

		}

    	}

	

	if( Form_Name.Introduce.value == "" )

	{

		alert(GuildIntroduceLengthError);

		Form_Name.Introduce.focus();

		return false;

	}

	

   	for(i=0;i<Form_Name.Introduce.value.length;i++) 				// ???? ??? ??? ???

   	{      		

	  	if ( (Korean_Character(Form_Name.Introduce.value.substring(i,i+1)) != false ) || (Guild_KeyBoard_Character(Form_Name.Introduce.value.substring(i,i+1)) == true ) || (Form_Name.Introduce.value.charCodeAt(i) == 10) || (Form_Name.Introduce.value.charCodeAt(i) == 32) || (Form_Name.Introduce.value.charCodeAt(i) == 13)  )

	   	{   	   		

		}

		else

		{ 

        		alert(GuildIntroduceCharacterError);

			Form_Name.Introduce.focus();

			return false;

		} 

	}  	

		

	if( Get_String_Length(Form_Name.Introduce.value) > 500)

	{

		alert(GuildIntroduceLengthError);

		Form_Name.Introduce.focus();

		return false;

	}

	

	if( Form_Name.Condition.value == "" )

	{

		alert(GuildRequirementLengthError);

		Form_Name.Condition.focus();

		return false;

	}

	

   	for(i=0;i<Form_Name.Condition.value.length;i++) 				// ???? ??? ??? ???

   	{      		

	  	if ( (Korean_Character(Form_Name.Condition.value.substring(i,i+1)) != false ) || (Guild_KeyBoard_Character(Form_Name.Condition.value.substring(i,i+1)) == true ) || (Form_Name.Condition.value.charCodeAt(i) == 10) || (Form_Name.Condition.value.charCodeAt(i) == 32) || (Form_Name.Condition.value.charCodeAt(i) == 13)  )

	   	{   	   		

		}

		else

		{ 

        		alert(GuildRequirementCharacterError);

			Form_Name.Condition.focus();

			return false;

		} 

	} 

			

	if( Get_String_Length(Form_Name.Condition.value) > 500)

	{

		alert(GuildRequirementLengthError);

		Form_Name.Introduce.focus();

		return false;

	}	

	

	if ( Special_Character_for_Intoroduce(Form_Name.Introduce.value) == true || Special_Character_for_Intoroduce(Form_Name.Condition.value) == true )

	{

		alert(YouCanNotUseSearchCharacterII);

		return false;

	}

	

	Submit_Count += 1;	

	return true;

}







function Guild_InfoEdit(Form_Name)			// Guild_Make.asp ?? ???? ??? form submit ? ??

{

	var Submit_Count = 1;

	if ( Submit_Count > 1 )

	{

		alert(ProcessingCreateGuild);

		return false;

	}



	var Str_Guild_Name = Form_Name.Guild_Name.value;

	//if ( Str_Guild_Name == "" )

	//{

	//	alert(TypeGuildName);

	//	Form_Name.Guild_Name.focus();

	//	return false;

	//}

	

	//if ( Special_Character(Str_Guild_Name))

	//{

	//	alert(GuildNameError);

	//	return false;

	//}



	//if (Get_String_Length(Str_Guild_Name) > 8 )

	//{

	//	alert(GuildNameLengthError);

	//	return false;

	//}

			

	var Restricted_Word="gunbound,master,softnyx";

	var Restricted_Word_List=Restricted_Word.split(",");



	for (var i = 0 ; i < Restricted_Word_List.length ; i++)

    	{		   

		if ( Str_Guild_Name.toLowerCase().indexOf(Restricted_Word_List[i].toLowerCase()) != -1 )

		{

			alert(restrict);				

			return false;

		}

    	}

	

	if( Form_Name.Introduce.value == "" )

	{

		alert(GuildIntroduceLengthError);

		Form_Name.Introduce.focus();

		return false;

	}

	

   	for(i=0;i<Form_Name.Introduce.value.length;i++) 				// ???? ??? ??? ???

   	{      		

	  	if ( (Korean_Character(Form_Name.Introduce.value.substring(i,i+1)) != false ) || (Guild_KeyBoard_Character(Form_Name.Introduce.value.substring(i,i+1)) == true ) || (Form_Name.Introduce.value.charCodeAt(i) == 10) || (Form_Name.Introduce.value.charCodeAt(i) == 32) || (Form_Name.Introduce.value.charCodeAt(i) == 13)  )

	   	{   	   		

		}

		else

		{ 

        		alert(GuildIntroduceCharacterError);

			Form_Name.Introduce.focus();

			return false;

		} 

	}  	

		

	if( Get_String_Length(Form_Name.Introduce.value) > 500)

	{

		alert(GuildIntroduceLengthError);

		Form_Name.Introduce.focus();

		return false;

	}

	

	if( Form_Name.Condition.value == "" )

	{

		alert(GuildRequirementLengthError);

		Form_Name.Condition.focus();

		return false;

	}

	

   	for(i=0;i<Form_Name.Condition.value.length;i++) 				// ???? ??? ??? ???

   	{      		

	  	if ( (Korean_Character(Form_Name.Condition.value.substring(i,i+1)) != false ) || (Guild_KeyBoard_Character(Form_Name.Condition.value.substring(i,i+1)) == true ) || (Form_Name.Condition.value.charCodeAt(i) == 10) || (Form_Name.Condition.value.charCodeAt(i) == 32) || (Form_Name.Condition.value.charCodeAt(i) == 13)  )

	   	{   	   		

		}

		else

		{ 

        		alert(GuildRequirementCharacterError);

			Form_Name.Condition.focus();

			return false;

		} 

	} 

			

	if( Get_String_Length(Form_Name.Condition.value) > 500)

	{

		alert(GuildRequirementLengthError);

		Form_Name.Introduce.focus();

		return false;

	}	

	

	if ( Special_Character_for_Intoroduce(Form_Name.Introduce.value) == true || Special_Character_for_Intoroduce(Form_Name.Condition.value) == true )

	{

		alert(YouCanNotUseSearchCharacterII);

		return false;

	}

	

	Submit_Count += 1;	

	return true;

}







function Guild_Apply_Form_Check(Form_Name)

{	

	if ( Form_Name.Introduce.value == "" || Form_Name.Introduce.value.length > 500)

	{

		alert(GuildApplyIntroduceError);

		return false;

	}

	return true;

}



function Confirm_Accept_Applyer(var_Guild_Index,var_Guild_intNowPage,var_intNowPage,var_Applyer_Id,var_Applyer_Number)

{	

	var Confirm_MSG = confirm(ConfirmAcceptGuildApplyer);

	if(Confirm_MSG==true) 

	{

	    document.Guild_Applyer_Info.action = "info_apli-acept-"+var_Guild_Index+".asp";

	    document.Guild_Applyer_Info.submit();

	}

	else

	{	

	    document.Guild_Applyer_Info.action = "miclan.asp";

	    document.Guild_Applyer_Info.submit();		

	}	

}

function Confirm_Reject_Applyer(var_Guild_Index,var_Guild_intNowPage,var_intNowPage,var_Applyer_Id,var_Applyer_Number)

{

	var Confirm_MSG = confirm(ConfirmRejectGuildApplyer);

	if(Confirm_MSG==true) 

	{

	    document.Guild_Applyer_Info.action = "info_apli-cancel-"+var_Guild_Index+".asp";

	    document.Guild_Applyer_Info.submit();

	}

	else

	{

	    document.Guild_Applyer_Info.action = "miclan.asp";

	    document.Guild_Applyer_Info.submit();	

	}		

}



function Exit_From_Guild(var_Guild_Index)

{

	var Confirm_MSG = confirm(ConfirmExitFromGuild);

	if(Confirm_MSG==true) 

	{

		var Confirm_MSG = confirm(ConfirmExitFromGuild1);

		if(Confirm_MSG==true) 

		{		

	   	location.href="clanedit-3-"+var_Guild_Index+".asp";

	  	}

	  	else

	  		{

	  			return false;

	  		}

	}

	else

	{

	   return false;

	}	

}



function Ban_Guilder(var_Guild_Id,var_Guilder_Id) 

{

	if (confirm(ConfirmBanGuilder) == true) 

	{

		location.href="clanedit-4-"+var_Guild_Id+"-"+var_Guilder_Id+".asp";

	}

}