﻿var STR_Loading  = "数据加载中...";
var STR_NotFound = "没有符号条件的数据"

CITYS     = new Array();
CITYS[0]  = new Array("北京","北京");
CITYS[1]  = new Array("上海","上海");
CITYS[2]  = new Array("天津","天津");
CITYS[3]  = new Array("重庆","重庆");
CITYS[4]  = new Array("河北","石家庄|邯郸|邢台|保定|张家口|承德|廊坊|唐山|秦皇岛|沧州|衡水");
CITYS[5]  = new Array("山西","太原|大同|阳泉|长治|晋城|朔州|吕梁|忻州|晋中|临汾|运城");
CITYS[6]  = new Array("辽宁","沈阳|大连|鞍山|抚顺|本溪|丹东|锦州|营口|阜新|辽阳|盘锦|铁岭|朝阳|葫芦岛");
CITYS[7]  = new Array("吉林","长春|吉林|四平|辽源|通化|白山|松原|白城|延边");
CITYS[8]  = new Array("黑龙江","哈尔滨|齐齐哈尔|牡丹江|佳木斯|大庆|绥化|鹤岗|鸡西|黑河|双鸭山|伊春|七台河|大兴安岭");
CITYS[9]  = new Array("江苏","南京|镇江|苏州|南通|扬州|盐城|徐州|连云港|常州|无锡|宿迁|泰州|淮安");
CITYS[10] = new Array("浙江","杭州|宁波|温州|嘉兴|湖州|绍兴|金华|衢州|舟山|台州|丽水");
CITYS[11] = new Array("安徽","合肥|芜湖|蚌埠|马鞍山|淮北|铜陵|安庆|黄山|滁州|宿州|池州|淮南|巢湖|阜阳|六安|宣城|亳州");
CITYS[12] = new Array("福建","福州|厦门|莆田|三明|泉州|漳州|南平|龙岩|宁德");
CITYS[13] = new Array("江西","南昌|景德镇|九江|鹰潭|萍乡|新余|赣州|吉安|宜春|抚州|上饶");
CITYS[14] = new Array("山东","济南|青岛|淄博|枣庄|东营|烟台|潍坊|济宁|泰安|威海|日照|莱芜|临沂|德州|聊城|滨州|菏泽");
CITYS[15] = new Array("河南","郑州|开封|洛阳|平顶山|安阳|鹤壁|新乡|焦作|濮阳|许昌|漯河|三门峡|南阳|商丘|信阳|周口|驻马店|济源");
CITYS[16] = new Array("湖北","武汉|宜昌|荆州|襄樊|黄石|荆门|黄冈|十堰|恩施|潜江|天门|仙桃|随州|咸宁|孝感|鄂州");
CITYS[17] = new Array("湖南","长沙|常德|株洲|湘潭|衡阳|岳阳|邵阳|益阳|娄底|怀化|郴州|永州|湘西|张家界");
CITYS[18] = new Array("广东","广州|深圳|珠海|汕头|东莞|中山|佛山|韶关|江门|湛江|茂名|肇庆|惠州|梅州|汕尾|河源|阳江|清远|潮州|揭阳|云浮");
CITYS[19] = new Array("甘肃","兰州|嘉峪关|金昌|白银|天水|酒泉|张掖|武威|定西|陇南|平凉|庆阳|临夏|甘南");
CITYS[20] = new Array("陕西","西安|宝鸡|咸阳|铜川|渭南|延安|榆林|汉中|安康|商洛");
CITYS[21] = new Array("内蒙古","呼和浩特|包头|乌海|集宁|通辽|赤峰|呼伦贝尔盟|阿拉善盟|哲里木盟|兴安盟|乌兰察布盟|锡林郭勒盟|巴彦淖尔盟|伊克昭盟");
CITYS[22] = new Array("广西","南宁|柳州|桂林|梧州|北海|防城港|钦州|贵港|玉林|南宁|柳州|贺州|百色|河池");
CITYS[23] = new Array("四川","成都|绵阳|德阳|自贡|攀枝花|广元|内江|乐山|南充|宜宾|广安|达川|雅安|眉山|甘孜|凉山|泸州");
CITYS[24] = new Array("贵州","贵阳|六盘水|遵义|安顺|铜仁|黔西南|毕节|黔东南|黔南");
CITYS[25] = new Array("云南","昆明|大理|曲靖|玉溪|昭通|楚雄|红河|文山|思茅|西双版纳|保山|德宏|丽江|怒江|迪庆|临沧");
CITYS[26] = new Array("西藏","拉萨|日喀则|山南|林芝|昌都|阿里|那曲");
CITYS[27] = new Array("海南","海口|三亚");
CITYS[28] = new Array("宁夏","银川|石嘴山|吴忠|固原");
CITYS[29] = new Array("青海","西宁|海东|海南|海北|黄南|玉树|果洛|海西");
CITYS[30] = new Array("新疆","乌鲁木齐|石河子|克拉玛依|伊犁|巴音郭勒|昌吉|克孜勒苏柯尔克孜|博尔塔拉|吐鲁番|哈密|喀什|和田|阿克苏");
CITYS[31] = new Array("香港","香港");
CITYS[32] = new Array("澳门","澳门");
CITYS[33] = new Array("台湾","台北|高雄|台中|台南|屏东|南投|云林|新竹|彰化|苗栗|嘉义|花莲|桃园|宜兰|基隆|台东|金门|马祖|澎湖");
CITYS[34] = new Array("海外","美国|日本|英国|法国|德国|加拿大|澳大利亚|俄罗斯|新西兰|意大利|韩国|比利时|瑞士|新加坡|墨西哥|荷兰|巴西|印度|爱尔兰|马来西亚|丹麦|南非|西班牙|葡萄牙|瑞典|其它");

