/****************************************
定义检查用户输入姓的函数
*****************************************/
function checkXingInput()
{
if(document.getElementById("xingSelect").value!="other" && document.getElementById("xingSelect").value!="")
	{
	document.getElementById("xing").value = document.getElementById("xingSelect").value;
	document.getElementById("alertMsg").style.display = "none";
		}
else 
	{
		document.getElementById("xing").value = "";
		}		
}

/*****************************************
定义检查用户选择姓的函数
*****************************************/
function checkXing()
{
	if(document.getElementById("xing").value =="")
	{
		document.getElementById("alertMsg").style.display = "block";
		document.getElementById("alertMsg").innerHTML = "请选择或输入您的姓氏。";
		return false;
		}
	return true;
	}
/*****************************************
姓氏選擇窗
*****************************************/
function openXing()
{
	document.getElementById("xingdiv").style.display ='';
}
function dieXing()
{
	document.getElementById("xingdiv").style.display ='none';
	//document.getElementById("xingdiv").style.display ='';
}
function putXing(cool){
	document.getElementById('xing').value=cool.innerHTML;
	dieXing();
}

//直接显示姓氏链接
function getXing(strXing){
	var arrXing = strXing.split(" ");
	var strShow = "";
	for(i=0;i<arrXing.length;i++){
		strShow += "<a href=\"javascript:void(0);\" onclick=\"javascript:putXing(this);\">"+ arrXing[i] +"</a> ";
	}
	document.write(strShow);
}

//返回姓氏链接
function getXing_b(strXing){
	var arrXing = strXing.split(" ");
	var strShow = "";
	for(i=0;i<arrXing.length;i++){
		strShow += "<a href=\"javascript:void(0);\" onclick=\"javascript:putXing(this);\">"+ arrXing[i] +"</a> ";
	}
	return(strShow);
}
/*****************************************
显示择姓历史
*****************************************/
function showHistory(){
	strShow = '';
	if (GetCookie('historyXing') != null){
		strShow = "<div style=\"\" class=\"left\">选过的姓：</div><div style=\"\" class=\"right\">"+ getXing_b(GetCookie('historyXing')) +"<a href=\"javascript:void(0);\" onclick=\"javascript:DelCookie('historyXing');showHistory();\" style=\"color:red;text-decoration:underline;\">清空</a></div><br />";
	}
	document.getElementById('history').innerHTML = strShow;
}
/*****************************************
记录择姓历史
*****************************************/
function saveHistory(strXing){
	var historyXing = "";
	
	if (GetCookie('historyXing') != null){
		historyXing += GetCookie('historyXing');
	}
	
	if(historyXing.indexOf(strXing) == -1){
		setCookie2('historyXing',strXing +' '+ historyXing,999999999)
		SetCookie();
	};
//	alert(GetCookie('historyXing'));
}
/*****************************************
其它函数
*****************************************/
function trim(str){
	for(var i = 0 ; i<str.length && str.charAt(i)==" " ; i++ );
	for(var j =str.length; j>0 && str.charAt(j-1)==" " ; j--);
	if(i>j) return "";  
	return str.substring(i,j);  
}
/*****************************************
显示vip姓名
*****************************************/
function showVip(){
	for(i=0;i<10;i++){
		document.getElementById('vipname'+i).style.color="red";
	}
}

