var jslang = {

	'undefinedsource'			: '无效职位, 资源未指定',
	'dataprocessing'			: '数据加载中, 请稍候...',

	'j_notfound'				: '您查询的职位不存在, 或已被删除',
	'j_exprite'					: '您查询的职位招聘已经结束',
	'j_reapply'					: '您已申请过该职位, 请不要重复申请',
	'j_applied'					: '恭喜您! 您的职位已经申请完成',
	'j_iage'					: '您的年龄不符号该职位要求, 暂不能申请该职位',
	'j_isex'					: '您的性别不符合该职位要求, 暂不能申请该职位',
	'j_iedu'					: '您的学历不符合该职位要求, 暂不能申请该职位',
	'j_iexp'					: '您的工作经验不符合该职位要求, 暂不能申请该职位',
	'j_ic'						: '您的图形码不正确, 请检查您的输入\n\n单击图片替换图形码',
	'j_rsms'					: '您还没有选择该职位所需要的简历\n\n至少选择一份简历',
	'j_s_apply'					: '您的申请已经提交, 请等候回应',
	'j_process'					: '正在提交申请, 请稍候...',
	'j_applyer'					: '提交申请',
	'j_f_apply'					: '您可申请的职位已达到最大限额, 暂不能继续申请',
	'j_f_faver'					: '您可收藏的职位已达到最大限额, 请清理您的收藏夹',
	'j_refaver'					: '您已收藏了该职位, 请不要重复收藏',
	'j_s_faver'					: '恭喜您! 您选定的职位已经收藏完成',
	'e_process'					: '正在发送邮件, 请稍候...',
	'e_submiter'				: '提交推荐',
	'e_to'						: '您还没有填写收件人',
	'e_ito'						: '收件人地址不正确, 请检查后再试\n\n如: someone@example.com',
	'e_ic'						: '您的图形码不正确, 请检查您的输入\n\n单击图片替换图形码',
	'e_s'						: '您的推荐已经发送完成',

	'login_uu'					: '您还没有填写您的用户名',
	'login_iu'					: '该用户不存在, 请检查您的输入是否有误',
	'login_up'					: '您还没有填写您的密码',
	'login_ip'					: '您的密码不正确, 请检查\n\n注意: 密码区分大小写',
	'login_uc'					: '您还没有填写图形码',
	'login_ic'					: '您的图形码不正确, 请检查\n\n注意: 单击图片替换图形码'

}
function displayer_object(){
	this.menus = function(id,exts){
		this.menusids = 2;
		for (var i = 1; i <= this.menusids; i++){
			if ($('menunid_' + exts + '_' + i)){
				$('menunid_' + exts + '_' + i).className = i == id ? 't' : 'f';
			}
			if ($('menuwid_' + exts + '_' + i)){
				$('menuwid_' + exts + '_' + i).style.display = i == id ? 'block' : 'none';
			}
		}
	}

	this.delements = new Array();
	this.qelements = new Array();
	this.elementer = function(id){
		this.delements[id] = 'd_switcher_' + id;
		this.qelements[id] = 'q_switcher_' + id;
	}

	this.switcher = function(id,cls){
		if (!id){
			return false;
		}
		this.elementer(id);
		if ($(this.delements[id]) && $(this.qelements[id])){
			if (cls){
				$(this.delements[id]).style.display = 'block';
				$(this.qelements[id]).style.display = 'none';
			}else{
				$(this.delements[id]).style.display = 'none';
				$(this.qelements[id]).style.display = 'block';
			}
			$(this.qelements[id]).innerHTML = '<div class="loading">' + jslang.dataprocessing + '</div>';
			return true;
		}else{
			return false;
		}
	}

	this.apply = function(id){
		if (!id || isNaN(id)){
			alert(jslang.undefinedsource);
			return false;
		}
		if (!this.switcher(id)){
			alert('Template error!');
			return false;
		}
		this.ajaxer(id,'apply');
	}
	this.faver = function(id){
		if (!id || isNaN(id)){
			alert(jslang.undefinedsource);
			return false;
		}
		if (!this.switcher(id)){
			alert('Template error!');
			return false;
		}
		this.ajaxer(id,'faver');
	}
	this.email = function(id){
		if (!id || isNaN(id)){
			alert(jslang.undefinedsource);
			return false;
		}
		if (!this.switcher(id)){
			alert('Template error!');
			return false;
		}
		this.ajaxer(id,'email');
	}
	this.ajaxer = function(id,extent){
		Ajax.xml('display|job|' + extent + '||jid=' + id,this.qelements[id]);
	}

	this.results = function(results,id){
		this.tmpmsg = '';
		this.tmpjav = '';
		switch (results){
			case 'uu'			: this.tmpmsg = jslang.login_uu;		this.tmpjav = 'document.' + id + '.username.focus()';	break;
			case 'iu'			: this.tmpmsg = jslang.login_iu;		this.tmpjav = 'document.' + id + '.username.focus()';	break;
			case 'up'			: this.tmpmsg = jslang.login_up;		this.tmpjav = 'document.' + id + '.password.focus()';	break;
			case 'ip'			: this.tmpmsg = jslang.login_ip;		this.tmpjav = 'document.' + id + '.password.focus()';	break;
			case 'uc'			: this.tmpmsg = jslang.login_uc;		this.tmpjav = 'document.' + id + '.certid.focus()';		break;
			case 'ic'			: this.tmpmsg = jslang.login_ic;		this.tmpjav = 'document.' + id + '.certid.focus()';		break;
			case 'j_notfound'	: this.tmpmsg = jslang.j_notfound;		this.switcher(id,true);									break;
			case 'j_exprite'	: this.tmpmsg = jslang.j_notfound;		this.switcher(id,true);									break;
			case 'j_reapply'	: this.tmpmsg = jslang.j_reapply;		this.switcher(id,true);									break;
			case 'j_applied'	: this.tmpmsg = jslang.j_applied;		this.switcher(id,true);									break;
			case 'j_iage'		: this.tmpmsg = jslang.j_iage;			this.switcher(id,true);									break;
			case 'j_isex'		: this.tmpmsg = jslang.j_isex;			this.switcher(id,true);									break;
			case 'j_iedu'		: this.tmpmsg = jslang.j_iedu;			this.switcher(id,true);									break;
			case 'j_iexp'		: this.tmpmsg = jslang.j_iexp;			this.switcher(id,true);									break;
			case 'j_ic'			: this.tmpmsg = jslang.j_ic;																	break;
			case 'j_rsms'		: this.tmpmsg = jslang.j_rsms;																	break;
			case 'j_s_apply'	: this.tmpmsg = jslang.j_s_apply;		this.switcher(id,true);									break;
			case 'j_f_apply'	: this.tmpmsg = jslang.j_f_apply;		this.switcher(id,true);									break;
			case 'j_f_faver'	: this.tmpmsg = jslang.j_f_faver;		this.switcher(id,true);									break;
			case 'j_refaver'	: this.tmpmsg = jslang.j_refaver;		this.switcher(id,true);									break;
			case 'j_s_faver'	: this.tmpmsg = jslang.j_s_faver;		this.switcher(id,true);									break;

			case 'e_to'			: this.tmpmsg = jslang.e_to;			this.tmpjav = 'document.' + id + '.receiver.focus()';	break;
			case 'e_ito'		: this.tmpmsg = jslang.e_ito;			this.tmpjav = 'document.' + id + '.receiver.focus()';	break;
			case 'e_ic'			: this.tmpmsg = jslang.e_ic;			this.tmpjav = 'document.' + id + '.certid.focus()';		break;
			case 'e_s'			: this.tmpmsg = jslang.e_s;				this.switcher(id,true);									break;

			default				:										this.switcher(id,true);									break;
		}
		if (this.tmpmsg != ''){
			alert(this.tmpmsg + "\t");
		}
		if (this.tmpjav != ''){
			eval(this.tmpjav);
		}
	}

	this.vapply = function(fname,results){
		if (fname){
			var theform = eval('document.' + fname);
		}else{
			var theform = false;
		}
		if (theform){
			if (results){
				if (theform.certid){
					theform.certid.focus();	
				}
				this.results(results,fname);
				theform.Submit.value = jslang.j_applyer;
				theform.Reset.disabled = false;
				theform.Submit.disabled = false;
				theform.ClickBack.disabled = false;
			}else{
				theform.Submit.value = jslang.j_process;
				theform.Reset.disabled = true;
				theform.Submit.disabled = true;
				theform.ClickBack.disabled = true;
			}
		}
	}

	this.vemail = function(fname,results){
		if (fname){
			var theform = eval('document.' + fname);
		}else{
			var theform = false;
		}
		if (theform){
			if (results){
				if (theform.certid){
					theform.certid.focus();	
				}
				this.results(results,fname);
				theform.Submit.value = jslang.e_submiter;
				theform.Reset.disabled = false;
				theform.Submit.disabled = false;
				theform.ClickBack.disabled = false;
			}else{
				if (theform.receiver.value == ''){
					this.results('e_to',fname);
					return false
				}else{
					if (!$(fname + '_subject') || !$(fname + '_message')){
						return false;
					}
					theform.subject.value = $(fname + '_subject').innerHTML;
					theform.message.value = $(fname + '_message').innerHTML;
					theform.Submit.value = jslang.e_process;
					theform.Reset.disabled = true;
					theform.Submit.disabled = true;
					theform.ClickBack.disabled = true;
				}
			}
		}else{
			return false;
		}
	}

	this.vlogin = function(fname,results){
		if (fname){
			var theform = eval('document.' + fname);
		}else{
			var theform = false;
		}
		if (theform){
			if (theform.username.value == ''){
				this.results('uu',fname);
				return false;
			}else if (theform.password.value == ''){
				this.results('up',fname);
				return false;
			}else if (theform.certid && theform.certid.value == ''){
				this.results('ic',fname);
				return false;
			}
		}
	}

	this.loginer = function(id){
		Ajax.xml('display|login|jobcontact|' + id,'loginer_' + id);
	}

	this.location = function(url){
		window.location = url;
	}

	this.muljobs = function(){
		this.inner = '<ol>';
		this.length = this.jobsids.length;
		for (var i = 0; i < this.length; i++){
			var classed = i == 0 ? 't' : 'f';
			this.inner += '<li id="cper' + i + '" class="' + classed + '" onclick="displayer.mujobs_switcher(' + i + ',' + this.length + ')">' + this.jobsids[i] + '</li>';
		}
		this.inner += '</ol>';
		$('cper').innerHTML = this.inner;
	}
	this.mujobs_switcher = function(s,m){
		for (var i = 0; i < m ; i++){
			if (i == s){
				$('cper' + i).className = 't';
				$('wrap' + i).style.display = 'block';
			}else{
				$('cper' + i).className = 'f';
				$('wrap' + i).style.display = 'none';
			}
		}
	}

}
displayer = new displayer_object();