JOBS     = new Array(
           "经营/管理",
           "计算机/互联网",
           "行政/人事/文职",
           "公关/市场/广告/会展",
           "贸易/销售/客户服务",
           "物流/仓储",
           "财会/审计/统计/金融",
           "机械工程技术",
           "建筑/房地产工程技术",
           "化工/制药/环境/生物工程",
           "电子/通讯/电气/电力工程",
           "纺织/服装/食品工程技术",
           "纸/印刷/家具家电制造",
           "其他工程技术",
           "教育/科研/文体/出版/传媒",
           "医疗/卫生/护理/保健",
           "法律/翻译/咨询服务",
           "旅游/酒店/餐饮/商场/娱乐服务",
           "农林牧渔",
           "规划/设计/园林绿化",
           "技工",
           "其他"
           );
           
INTERESTS = new Array(
		   "音乐", "美食", "电影", "时尚", "交友",
		   "运动", "旅游", "游戏", "购物", "阅读"
			);

CASTS = new Array(
			"工作", "旅游",  "房产",  "培训", "数码家电",
			"出国", "交友",  "文化",  "游戏", "交通工具",
			"服饰", "化妆",  "家居",  "娱乐", "生活用品"
 			);

TEMPLATES = new Array(
			"圣诞节", "新年", "感恩节"
			);

function CheckLogin(ob)
{
	if (CXConfig.m_Member == null || CXConfig.m_Member == "")
	{
		if (ob)
		{
			if (ob.tagName == 'A')
			{
				ob.href = CXConfig.m_SiteUrl + "/user/login.htm?returnurl=" + escape(ob.href);
				return;
			}
		}
	
		location.href = CXConfig.m_SiteUrl + "/user/login.htm?returnurl=" + escape(location.href);
	}
}

function InitLogin(url)
{
	CXConfig.OnMemberChanged = function()
	{
		guestPanel.style.display = CXConfig.IsLoginned ? "none" : "inline";
		memberPanel.style.display = CXConfig.IsLoginned ? "inline" : "none";

		if (CXConfig.IsLoginned)
			memberTitle.innerHTML = CXConfig.m_MemberNick + "(" + CXConfig.m_Member + ")";
	}										
	
	var str="";
	var session = CXUtility.GetPostParameter("session");
	if (session != null)
		session = "?session="+session;
	else
		session = "";
	var retry = CXUtility.GetPostParameter("retry");
	if (retry == "yes")
	{
		session += session != "" ? "&" : "?";
		session += "retry=yes";
	}						

	if (url == null)
		url = location.href;

	document.write(''
				 + '<div class="top">'
				 + '	<div id="guestPanel"><form id="loginForm" method="post" action="' + CXConfig.m_ClientUrl + "?action=login&returnurl=" + escape(url) + '">'
				 + '		用户名：<input class="input_text" name="user" type="text"/>'
				 + '		&nbsp;密码：<input class="input_text"  name="pass" type="password"/>'
				 + '		&nbsp;<input name="" type="submit" class="button" value="登录"/>'
				 + '		<a href="' + CXConfig.m_SiteUrl + '/user/code.htm">忘记密码？</a>| <a href="' + CXConfig.m_SiteUrl + '/user/register.htm">注册</a> | <a href="' + CXConfig.m_SiteUrl + '/forum">论坛</a> | <a href="' + CXConfig.m_SiteUrl + '/zuoyou/club/login.htm">企业登录</a>'
				 + '	</form></div>'
				 + '	<div id="memberPanel" style="display:none">'
				 + '		欢迎您：<span id="memberTitle"></span>，'
				 + '		<a href="' + CXConfig.m_ClientUrl + "?action=logout&returnurl=" + escape("/") + '">注销</a> | <a href="' + CXConfig.m_SiteUrl + '/forum">论坛</a> | <a href="' + CXConfig.m_SiteUrl + '/user/manage.htm">个人管理</a>  | <a href="' + CXConfig.m_SiteUrl + '/shequ/money.htm"><font color=red>账户充值</font></a>'
				 + '	</div>'
				 + '</div>'
				 + '<iframe frameborder="0" width="0" height="0" src="' + CXConfig.m_SiteUrl + '/common/session.aspx' + session + '"></iframe>');
				 
	CXConfig.OnMemberChanged();
}

function Footer()
{
	document.write(''
		+ '<div class="clear"></div>'
		+ '<div class="hzlink">'
		+ '<p class="font-b">友情链接：</p>'
		+ '<p><a href="http://www.skycn.com">天空</a> | <a href="http://www.onlinedown.net">华军</a> | <a href="http://www.duote.com">多特</a> | <a href="http://down.cnzz.cn/">中国站长</a> | <a href="http://www.zubunet.com/site/magazineindex.html">悦读</a> | <a href="http://www.uusee.com">悠视</a> | <a href="http://www.xker.com/down/">新客网</a></p>'
		+ '</div>'
		+ '<div class="copyright">'
		+ '· <a href="' + CXConfig.m_SiteUrl + '/other/aboutUTA.htm">网站简介</a> <a href="' + CXConfig.m_SiteUrl + '/other/priv.htm">隐私声明</a> <a href="' + CXConfig.m_SiteUrl + '/other/contact.htm">关于我们</a>· '
		+ '<br /><a href="http://www.miibeian.gov.cn/">京ICP证05032405</a><a href="http://www.intertimes.com.cn"> 2002-2003 BEIJING INTERTIMES INFORMATION TECH.CO.,LTD.</a> All Rights Reserved.'
		+ '</div>');
}

