document.write("<div id='ThinkAjaxResult' class='ThinkAjax' ></div>");
var m = {
	'\b': '\\b',
	'\t': '\\t',
	'\n': '\\n',
	'\f': '\\f',
	'\r': '\\r'
};
var ThinkAjax = {
	method:'POST',
	bComplete:false,
	updateTip:'数据处理中～',
	image:['','',''], 
	status:0, 
	info:'',
	data:'',
	intval:0,
	options:{},
	debug:false,
	activeRequestCount:0,
	getTransport: function() {
		return Try.these(
		 function() {return new XMLHttpRequest()},
		  function() {return new ActiveXObject('Msxml2.XMLHTTP')},
		  function() {return new ActiveXObject('Microsoft.XMLHTTP')}
		 
		) || false;
	},
	loading:function (target,tips){
		if ($(target))
		{
		}
	},

	ajaxResponse:function(request,target,response){
		var str	=	request.responseText;
		str  = str.replace(/([\x00-\x1f\\"])/g, function (a, b) {
                    var c = m[b];
                    if (c) {
                        return c;
                    }else{
						return b;
					}
                     }) ;
		if (this.debug)
		{
			alert(str);
		}		
		$return =  eval('(' + str + ')');
		this.status = $return.status;
		this.info	 =	 $return.info;
		this.data = $return.data;
		if (response == undefined)
		{
			try	{(ajaxReturn).apply(this,[this.data,this.status,this.info]);}
			catch (e){}
			 
		}else {
			try	{ (response).apply(this,[this.data,this.status,this.info]);}
			catch (e){}
		}
	},
	send:function(url,pars,response,target)
	{
		var xmlhttp = this.getTransport();
		url = (url == undefined)?this.options['url']:url;
		pars = (pars == undefined)?this.options['var']:pars;
		if (target == undefined)	{
			target = (this.options['target'])?this.options['target']:this.tipTarget;
		}
		this.activeRequestCount++;
		this.bComplete = false;
		try {
			if (this.method == "GET")
			{
				xmlhttp.open(this.method, url+"?"+pars, true);
				pars = "";
			}
			else
			{
				xmlhttp.open(this.method, url, true);
				xmlhttp.setRequestHeader("Method", "POST "+url+" HTTP/1.1");
				xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			}
			var _self = this;
			xmlhttp.onreadystatechange = function (){
				if (xmlhttp.readyState == 4 ){
					if( xmlhttp.status == 200 && !_self.bComplete)
					{
						_self.bComplete = true;
						_self.activeRequestCount--;
						_self.ajaxResponse(xmlhttp,target,response);
					}
				}
			}
			xmlhttp.send(pars);
		}
		catch(z) { return false; }
	},
	sendForm:function(formId,url,response,target)
	{
		vars = Form.serialize(formId);
		this.send(url,vars,response,target);
	},
	bind:function(source,event,url,vars,response,target)
	{
		var _self = this;
	   $(source).addEvent(event,function (){_self.send(url,vars,response,target)});
	},
	load:function(url,vars,response,target)
	{
		var _self = this;
	   window.addEvent('load',function (){_self.send(url,vars,response,target)});
	},
	time:function(url,vars,time,response,target)
	{
		var _self = this;
		myTimer =  window.setTimeout(function (){_self.send(url,vars,response,target)},time);
	},
	repeat:function(url,vars,intervals,response,target)
	{
		var _self = this;
		_self.send(url,vars,response,target,effect);
		myTimer = window.setInterval(function (){_self.send(url,vars,response,target)},intervals);
	}
};
function isIE(number){
	if(typeof(number)!=number){
		return !!document.all;
	}else {
	}
}
String.prototype.ByteCount = function()
{
	txt = this.replace(/(<.*?>)/ig,'');
	txt = txt.replace(/([\u0391-\uFFE5])/ig, '11');
	var count = txt.length;
	return count;
}
Object.extend=function (destination,source){
	for(var property in source){
		destination[property]=source[property];
	}
	return destination;
}

Object.extend(Array.prototype,{
_each:function (iterator){
	for(var i=0;i<this.length;i++)
	iterator(this[i]);
},clear:function (){
	this.length=0;
	return this;
	
},first:function (){
	return this[0];
	
},last:function (){
	return this[this.length-1];
	
},compact:function (){
	return this.select(function (value){
		return value!=undefined||value!=null;
		
	});
	
},flatten:function (){
	return this.inject([],function (array,value){
		return array.concat(value&&value.constructor ==Array?value.flatten():[value]);
		
	});
	
},without:function (){
	var values=$A(arguments);
	return this.select(function (value){
		return !values.include(value);
		
	});
	
},indexOf:function (object){
	for(var i=0;i<this.length;i++)
	if(this[i]==object)return i;return -1;
},reverse:function (inline){
	return (inline!==false?this:this.toArray())._reverse();
	
},reduce:function (){
	return this.length>1?this:this[0];
	
},uniq:function (){
	return this.inject([],function (array,value){
		return array.include(value)?array:array.concat([value]);
		
	});
	
},inspect:function (){
	return '['+this.map(Object.inspect).join(', ')+']';
	
}
});

function $(){
var results=[],element;
for(var i=0;i<arguments.length;i++){
	element=arguments[i];
	if(typeof(element)=='string')
	element=document.getElementById(element);
	results.push(element);
}
return results.reduce();
}

function Dom(){

}Dom.setOpacity=function (element,value){
element=$(element);
if(isIE()){
	element.style.filter='Alpha(Opacity='+value+');';
	
}else {
	element.style.MozOpacity=value/100;
	
}
};
Dom.getOpacity=function (element){
element=$(element);
if(isIE()){
	var str=element.style.filter;
	if(typeof(str)!="string"||str.length==0){
		return 100;
		
	}else {
		str=str.substring(str.indexOf("=")+1,str.lastIndexOf(")"));
		return parseInt(str);
		
	}
}else {
	var str=element.style.MozOpacity;
	if(typeof(str)!="string"||str.length==0){
		return 100;
		
	}else {
		return parseFloat(str)*100;
		
	}
}
};
Dom.setDisplay=function (element,isDisplay){
element=$(element);
element.style.display=isDisplay?"":"none";

};
Dom.getDisplay=function (element){
element=$(element);
return (element.style.display!="none");

};
Dom.getClientPos=function (element){
element=$(element);
var pos={
	left:element.clientLeft,top:element.clientTop
}
return pos;

}
Dom.getOffsetPos=function (element){
element=$(element);
var pos={
	left:0,top:0
};
if(element==document){
	pos.left=document.documentElement.scrollLeft;
	pos.top=document.documentElement.scrollTop;
	
}else {
	pos.left=element.offsetLeft;
	pos.top=element.offsetTop;
	
}
return pos;

};
Dom.getPos=function (element,isAlert){
element=$(element);
var pos=Dom.getOffsetPos(element);
while(element=element.offsetParent){
	var tempPos=Dom.getOffsetPos(element);
	pos.left+=tempPos.left;
	pos.top+=tempPos.top;
	
}
return pos;

};
Dom.setPos=function (element,pos){
element.style.left=pos.left+"px";
element.style.top=pos.top+"px";

}
Dom.getScrollPos=function (element){
element=$(element);
var pos={
	left:element.scrollLeft,top:element.scrollTop
}
return wh;

}
Dom.getScrollWH=function (element){
element=$(element);
var wh={
	width:element.scrollWidth,height:element.scrollHeight
}
return wh;

}
Dom.getClientWH=function (element){
element=$(element);
var wh={
	width:0,height:0
};
if(element==document)element=document.documentElement;
if(element==document.body&&!isIE()){
	element=document.documentElement;
	wh.width=element.scrollWidth;
	wh.height=element.scrollHeight;
	
}else {
	wh.width=element.clientWidth;
	wh.height=element.clientHeight;
	
}
return wh;

};
Dom.getHeight=function (element){
element=$(element);
var height=0;
if(element.style.display=="none"){
	Dom.setOpacity(element,0);
	Dom.setDisplay(element,true);
	height=element.offsetHeight;
	Dom.setDisplay(element,false);
	Dom.setOpacity(element,100);
	
}else {
	height=element.offsetHeight;
	
}
return height;

}
Dom.getWH=function (element){
element=$(element);
var wh={
	width:0,height:0
};
if(element==document){
	if(isIE()){
		wh.width=document.documentElement.offsetWidth;
		wh.height=document.documentElement.offsetHeight;
		
	}else {
		wh.width=window.innerWidth;
		wh.height=window.innerHeight;
		
	}
}else {
	if(element==document.body&&!isIE()){
		wh.width=document.documentElement.scrollWidth;
		wh.height=document.documentElement.scrollHeight;
		
	}else {
		if(element.style.display=="none"){
			Dom.setOpacity(element,0);
			Dom.setDisplay(element,true);
			wh.width=element.offsetWidth;
			wh.height=element.offsetHeight;
			Dom.setDisplay(element,false);
			Dom.setOpacity(element,100);
			
		}else {
			wh.width=element.offsetWidth;
			wh.height=element.offsetHeight;
			
		}
	}
}
return wh;

};
Dom.getRect=function (element,isAlert){
element=$(element);
var rect=Dom.getPos(element,isAlert);
var wh=Dom.getWH(element);
rect.width=wh.width;
rect.height=wh.height;
rect.right=rect.left+rect.width;
rect.bottom=rect.top+rect.height;
return rect;

}
Dom.getOffsetRect=function (element){
var rect=Dom.getOffsetPos(element);
var wh=Dom.getWH(element);
rect.width=wh.width;
rect.height=wh.height;
rect.right=rect.left+wh.width;
rect.bottom=rect.top+wh.height;
return rect;

}
Dom.getClientRect=function (element){
var rect=Dom.getClientPos(element);
var wh=Dom.getClientWH(element);
rect.width=wh.width;
rect.height=wh.height;
rect.right=rect.left+rect.width;
rect.bottom=rect.top+rect.height;
return rect;

}
Dom.remove=function (element){
if($(element).parentNode){
	$(element).parentNode.removeChild($(element));
	
}
}
Dom.setHeight=function (element,height){
$(element).style.height=height+"px";

}
Dom.visible=function (element){
return $(element).style.display!='none';

}
Dom.toggle=function (element,type){
element=$(element);
Dom[Dom.visible(element)?'hide':'show'](element,type);
return element;

}
Dom.show=function (element,type){
$(element).style.display=(type?type:"");
return element;

}
Dom.hide=function (element){
$(element).style.display='none';
return element;

}
Dom.getChildElementByTagName=function (element,tagName){
element=$(element);
var ln=element.childNodes.length;
var arr=[];
for(var i=0;i<ln;i++){
	if(element.childNodes[i].nodeName.toLowerCase()==tagName){
		arr.push(element.childNodes[i]);
		
	}
}
return arr;

}
Dom.setHeight=function (element,value){
element.style.height=value+"px";

}
Dom.setWidth=function (element,value){
element.style.width=value+"px";

}
Dom.setLeft=function (element,value){
element.style.left=value+"px";

}
Dom.setTop=function (element,value){
element.style.top=value+"px";

}


function Role(){
	
};
Role.status=null;
Role.regsdom="";
Role.mverdom="";
Role.answer="";
Role.guess="";
Role.ask="";
Role.showCoverLogin=function (context){
			ClickEvent("Role.showCoverLogin");
			var wh=Dom.getClientWH(document);
			var bodyRect=Dom.getClientRect(document.body);
			var bgHeight=(bodyRect.height>=wh.height)?bodyRect.height:wh.height;
			var iCover=document.createElement("iframe");
			iCover.style.cssText='border:0px;position:absolute;display:none;left:0px;top:0px;width:'+bodyRect.width+'px;height:'+bgHeight+'px;z-index:10000;';
			iCover.frameBorder=0;
			iCover=document.body.appendChild(iCover);
			Role.iCover=iCover;
			var cover=document.createElement("div");
			cover.style.cssText='position:absolute;display:none;background-color:#333;left:0px;top:0px;width:'+bodyRect.width+'px;height:'+bgHeight+'px;z-index:10001;';
			cover=document.body.appendChild(cover);
			Role.cover=cover;
			var loginDiv=document.createElement("div");
			loginDiv.style.cssText='position:absolute;display:none;z-index:10002;width:300px;';
			loginDiv.innerHTML='<div style="position:absolute;right:10px; top:7px;text-align:right;width:30px;  background:#fff;"><a href="#" target="_blank" onclick="Role.hideCoverLogin();return false;">关闭</a></div><div></div>';
			loginDiv=document.body.appendChild(loginDiv);
			Role.loginDiv=loginDiv;
			loginDiv.childNodes[1].innerHTML=Role[context];
			var docPos=Dom.getPos(document);
			var rect=Dom.getRect(loginDiv);
			var pos={
				left:((wh.width-rect.width)/2)+docPos.left,top:((wh.height-rect.height)/2)+docPos.top
			}
			Dom.setPos(loginDiv,pos);
			Dom.setOpacity(iCover,0);
			Dom.setOpacity(cover,70);
			Dom.show(iCover);
			Dom.show(cover);
			Dom.show(loginDiv);
}

Role.hideCoverLogin=function (){
	if(Role.loginDiv)Dom.remove(Role.loginDiv);
	if(Role.cover)Dom.remove(Role.cover);
	if(Role.iCover)Dom.remove(Role.iCover);
	
}

Role.init=function (){
	Role.regsdom=$('regsdom').innerHTML;
	Role.mverdom=$('mverdom').innerHTML;
	Role.ask=$('askdom').innerHTML;
	Dom.remove($('regsdom'));
	Dom.remove($('mverdom'));
	Dom.remove($('askdom'));
}
Role.ginit=function (){
	Role.answer=$('answer').innerHTML;
	Role.guess=$('guess').innerHTML;
	Dom.remove($('answer'));
	Dom.remove($('guess'));
}
var message={
"idinfo":"提示:用户名长度为4-16位，仅限小写字母，数字，横线，下划线，必须以小写字母开头。",
"pwdinfo":"提示:密码长度为6-16位，仅限字母、数字以及-和_,字母区分大小写。"
}

function infoShow(i){
	$("ajaxinfo").innerHTML= message[i];
}

function isLong(s){
	return s.ByteCount()>30;
}
function isLong2(s){
	return s.ByteCount()>100;
}

function isId(s){
	return /^[a-z][a-z0-9_-]{3,15}$/.test(s);
}

function isEmail(s){
	return s.search(/^\s*[\w\~\-\.]+\@[\w\~\-]+(\.[\w\~\-]+)+\s*$/g) >= 0;
}

function isPhone(s){
	return s.search(/^((\(\d{2,3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}(\-\d{1,4})?$/) >=0;
}

//是否是手机号码
function isMobile(s){
	return /^(13|15)\d{9}$/.test(s);
}

//是否是一个数字
function isNumber(s){
	return /^\d+$/.test(s);
}

//验证身份证 
function isIdcard(s){
   var  s1=/^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$/; 
   var  s2=/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])(\d{3}(\d|x|X))$/; 
  if (s1.test(s)||s2.test(s)) return true; 
}

function CheckForm(i,formname){
	var CheckForm = $(formname);
	if(i&&i=='mver'){
	if(CheckForm.userid.value==""||CheckForm.userid.value==null){
		alert("用户名不能为空！");
		CheckForm.userid.focus();
		return false;
	}
	if(CheckForm.passwd.value==""||CheckForm.passwd.value==null){
		alert("密码不能为空！");
		CheckForm.passwd.focus();
		return false;
	}else{
		if(CheckForm.passwd2.value==""||CheckForm.passwd2.value==null){
		alert("确认密码不能为空！");
		CheckForm.passwd2.focus();
		return false;
		}
		else
		{
			if(CheckForm.passwd.value!=CheckForm.passwd2.value)
			{
				alert("初始密码和确认密码不同，请重新输入。");
				CheckForm.passwd2.focus();
				return false;
			}
			var regexp =/^[a-zA-Z0-9_-]{6,16}/g;
			if(!regexp.test(CheckForm.passwd.value))
			{
				alert("密码含有特殊字符，不符合要求。");
				CheckForm.passwd.focus();
				return false;
			}
		}
	}}


	if(CheckForm.name.value==""||CheckForm.name.value==null){
		alert("姓名不能为空！");
		CheckForm.name.focus();
		return false;
	}else{
		if(isLong(CheckForm.name.value)){
		alert('输入字符串过长！');
		CheckForm.name.focus();
		return false;
		}
	}
	
	if(CheckForm.career.value==""||CheckForm.name.value==null){
		alert("邮寄地址不能为空！");
		CheckForm.name.focus();
		return false;
	}else{
		if(isLong2(CheckForm.name.value)){
		alert('输入字符串过长！');
		CheckForm.name.focus();
		return false;
		}
	}

	if(CheckForm.phone.value==""||CheckForm.phone.value==null){
		alert("电话不能为空！");
		CheckForm.phone.focus();
		return false;
	}else{
		if(!isMobile(CheckForm.phone.value)&&!isPhone(CheckForm.phone.value)){
		alert('电话格式不正确！');
		CheckForm.phone.focus();
		return false;
		}
	}

	if(CheckForm.email.value==""||CheckForm.email.value==null){
		alert("邮箱不能为空！");
		CheckForm.email.focus();
		return false;
	}else{
		if(!isEmail(CheckForm.email.value)){
		alert('邮箱格式不正确！');
		CheckForm.email.focus();
		return false;
		}
	}

	if(CheckForm.age.value==""||CheckForm.age.value==null){
		alert("年龄不能为空！");
		CheckForm.age.focus();
		return false;
	}else{
		if(!isNumber(CheckForm.age.value)){
		alert('年龄格式不正确！');
		CheckForm.age.focus();
		return false;
		}
	}
	if(CheckForm.idcard.value==""||CheckForm.idcard.value==null){
	}else{
		if(!isIdcard(CheckForm.idcard.value)){
		alert("身份证信息不正确！");
		CheckForm.idcard.focus();
		return false;}
	}
	

	if(CheckForm.verify.value==""||CheckForm.verify.value==null){
		alert("校验码不能为空！");
		CheckForm.verify.focus();
		return false;
	}
	
	return true;
}


function Page(){
};

Page.vo={"ac":"0","vcr":"0","pcr":"0","od":"0","it":"","st":"","pv":"0","en":"1"};
Page.complete = function(data,status){
	if (status==1)
		{	
			if(data.change==0){return;}
			for(sdiv in data.show){
				$(sdiv).style.display=data.show[sdiv];
			}
			for(key in data.vo){
				var item=data.vo[key];
					$('usr'+key).innerHTML=item.itfrom.split('@')[0];
					$('vot'+key).innerHTML=item.vote;
					$('url'+key).title=item.title;
					$('pic'+key).src=item.purl;
					$('url'+key).href=item.href;
					if(item.fid>2){
						$('url'+key).target="_blank";
					}
			}
			Page.vo.vcr=data.param.vcr;
			Page.vo.pcr=data.param.pcr;
		//更新cr
	}else{
			alert("非常抱歉! 服务器繁忙，请您稍后再试。");
		}

}
Page.send = function(){
	var para="";
	for (key in Page.vo)
	{	
		para+=key+"="+Page.vo[key]+"&";
	}
	para+="zn=1";
	ThinkAjax.send(js_APP+'/Showlist/goto',para,Page.complete,'result');
}

Page.change = function(action,type){
	Page.vo.ac=action;
	Page.vo.pv=type;
	Page.send();
}

Page.show = function(it,st){

	Page.vo.ac="1";
	Page.vo.pv="0";
	Page.vo.it=it;
	Page.vo.st=st;
	Page.vo.en="1";
	$('slogo').src='/45nm/Public/image/logo_'+it+'_'+st+'.gif';
	$('slogo').style.display="";
	Page.send();
}
Page.init = function(){
	Page.send();
}
Page.showi = function(it){
	Page.vo.ac="1";
	Page.vo.pv="0";
	Page.vo.it=it;
	Page.vo.st="";
	Page.vo.en="1";
	$('slogo').style.display="none";
	Page.send();
}
Page.showo = function(){
	Page.vo.od="1";
	Page.vo.ac="1";
	Page.vo.pv="0";
	Page.vo.en="1";
	$('changeo').src="/45nm/Public/image/pic0.gif";
	$('changeo').onclick=Page.showd;
	Page.send();
}
Page.showd = function(){
	Page.vo.od="0";
	Page.vo.ac="1";
	Page.vo.pv="0";
	Page.vo.en="1";
	$('changeo').src="/45nm/Public/image/pic.gif";
	$('changeo').onclick=Page.showo;
	Page.send();
}
Page.showvo = function(){
	Page.vo.od="1";
	Page.vo.ac="1";
	Page.vo.pv="2";
	Page.vo.en="2";
	$('changevo').src="/45nm/Public/image/layout_044.jpg";
	$('changevo').onclick=Page.showvd;
	Page.send();
}
Page.showvd = function(){
	Page.vo.od="0";
	Page.vo.ac="1";
	Page.vo.pv="2";
	Page.vo.en="2";
	$('changevo').src="/45nm/Public/image/layout_04.jpg";
	$('changevo').onclick=Page.showvo;
	Page.send();
}