function CheckGuesstbook(theform){
	if(theform.Name.value.Trim()==""){
		alert("请输入您的姓名！");
		theform.Name.focus();
		return false;
	}
	if(theform.Email.value.Trim()!=""){
		if(!isEmail(theform.Email.value.Trim())){
			alert("请输入正确的E-mail地址！");
			theform.Email.focus();
			return false;
		}
	}
	if(theform.Subject.value.Trim()==""){
		alert("请输入留言主题！");
		theform.Subject.focus(); 
		return false;
	} 
	if(theform.Info.value.Trim()==""){
		alert("请输入留言内容！");
		theform.Info.focus();
		return false;
	}
	if(theform.code.value.Trim()==""){
		alert("请输入验证码！");
		theform.Name.focus();
		return false;
	}
	
	return true;
}
//----------------------------------表情
function appEmotionStr(num) {
	document.all.Info.value += e_arr[num];
}
function showEmotionImg() {
	document.write("<table width=100% border=0 cellspacing=0 cellpadding=0 class=font>");
	var cols = 16;
	var rows = 4;
	for (i=0; i<rows; i++) {
		document.write("<tr align=center>");
		j = i*cols;
		for (; j<i*cols + cols; j++) {
			var tips = e_arr[j];
			document.write("<td height=25><img src=/Web/Images/Face/" + j + ".gif   style='cursor:hand' title='" + tips + "' onclick=appEmotionStr(" + j + ")></td>");
		}
		document.write("</tr>");
	}
	document.write("</table>");
	
}
//////////////////////// emotion func below ////////////////////////

var emotion_shortcut = ":) #_# 8*) :D :\S> :P B_) B_I ^_* :$ :| :( :.( :_( >:( :V *_* :^ :? :! =:| :% :O :X |-) :Z :9 :T :-* *_/ :#| :69 //shuang //qiang //ku //zan //heart //break //F //W //mail //strong //weak //share //phone //mobile //kiss //V //sun //moon //star (!) //TV //clock //gift //cash //coffee //rice //watermelon //tomato //pill //pig //football //shit";
var e_arr = emotion_shortcut.split(" ");

var Emotion_Num = e_arr.length;

var EmotionArray = new Array(Emotion_Num);

for (i=0; i<Emotion_Num; i++) {
	var idx = e_arr[i];
	EmotionArray[idx] = i;
}

var abs_path    =       "<img align='absmiddle' src=/Web/Images/Face/";
var suffix      =       ".gif border=0>";

function getEmotion(idx) {
        document.write(abs_path + EmotionArray[idx] + suffix);
}

function doStr(src) {
	var quote = /(:\)|\#_\#|8\*\)|:\S>|:D|:P|B_\)|B_I|\^_\*|:\$|:\||:\(|:\.\(|:_\(|>:\(|:V|\*_\*|:\^|:\?|:\!|\=:\||:%|:O|:X|\|-\)|:Z|:9|:T|:-\*|\*_\/|:#\||:69|\/\/shuang|\/\/qiang|\/\/ku|\/\/zan|\/\/heart|\/\/break|\/\/F|\/\/W|\/\/mail|\/\/strong|\/\/weak|\/\/share|\/\/phone|\/\/mobile|\/\/kiss|\/\/V|\/\/sun|\/\/moon|\/\/star|\(\!\)|\/\/TV|\/\/clock|\/\/gift|\/\/cash|\/\/coffee|\/\/rice|\/\/watermelon|\/\/tomato|\/\/pill|\/\/pig|\/\/football|\/\/shit)/g;
	var src = src.replace(quote, "<script" + ">getEmotion('$1')</" + "script>");
	document.write(src);
}

function doFlatTxt(src) {       
 
		var quote = /(:\)|\#_\#|8\*\)|:\S>|:D|:P|B_\)|B_I|\^_\*|:\$|:\||:\(|:\.\(|:_\(|>:\(|:V|\*_\*|:\^|:\?|:\!|\=:\||:%|:O|:X|\|-\)|:Z|:9|:T|:-\*|\*_\/|:#\||:69|\/\/shuang|\/\/qiang|\/\/ku|\/\/zan|\/\/heart|\/\/break|\/\/F|\/\/W|\/\/mail|\/\/strong|\/\/weak|\/\/share|\/\/phone|\/\/mobile|\/\/kiss|\/\/V|\/\/sun|\/\/moon|\/\/star|\(\!\)|\/\/TV|\/\/clock|\/\/gift|\/\/cash|\/\/coffee|\/\/rice|\/\/watermelon|\/\/tomato|\/\/pill|\/\/pig|\/\/football|\/\/shit)/g;
		var src = src.replace(quote, "<script" + ">getEmotion('$1')</" + "script>");
		document.write(src);
	 
}
//////////////////////// Image to Symbol ////////////////////////

var imgToSymbol = new Array(Emotion_Num);

for (var i in EmotionArray) {
	var idx = "<IMG src=\"../Images/Face/" + EmotionArray[i] + ".gif\" border=0>";
	imgToSymbol[idx] = i;
}

function imgToSym(src) {
        var quote = /<IMG src=\"images\/([0-9][0-9]?)\.gif\" border=0>/g;
        var src = src.replace(quote, function ($1) {return imgToSymbol[$1];});
        return src;
}

//////////////////////// show func below ////////////////////////