function Contact()
{
	document.write(''
		+ '<table>'
		+ '	<tr>'
		+ '		<td><p>在线销售&nbsp;<span>' 
			+ '<a href="http://sighttp.qq.com/cgi-bin/check?sigkey=9fab37cb7ab783ac8131b84a52cd036b31085e938407da111aee7b8d299f3550"; target=_blank; onclick="var tempSrc=\'http://sighttp.qq.com/wpa.js?rantime=\'+Math.random()+\'&sigkey=9fab37cb7ab783ac8131b84a52cd036b31085e938407da111aee7b8d299f3550\';var oldscript=document.getElementById(\'testJs\');var newscript=document.createElement(\'script\');newscript.setAttribute(\'type\',\'text/javascript\'); newscript.setAttribute(\'id\', \'testJs\');newscript.setAttribute(\'src\',tempSrc);if(oldscript == null){document.body.appendChild(newscript);}else{oldscript.parentNode.replaceChild(newscript, oldscript);}return false;"><img border="0" SRC=\'http://wpa.qq.com/pa?p=1:654365590:41\' alt=""></a>'
		+ '</span></p></td>'
		+ '	</tr>'	
		+ '	<tr>'
		+ '		<td><p>技术支持&nbsp;<span>' 
			+ '<a href="http://sighttp.qq.com/cgi-bin/check?sigkey=8c0c94d3644f516358acbc24918691efd1cedecbd801bb9eef02f53e2a356d3a"; target=_blank; onclick="var tempSrc=\'http://sighttp.qq.com/wpa.js?rantime=\'+Math.random()+\'&sigkey=8c0c94d3644f516358acbc24918691efd1cedecbd801bb9eef02f53e2a356d3a\';var oldscript=document.getElementById(\'testJs\');var newscript=document.createElement(\'script\');newscript.setAttribute(\'type\',\'text/javascript\'); newscript.setAttribute(\'id\', \'testJs\');newscript.setAttribute(\'src\',tempSrc);if(oldscript == null){document.body.appendChild(newscript);}else{oldscript.parentNode.replaceChild(newscript, oldscript);}return false;"><img border="0" SRC=\'http://wpa.qq.com/pa?p=1:1452894686:41\' alt=""></a>'
		+ '</span><br/>　　　　&nbsp;<span>' 
			+ '<a href="http://sighttp.qq.com/cgi-bin/check?sigkey=0b5f562385a8f92d37706726fe7d39323925a657361fe0a912f0a6661d220c94"; target=_blank; onclick="var tempSrc=\'http://sighttp.qq.com/wpa.js?rantime=\'+Math.random()+\'&sigkey=0b5f562385a8f92d37706726fe7d39323925a657361fe0a912f0a6661d220c94\';var oldscript=document.getElementById(\'testJs\');var newscript=document.createElement(\'script\');newscript.setAttribute(\'type\',\'text/javascript\'); newscript.setAttribute(\'id\', \'testJs\');newscript.setAttribute(\'src\',tempSrc);if(oldscript == null){document.body.appendChild(newscript);}else{oldscript.parentNode.replaceChild(newscript, oldscript);}return false;"><img border="0" SRC=\'http://wpa.qq.com/pa?p=1:626133867:41\' alt=""></a>'
		+ '</span></p></td>'
		+ '	</tr>'
		+ '</table>');
	
}

function WritePage(page, count, pagesize, func, arg, e)
{
	var text = "";

	if (e == null)
		e = document.getElementById("page");

	var size = Number(CXUtility.GetPostParameter("size")).toFixed(0);
	count = Number(count).toFixed(0)
	pagesize = Number(pagesize);
	
	page = Number(page).toFixed(0);
	if (page < 0)
		page = 0;

	if (count > 1)
	{
		if (arg == null)
			arg = "null";
			
		var start = page - page % 10; 
		var end = start + 10 + 1;
		if (end > count)
			end = count;

		text += "共" + count + "页，";

		if (page > 0)
		{
			text += "<a href='javascript:{" + func + "("+ --page +", " + arg + ")}'><上一页></a> ";
			page+=1;
		}
		
		if (start > 1)
			start--;
			
		for (var i = start; i < end; i++)
		{
			if (i == page)
				text += "<span class='font-b'>" + (i + 1) + "</span> ";
			else
				text += "<a href='javascript:{" + func + "(" + i + ", " + arg + ")}'>" + (i + 1) + "</a> ";
		}
			
		if (page < count - 1)
		{
			text += "<a href='javascript:{" + func + "(" + ++page +", " + arg + ")}'><下一页></a> ";
			page-=1;
		}
	}
	
	e.innerHTML = text;
}

function SwitchShow(o, button, showtext, hidetext)
{
	if (o.style.display != "none")
		o.style.display = "none";
	else
		o.style.display = "block";
	
	if (button && showtext && hidetext)
	{
		if (button.tagName == "input")
			button.value = o.style.display != "none" ? hidetext : showtext;
		else
			button.innerHTML = o.style.display != "none" ? hidetext : showtext;
	}			
}

function SelectAll(o, id)  {
	if (id == null)
		id = "id";
		
	var list = document.getElementsByName(id);
	for (var i = 0; i < list.length; i++)
	{
		if (list(i).type == "checkbox")
			list(i).checked = o.checked;
	}
	
	for (var i = 2; i < arguments.length; i++)
		CheckAll(o, arguments[i]);
}

