function fucCheckLength(strTemp)
{
	var i, sum;
	sum=0;
	
	for (i=0;i<strTemp.length;i++)
	{
  		if ((strTemp.charCodeAt(i)>=0) && (strTemp.charCodeAt(i)<=255))
  		{
   			sum=sum+1;
   		}
  		else
  		{
   			sum=sum+2;
   		}
	}
	return sum;
}

play_1 = new Image(101,28);
play_1.src = "/images/button/submit.gif";
play_2 = new Image(101,28);
play_2.src= "/images/button/submit_2.gif";

function SendGuestbook() 
{
	if (document.FormGuestbook.securitycode.value == "") 
	{
		alert("請輸入識別文字");
		document.FormGuestbook.securitycode.focus();
		return false;
	}
	if ( document.FormGuestbook.confirm_statement.checked != true) 
	{
		alert("請看過交友版的留言規定再發表好嗎？");
		document.FormGuestbook.confirm_statement.focus();
		return false;
	}
	if (document.FormGuestbook.message.value == "") 
	{
		alert("請輸入評論");
		document.FormGuestbook.message.focus();
		return false;
	}
	if (document.FormGuestbook.message_mode.value == "") 
	{
		alert("請選擇公開或悄悄話");
		document.FormGuestbook.message_mode.focus();
		return false;
	}
	if (document.FormGuestbook.status.value == 0) 
	{
		alert("請選擇你現在的心情狀態");
		document.FormGuestbook.status.focus();
		return false;
	}
	if ( fucCheckLength(document.FormGuestbook.message.value) <= 5 )
	{
		alert("這麼少字怎麼交朋友阿。");
		document.FormGuestbook.message.focus();
		return false;
	}
	document.FormGuestbook.submit();
}
function SendGuestbook2() 
{
	if ( confirm("留言將刪除。確定嗎？") )
	{
		document.FormGuestbook.submit();
	}
	
}

function showimage() 
{
	if (!document.images)
	return;
	document.images.you.src = "/images/cutefaces/"+document.FormGuestbook.status.options[document.FormGuestbook.status.selectedIndex].value+".gif";
}
var radioID;
function SendID(getid)
{
    radioID = getid;
}
function Toggle(item) 
{
    obj = document.getElementById(item);

	if ( radioID == '1' )
	{
	    document.getElementById("s1").style.display = "block";
		document.getElementById("s2").style.display = "none";
	}
	if ( radioID == '2' )
	{
	    document.getElementById("s1").style.display = "none";
		document.getElementById("s2").style.display = "block";
	}
}