function SelectRadio(list, value)
{
	var count = list.length;
	for (var i = 0; i < count; i++)
		list[i].checked = list[i].value == value;
}

function SelectCheckbox(list, value)
{
	if (value != null)
	{
		value = value.split(",");
	
		var count = list.length;
		var count1 = value.length;
		for (var i = 0; i < count; i++)
		{
			for (var j = 0; j < count1; j++)
			{
				if (list[i].value == value[j])
				{
					list[i].checked = true;
					break;
				}
			}			
		}
	}		
}

function SelectDate(year, month, day, date)
{
	if (date != null)
	{
		var pos = date.indexOf('-');
		if (pos != -1)
		{
			var n = Number(date.substring(0, pos));
			if (!isNaN(n))
			{
				year.value = n;
				var pos1 = date.substring('-', pos + 1);
				if (pos1 != -1)
				{
					n = Number(date.substring(pos + 1, pos1));
					if (!isNaN(n))
					{
						month.value = n;
						n = Number(date.substring(pos1 + 1, date.length));
						if (!isNaN(n))
							day.value = n;
					}
				}
			}
		}
	}
}

function ChangeBar(show)
{
	var count = ChangeBar.arguments.length;
	for (var i = 0; i < count; i++)
	{
		if (ChangeBar.arguments[i] == show)
			continue;
			
		if (ChangeBar.arguments[i].style.display != "none")
		{
			ChangeBar.arguments[i].style.display = "none";
			var title = document.getElementById(ChangeBar.arguments[i].id + "title");
			if (title != null)
				title.className = "sheet-default";    
		}
	}
	
	if (show.style.display != "block")
	{
		show.style.display = "block";
		var title = document.getElementById(show.id + "title");
		if (title != null)
		title.className = "sheet-select";    
	}
}

function ChangeBar2(show)
{
	var count = ChangeBar2.arguments.length;
	for (var i = 0; i < count; i++)
	{
		if (ChangeBar2.arguments[i] == show)
			continue;
			
		if (ChangeBar2.arguments[i].style.display != "none")
		{
			ChangeBar2.arguments[i].style.display = "none";
			var title = document.getElementById(ChangeBar2.arguments[i].id + "title");
			if (title != null)
				title.className = "sheet2-default";    
		}
	}
	
	if (show.style.display != "block")
	{
		show.style.display = "block";
		var title = document.getElementById(show.id + "title");
		if (title != null)
		title.className = "sheet2-select";    
	}
}

function ChangeBar4(show)
{
	var count = ChangeBar4.arguments.length;
	for (var i = 0; i < count; i++)
	{
		if (ChangeBar4.arguments[i] == show)
			continue;
			
		if (ChangeBar4.arguments[i].style.display != "none")
		{
			ChangeBar4.arguments[i].style.display = "none";
			var title = document.getElementById(ChangeBar4.arguments[i].id + "title");
			if (title != null)
				title.className = "sheet4-default";    
		}
	}
	
	if (show.style.display != "block")
	{
		show.style.display = "block";
		var title = document.getElementById(show.id + "title");
		if (title != null)
		title.className = "sheet4-select";    
	}
}

function ChangeBar1(show)
{
	var count = ChangeBar1.arguments.length;
	for (var i = 0; i < count; i++)
	{
		if (ChangeBar1.arguments[i] == show)
			continue;
			
		if (ChangeBar1.arguments[i].style.display != "none")
		{
			ChangeBar1.arguments[i].style.display = "none";
			var title = document.getElementById(ChangeBar1.arguments[i].id + "title");
			if (title != null)
				title.className = "sheet1-default";    
		}
	}
	
	if (show.style.display != "block")
	{
		show.style.display = "block";
		var title = document.getElementById(show.id + "title");
		if (title != null)
		title.className = "sheet1-select";    
	}
}
	
function RemoveHTML(strText)
{
	var regEx = /<[^>]*>|\n|\r/g;
	return strText.replace(regEx, "");
}

function TrimLength(strText, length)
{
	if (strText != null && strText.length > length)
		strText = strText.substring(0, length) + "...";
		
	return strText;
}



function GetScoreGrade(score)
{
	var n = "0";
	
	if (score >= 8.5)
		n = "5";
	else if (score >= 7.5)
		n = "4";
	else if (score >= 6.5)
		n = "3";
	else if (score >= 5.5)
		n = "2";
	else if (score >= 4.5)
		n = "1";
	else 
		n = "0";
		
	return n;
}

function RefreshVerifyCode()
{
	var ob = document.getElementById("codeImg");
	if (ob != null)
		ob.src = CXConfig.m_VerifyUrl + "&r=" + Math.random();
}

function SubmitForm(form, ensure)
{
	if (form == null)
		form = document.getElementById("submitForm");
		
	if (form)
	{
		var msg = GetVerifyMsg(form.all.tags("input"), form.all.tags("select"), form.all.tags("textarea"));
		if (msg != null && msg != "")
		{
			alert(msg);
			return false;
		}	
		
		if (ensure != null && ensure != "")
		{
			if (!confirm(ensure))
				return false;			
		}
		form.submit();
	}
}

function GetScoreImage(score)
{
	return CXConfig.m_SiteUrl + "/toolbar/img/star/" + GetScoreGrade(score) + ".gif";
}

function SetDefaultText(ob)
{
	if (ob.value == '请输入搜索关键字')
		ob.value="";
}

function GetDefaultText(text, def)
{
	if (text == "" || text == null)
		return def;
	
	return CXUtility.HTMLEncode(text);
}

function GetDigitalText(text)
{
	if (text != null && text != "")
	{
		var pos = text.indexOf(".");
		if (pos == -1)
			pos = text.length;	
		for (pos = pos - 3; pos > 0; pos -= 3)
			text = text.substring(0, pos) + "," + text.substring(pos, text.length);
	}	

	return text;
}

function Search(query)
{
	var	url = CXConfig.m_SiteUrl + "/search.htm?type=" + searchType.value;
		
	var key = searchText.value;
	if (key != null && key != '请输入搜索关键字')
		url += "&alias=" + searchText.value;
	if (query != null)
		url += "&" + query;
		
	location.href = url;
}

var VerifyReg = {
	"member":	/^[a-zA-Z/_][a-zA-Z0-9/_/./-]{2,19}$/,
	"newmember":/^[a-zA-Z/_][a-zA-Z0-9/_/./-]{2,19}$/,
	"nickname":	/^[^<>]{1,50}$/,
	"pass":		/^[^\r]{4,20}$/,
	"newpass":	/^[^\r]{4,20}$/,
	"email":	/^.+@[^\r]{2,}$/,
	"qq":		/^([\d]+)*$/
};

function VerifyInput(target, msg)
{
	if (typeof(target) == "object")
	{
		var id = target.id;
		if (id == null || id == "")
			id = target.name;
			
		if (id != null && id != "")
		{
			var reg = VerifyReg[id];
			if (reg != null && target.value.search(reg) == -1)
				return msg;
		}
	}
	else
	{
		if (!target)
			return msg;
	}
	
	return null;
}

function GetVerifyMsg()
{
	var msg = "";
	var list = null;
	
	var count = arguments.length;
	if (count == 0)
	{
		list = document.all;
		count = 1;
	}
	
	for (var i = 0; i < count; i++)
	{
		var list1 = list != null ? list : arguments[i];
		var count1 = list1.length;
		for (var i1 = 0; i1 < count1; i1++)
		{
			var ob = list1[i1];
			var text = ob.onverify;
			
			if (text != null && text != "")
			{
				with (ob)
				{
					try {text = eval(text.replace("this", "ob"));} catch(e){}
					
					if (text != null && text != "")
					{
						if (msg != null && msg != "")
							msg += "\n";					
						msg += text;
					}
				}
			}
		}
	}
	
	return msg;
}

function WriteSex(ob)
{
	if (ob != null)
	{
		ob.length     = 0;
		ob.options[0] = new Option("=请选择=","");
		ob.options[1] = new Option("男", "男");
		ob.options[2] = new Option("女", "女");
	}
	else
	{
		document.write('<option value="">=请选择=</option>');
		document.write('<option value="男">男</option>');
		document.write('<option value="女">女</option>');
	}
}

function WriteUse(ob)
{
	if (ob != null)
	{
		ob.length     = 0;
		ob.options[0] = new Option("=请选择=","");
		ob.options[1] = new Option("个人", "个人");
		ob.options[2] = new Option("办公", "办公");
	}
	else
	{
		document.write('<option value="">=请选择=</option>');
		document.write('<option value="个人">个人</option>');
		document.write('<option value="办公">办公</option>');
	}
}

function WriteYear(ob)
{
	for (var i = 1930; i < 2005; i++) 
	{
		if (ob != null)
		{
			ob.options[ob.options.length] = new Option(i, i);
			if (i == 1980)
				ob.options[ob.options.length].selected = true;
		}
		else
		{
			if (i == 1980)
				document.write('<option value="' + i + '" selected>' + i + '</option>');
			else
				document.write('<option value="' + i + '">' + i + '</option>');
		}
	}
}

function WriteMonth(ob, year)
{
	for (var i = 1; i <= 12; i++)
	{
		if (ob != null)
			ob.options[ob.options.length] = new Option(i, i);
		else
			document.write('<option value="' + i + '">' + i + '</option>');
	}
}

function WriteDay(ob, year, month)
{
	for (var i = 1; i <= 31; i++)
	{
		if (ob != null)
			ob.options[ob.options.length] = new Option(i, i);
		else
			document.write('<option value="' + i + '">' + i + '</option>');
	}
}

function WriteProvince(ob)
{
	if (ob != null)
	{
		ob.length     = 0;
		ob.options[0] = new Option("=请选择=","");
	}
	else
	{
		document.write('<option value="">=请选择=</option>');
	}
	
	var count = CITYS.length;
	for (var i = 0; i < count; i++)
	{
		if (ob != null)
			ob.options[ob.options.length] = new Option(CITYS[i][0],  CITYS[i][0]);
		else
			document.write('<option value="' + CITYS[i][0] + '">' + CITYS[i][0] + '</option>');
	}
}

function WriteCity(ob, province)
{
	if (ob != null)
	{
		ob.length     = 0;
		ob.options[0] = new Option("=请选择=","");
	}
	else
	{
		document.write('<option value="">=城市=</option>');
	}
		
	var count = CITYS.length;
	for (var i = 0; i < count; i++)
	{
		if (CITYS[i][0] == province)
		{
			var list = CITYS[i][1].split("|");
			count = list.length;
			for (i = 0; i < count; i++)
			{
				if (ob != null)
					ob.options[ob.options.length] = new Option(list[i], list[i]);
				else
					text += '<option value="' + list[i] + '">' + list[i] + '</option>';					
			}
			
			break;
		}
	}
	
	if (ob != null && ob.options.length == 2)
		ob.selectedIndex = 1;
}

function WriteJob(ob)
{
	if (ob != null)
	{
		ob.length     = 0;
		ob.options[0] = new Option("=请选择=","");
	}
	else
	{
		document.write('<option value="">=请选择=</option>');
	}
	
	var count = JOBS.length;
	for (var i = 0; i < count; i++)
	{
		if (ob != null)
		{
			ob.options[ob.options.length] = new Option(JOBS[i],  JOBS[i]);
			if (i == 1)
				ob.options[ob.options.length].selected = true;
		}
		else
		{
			if (i == 1)
				document.write('<option value="' + JOBS[i] + '" selected>' + JOBS[i] + '</option>');
			else
				document.write('<option value="' + JOBS[i] + '">' + JOBS[i] + '</option>');
		}
	}
}

function WriteInterest(ob)
{
	var text = "";
	
	var count = INTERESTS.length;
	for (var i = 0; i < count; i++)
	{
		text += '<input type="checkbox" name="interest" value="' + INTERESTS[i] + '"/>' + INTERESTS[i]+'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
		if ((i + 1) % 5 == 0)
			text += '<br/>';
	}
	
	if (ob != null)
	{
		ob.innerHTML = text;
	}
	else
	{
		document.write(text);
	}
}

function WriteCast(ob)
{
	var text = "";
	
	var count = CASTS.length;
	for (var i = 0; i < count; i++)
	{
		text += '<input type="checkbox" name="cast" value="' + CASTS[i] + '"/>' + CASTS[i]+'&nbsp;&nbsp;&nbsp;&nbsp;';
		if ((i + 1) % 5 == 0)
			text += '<br/>';
	}
	
	if (ob != null)
	{
		ob.innerHTML = text;
	}
	else
	{
		document.write(text);
	}
}

function WriteTemplate(ob)
{
	if (ob != null)
	{
		ob.length     = 0;
		ob.options[0] = new Option("=请选择=","");
	}
	else
	{
		document.write('<option value="">=请选择=</option>');
	}
	
	var count = TEMPLATES.length;
	for (var i = 0; i < count; i++)
	{
		if (ob != null)
		{
			ob.options[ob.options.length] = new Option(TEMPLATES[i],  TEMPLATES[i]);
			if (i == 1)
				ob.options[ob.options.length].selected = true;
		}
		else
		{
			if (i == 0)
				document.write('<option value="' + TEMPLATES[i] + '" selected>' + TEMPLATES[i] + '</option>');
			else
				document.write('<option value="' + TEMPLATES[i] + '">' + TEMPLATES[i] + '</option>');
		}
	}
}

function Card()
{
	var self = this;
	
	this.SwitchLogin = function ()
	{
		var o = document.getElementById("poll");
		
		if (CXConfig.m_MemberID)
		{
			o.children(0).style.display="inline";
			o.children(1).style.display="inline";
			o.children(2).style.display="none";
		}
		else
		{
			o.children(0).style.display="none";
			o.children(1).style.display="none";
			o.children(2).style.display="inline";
		}
	}
	
	this.Vote = function(id)
	{
		function OnOK(xmlDoc, id)
		{
			if (xmlDoc != null)
			{
				alert("投票成功，谢谢您的参与！");
				self.ShowCard(id, true);
			}
		}								
		
		CXUtility.LoadXml(CXConfig.m_ClientUrl + "?action=xnew&type=poll&returnurl=_xml&channel=" + escape(id) + "&poll=" + document.getElementById("poll").children(0).value, OnOK, id, null, true);
	}
		
	this.ShowCard = function(id, refresh)
	{
		document.getElementById("title").children(0).innerHTML = STR_Loading;
		CXUtility.LoadXml(CXConfig.m_ClientUrl + "?action=xgetcover&id=" + escape(id), self.OnCardLoaded, null, null, refresh);
	}
	
	this.OnCardLoaded = function(xmlDoc)
	{
		if (xmlDoc)
		{
			xmlNode = xmlDoc.selectSingleNode("//rec");
			if (xmlNode != null)
			{
				var parser = new CVFDLNode();
				parser.LoadXmlNode(xmlNode);

				var tip = "";
				var tiplist = parser.GetVarValue("tip");
				if (tiplist)
				{
					tiplist = tiplist.split(',');
					var n = tiplist.length - 4;
					if (n < 0)
						n = 0;
					for (; n < tiplist.length; n++)
						tip += '<a href="' + CXConfig.m_SiteUrl + 'zhima/zhima_search.htm?tip=' + tiplist[n] + '">' + tiplist[n] + '</a> ';
				}				
				
				var abs = parser.GetVarValue("official");
				if (abs==null||abs=="")
					abs="没有评论信息";
					
				document.getElementById("avatar").children(0).src = parser.GetVarValue("avatar");
				document.getElementById("title").children(0).innerHTML = parser.GetSubject();
				document.getElementById("title").children(0).href = parser.GetFilePos();
				document.getElementById("provider").children(0).innerHTML = parser.GetVarValue("provider");
				document.getElementById("provider").children(0).href = parser.GetVarValue("providerurl");
				document.getElementById("open").children(0).href = parser.GetFilePos();
				document.getElementById("tip").children(0).innerHTML = tip;
				document.getElementById("grade").children(0).outerHTML = '<img src="' + GetScoreImage(parser.GetVarValue("score")) + '" onclick="javascript:{location.href=\''+ CXConfig.m_SiteUrl + '/zhima/zhima_search.index?grade=' + GetScoreGrade(parser.GetVarValue("score")) + '\'}" style="cursor:hand"/>';
				document.getElementById("access").children(0).innerHTML = parser.GetVarValue("access");
				document.getElementById("weekaccess").children(0).innerHTML = parser.GetVarValue("weekaccess");
				document.getElementById("monthaccess").children(0).innerHTML = parser.GetVarValue("monthaccess");
				document.getElementById("abstract").children(0).innerHTML = abs;
				
				var s = "";				
				s = parser.GetVarValue("remark");
				if (s==null||s=="")
					s="暂无信息";
				document.getElementById("remark").innerHTML = s;
				
				s = "";
				var relate = parser.GetRelateList()
				for (var i in relate)
				{
					s += Number(i+1) + '. <a href="' + relate[i].Src + '" target="_blank">' + relate[i].Alias + '</a>';
					if (i != relate.length - 1)
						s += '<br/>';
				}
				if (s==null||s=="")
					s="暂无信息";
				document.getElementById("relate").innerHTML = s;
				
				s = parser.GetVarValue("poll");
				if (s)
				{
					var list = s.replace(/]\s*/, "").split(/,|=|\[/g);
					if (list.length == 11)
					{
						document.getElementById("count").children(0).innerHTML = list[0];
						
						var count = list[0] > 0 ? list[0] : 1;
						document.getElementById("0001").children(0).innerHTML = list[2];
						document.getElementById("0001").children(1).innerHTML = (list[2] * 100/count).toFixed(0) + "%";
						document.getElementById("0001img").children(0).style.width = 1 + list[2] * 90 /count + "%";
						document.getElementById("0002").children(0).innerHTML = list[4];
						document.getElementById("0002").children(1).innerHTML = (list[4] * 100/count).toFixed(0) + "%";
						document.getElementById("0002img").children(0).style.width = 1 + list[4] * 90 /count + "%";
						document.getElementById("0003").children(0).innerHTML = list[6];
						document.getElementById("0003").children(1).innerHTML = (list[6] * 100/count).toFixed(0) + "%";
						document.getElementById("0003img").children(0).style.width = 1 + list[6] * 90 /count + "%";
						document.getElementById("0004").children(0).innerHTML = list[8];
						document.getElementById("0004").children(1).innerHTML = (list[8] * 100/count).toFixed(0) + "%";
						document.getElementById("0004img").children(0).style.width = 1 + list[8] * 90 /count + "%";
						document.getElementById("0005").children(0).innerHTML = list[10];
						document.getElementById("0005").children(1).innerHTML = (list[10] * 100/count).toFixed(0) + "%";
						document.getElementById("0005img").children(0).style.width = 1 + list[10] * 90 /count + "%";
					}
				}
				
				self.SwitchLogin();
				document.getElementById("vote").value = parser.GetVarValue("dataid");
			}
			return;			
		}

		document.getElementById("title").children(0).innerHTML = STR_NotFound;
	}
	
	self.SwitchLogin();	
}

function PopupWindow(Content, title, min, size, url)
{
	function GetBody()
	{
		var bodyST, bodyCH;
		if(window.pageYOffset)
		{bodyST=window.pageYOffset;}
		else if(document.documentElement&&document.documentElement.scrollTop)
		{bodyST=document.documentElement.scrollTop;}
		else if(document.body)
		{bodyST=document.body.scrollTop;}
		if(window.innerHeight)
		{bodyCH=window.innerHeight;}
		else if(document.documentElement&&document.documentElement.clientHeight)
		{bodyCH=document.documentElement.clientHeight;}
		else if(document.body)
		{bodyCH=document.body.clientHeight;}
		var W, SL;
		var w=window, d=document, dd=d.documentElement;
		if(dd&&dd.clientWidth) W=dd.clientWidth;
		else if(w.innerWidth) W=w.innerWidth;
		else if(d.body) W=d.body.clientWidth;
		if(w.pageXOffset) SL=w.pageXOffset;
		else if(dd&&dd.scrollLeft) SL=dd.scrollLeft;
		else if(d.body) SL=d.body.scrollLeft;
		return {"scrollTop":bodyST,"scrollLeft":SL,"clientWidth":W,"clientHeight":bodyCH};
	}
	function SetToMiddle()
	{
		var body = GetBody();

		Popup.style.left=body.scrollLeft+(body.clientWidth-Popup.offsetWidth-1)/2+'px';
		Popup.style.top=body.scrollTop+parseInt(body.clientHeight-Popup.offsetHeight-1+0.5)/2+"px";
	}
	function SetToRightCorner()
	{
		var body = GetBody();
		
		Popup.style.top=(body.scrollTop+body.clientHeight-Popup.offsetHeight-1)+"px";
		Popup.style.left=(body.scrollLeft+body.clientWidth-Popup.offsetWidth-1)+"px";
	}
	this.Close = function(ret)
	{
		Content.style.display = "none";
		if (!InsertParent)
			InsertParent = document.body;
		InsertParent.insertBefore(Content, InsertBefore);
		
		if (Content[ret] != null && Content[ret] != "")
			eval(Content[ret]);
		else if (Content.onclose != null)
			eval(Content.onclose);			
		
		Popup.parentElement.removeChild(Popup);
		delete Popup;
	}
	function Minimize()
	{
		var caption = GetCaption();
		var client  = GetClient();
		
		if(caption && client)
		{
			if(client.style.display=='none')
			{
				client.style.display='';
				GetElement("img", "minimize").src=url+"popupMin.gif";
				Popup.style.height = RestoreHeight;
			}
			else
			{
				client.style.display='none';
				GetElement("img", "minimize").src=url+"popupRestore.gif";
				RestoreHeight = Popup.style.height;
				Popup.style.height = "29px";
			}
		}
	}		
	function DragHandler(e)
	{
		if (e == null) { e = window.event;} 
		var target = GetCaption();
		if(target.className.lastIndexOf('popupDraggable')>0)
		{
			var realDiv=Popup;
			SetDivTop(realDiv);
			
			var dragDiv;
			var dragOK = true;
			var dragXoffset = 0;
			var dragYoffset = 0;

			dragDiv=document.createElement('div');
			dragDiv.style.width=realDiv.clientWidth+2+'px';
			dragDiv.style.height=realDiv.clientHeight+2+'px';
			dragDiv.style.left=realDiv.style.left;
			dragDiv.style.top=realDiv.style.top;
			dragDiv.className = "popupDragging";
			realDiv.parentElement.appendChild(dragDiv);
			
			var tl=parseInt(dragDiv.style.left);
			var tt=parseInt(dragDiv.style.top);
			if(isNaN(tl))
			{
				dragXoffset=e.clientX;
			}
			else
			{
				dragXoffset=e.clientX-tl;
			}
			if(isNaN(tt))
			{
				dragYoffset=e.clientY;
			}
			else
			{
				dragYoffset=e.clientY-tt;
			}

			var oldmousemove = document.onmousemove;
			var oldmouseup   = document.onmouseup;
						
			document.onmousemove=function(e)
			{
				if(e==null){e=window.event}
				if(e.button<=1 && dragOK)
				{
					dragDiv.style.left=e.clientX-dragXoffset+'px';
					dragDiv.style.top=e.clientY-dragYoffset+'px';
					return false;
				}
			};
			
			document.onmouseup=function(e)
			{
				if (e == null) { e = window.event;} 
				document.onmousemove=oldmousemove;
				document.onmouseup=oldmouseup;
				dragOK=false;
				
				realDiv.style.left=e.clientX-dragXoffset+'px';
				realDiv.style.top=e.clientY-dragYoffset+'px';
				
				dragDiv.parentElement.removeChild(dragDiv);
			};
			
			return false;
		}
	}
	function GetElement(tagName, className)
	{
		var list = Popup.all.tags(tagName);
		count = list.length;
		for (var i = 0; i < count; i++)
		{
			if (list[i].className == className)
				return list[i];
		}		
	}	
	function SetDivTop(div)
	{
		var index = div.style.zIndex;
		if (index <= PopupWindow.prototype.TopIndex)
			div.style.zIndex = ++PopupWindow.prototype.TopIndex;
	}
	function GetCaption() {return GetElement("dt", "popupWindowCaption popupDraggable");}
	function GetClient() {return GetElement("dd", "popupWindowContent");}

	PopupWindow.prototype.GetPopupWindow = function(ob)
	{
		for (; ob && ob != document.body; ob = ob.parentElement)
		{
			if (ob.className == "popupWindow" || ob.className.indexOf("popupWindow ") == 0)
				return ob;
		}
		
		return null;
	}

	if (PopupWindow.prototype.TopIndex == null)
		PopupWindow.prototype.TopIndex = 100;

	var RestoreHeight = 0;
	var InsertParent;
	var InsertAfter;
	var Popup;
	
	if (url == null)
		url = "../images/";
	
	Popup = document.createElement('div');
	Popup.className = size ? "popupWindow " + size : "popupWindow";
	Popup.innerHTML = ''
				+ '<DL>'
				+ '	<DT class="popupWindowCaption popupDraggable">'
				+ '		<SPAN>'
				+ '			<IMG class="minimize" alt="minimize" src="' + url + 'popupMin.gif"' + (min ? "" : ' style="display:none"') + '>'
				+ '			<IMG class="close" alt="close" src="' + url + 'popupClose.gif">'
				+ '		</SPAN>'
				+ '		<STRONG>' + (title ? title : "提示框") + '</STRONG> '
				+ '	</DT>'
				+ '	<DD class="popupWindowContent"></DD>'
				+ '</DL>';
	document.body.appendChild(Popup);
	Popup.Popup = this;

	SetToMiddle();
	
	GetElement("img", "minimize").onclick = Minimize;
	GetElement("img", "close").onclick = this.Close;
	GetCaption().onmousedown = DragHandler;
	
	var popup = this.GetPopupWindow(Content);
	if (popup)
		popup.Popup.Close();
	
	InsertParent = Content.parentElement;
	InsertBefore = Content.nextSibling;
	GetClient().appendChild(Content);
	Content.style.display = "block";
}

function ClosePopupWindow(ob, ret)
{
	var popup = null;
	if (PopupWindow.prototype.GetPopupWindow)
		popup = PopupWindow.prototype.GetPopupWindow(ob);
	if (popup)
		popup.Popup.Close(ret);
}

function SubmitPopup(ob, action)
{
	if (action != null)
	{
		for (var parent = ob; parent && parent != document.body; parent = parent.parentElement)
		{
			if (parent.tagName.toLowerCase() == "form")
			{
				parent.action = action;
				break;
			}
		}
	}
	else
	{
		var list = ob.all;
		var count = list.length;
		
		for (var i = 0; i < count; i++)
		{
			if (list[i].name != null && list[i].name != "")
				list[i].value = "";
		}
	}
}
