
function hiddengoods()
{
	document.getElementById("goodscontent").style.display="none";
	document.getElementById("linecontent").style.display="none";
	document.getElementById("jobcontent").style.display="none";
	document.getElementById("hrcontent").style.display="none";
}

function show_div(str)
{
	hiddengoods();
	document.getElementById(str+"content").style.display="block";
	if(str=="goods")
	{
		document.getElementById(str).className="cha01_on";
		document.getElementById("line").className="cha02_off";	
		document.getElementById("job").className="cha02_off";
		document.getElementById("hr").className="cha04_off";
	}
	if(str=="line")
	{
		document.getElementById(str).className="cha02_on";
		document.getElementById("goods").className="cha01_off";	
		document.getElementById("job").className="cha02_off";
		document.getElementById("hr").className="cha04_off";
	}
	if(str=="job")
	{
		document.getElementById(str).className="cha02_on";
		document.getElementById("goods").className="cha01_off";	
		document.getElementById("line").className="cha02_off";
		document.getElementById("hr").className="cha04_off";
	}
	if(str=="hr")
	{
		document.getElementById(str).className="cha04_on";
		document.getElementById("goods").className="cha01_off";	
		document.getElementById("line").className="cha02_off";
		document.getElementById("job").className="cha02_off";
	}
	
}


//加载货源信息
function loadGoodsInfo() {	
	dojo.xhrPost({
	url:'index.selectGoodsInfo.xhtml?goodsInfoView.partId='+partId, 
	handleAs:"text", 
	load:function (text) {
		//$("#loading").hide();
		dojo.byId('hy_content').innerHTML = text;
		//bindToolTips('hy_content','非VIP会员查看详细扣一个积分');//tooltips例子
	}});
}

//加载专线信息
function loadLineInfo() {
	dojo.xhrPost({
	url:'index.selectLineInfo.xhtml?lineInfoView.partId='+partId, 
	handleAs:"text", 
	load:function (text) {
		dojo.byId('lineList').innerHTML = text;
	}});
}
//加载招聘信息
function loadJobInfo() {
	dojo.xhrPost({
	url:'index.selectJobInfo.xhtml?jobInfoView.partId='+partId, 
	handleAs:"text", 
	load:function (text) {
		dojo.byId('jobList').innerHTML = text;
	}});
}

//链接到公司招聘信息详细页面
function viewCompanyJob(code){
	var url = "jobInfo.initCompanyJobDetail.xhtml?selected=job&jobInfoView.userId="+code;
	window.open(url);
}

//链接到单个招聘详细页面
function viewJob(userId,jobId){
	var url = "jobInfo.initJobDetail.xhtml?selected=job&jobInfoView.userId="+userId+"&jobInfoView.selfId="+jobId;
	window.open(url);
}

function returnLogin(){
  var frontUrl = document.URL.substring(document.URL.indexOf("website")-1);
  locationFrontUrl(frontUrl);
}

/*专线详细页面*/
function viewLine(code,rowUserId){

	var frontUrl = document.URL.substring(document.URL.indexOf("website")-1);
	//检查是否登录
	if(!notEmpty(userCode)){
		//locationFrontUrl(frontUrl);
		var url = "lineInfo.select.xhtml?selected=line&processType=view&lineInfoView.selfId="+code+"&lineIndex=Y";
		window.open(url);
	}else{	
		if(rowUserId!=userId){
			if(isVip!='Y'){
				fetchIntegral(			
					function(json){
						if(json.model.userIntegralView.total-1<0){
							nzWindow.confirmInfo({title:'确定对话框',message:'您的积分不足，是否充值？',width:300,height:160,handler:askHandler})
						}else{
							//先扣积分。。。
							integralDeal({type:"14",billId:code});
							
							//转到专线详细页面
							var url = "lineInfo.select.xhtml?selected=line&processType=view&lineInfoView.selfId="+code+"&lineIndex=Y";
							window.open(url);
						}
					}
				);
			}else{
				//转到专线详细页面
				var url = "lineInfo.select.xhtml?selected=line&processType=view&lineInfoView.selfId="+code+"&lineIndex=Y";
				window.open(url);
			}
		}else{
			//转到专线详细页面
			var url = "lineInfo.select.xhtml?selected=line&processType=view&lineInfoView.selfId="+code+"&lineIndex=Y";
			window.open(url);
		}	
	}
}



/*货源详细页面*/
function viewGoods(code,rowUserId,status){

	if(status=='Y'){
		alert('该票货已成交，无法查看！');
		return;
	}

	var frontUrl = document.URL.substring(document.URL.indexOf("website")-1);
	//检查是否登录
	if(!notEmpty(userCode)){
		//locationFrontUrl(frontUrl);
		var url = "goodsInfo.select.xhtml?selected=goods&processType=view&goodsInfoView.selfId="+code;
		window.open(url);
	}else{	
		if(rowUserId!=userId){
			if(isVip!='Y'){
				fetchIntegral(			
					function(json){
						if(json.model.userIntegralView.total-1<0){
							nzWindow.confirmInfo({title:'确定对话框',message:'您的积分不足，是否充值？',width:300,height:160,handler:askHandler})
						}else{
							//先扣积分。。。
							integralDeal({type:"09",billId:code});
							
							//转到货源详细页面
							var url = "goodsInfo.select.xhtml?selected=goods&processType=view&goodsInfoView.selfId="+code;
							window.open(url);
						}
					}			
				);
			}else{
				//转到货源详细页面
				var url = "goodsInfo.select.xhtml?selected=goods&processType=view&goodsInfoView.selfId="+code;
				window.open(url);
			}
		}else{
			//转到货源详细页面
			var url = "goodsInfo.select.xhtml?selected=goods&processType=view&goodsInfoView.selfId="+code;
			window.open(url);	
		}	
	}
}

//加载链接信息
function loadLinkInfo() {
	dojo.xhrPost({
	url:'index.selectLinkInfo.xhtml?linkView.partId='+partId, 
	handleAs:"text", 
	load:function (text) {
		dojo.byId('linklist').innerHTML = text;
	}});
}

//转到货源查询页面。。。
function initGoodsQuery(){
	var beginAddr = dojo.byId("goodsBeginAddress").value;//起始地
	var endAddr = dojo.byId("goodsEndAddress").value;//起始地
	if(beginAddr == '输入起始地')
		beginAddr='';
	if(endAddr == '输入目的地')
		endAddr='';
	var totalCount = dojo.byId("goodsCount").value;//总条数
	var url = "goodsInfo.initQuery.xhtml?selected=goods&totalCount="+totalCount;
	url += encodeURI("&goodsInfoView.beginAddress="+beginAddr+"&goodsInfoView.endAddress="+endAddr);
	location.href = url;
}

//转到专线查询页面。。。
function initLineQuery(){
	var beginAddr = dojo.byId("lineBeginAddress").value;//起始地
	var endAddr = dojo.byId("lineEndAddress").value;//目的地
	if(beginAddr == '输入起始地')
		beginAddr='';
	if(endAddr == '输入目的地')
		endAddr='';
	var totalCount = dojo.byId("lineCount").value;//总条数
	var url = "lineInfo.initQuery.xhtml?processType=lineIndex&selected=line&totalCount="+totalCount;
	url += encodeURI("&lineInfoView.beginAddress="+beginAddr+"&lineInfoView.endAddress="+endAddr);
	location.href = url;
}

//转到招聘信息查询页面。。。
function initJobQuery(){
	var jobType = dojo.byId("udf3").value;//岗位类别	
	var jobArea = dojo.byId("jobArea").value;//区域	
	if(jobType == '输入岗位')
		jobType='';
	if(jobArea == '输入地区')
		jobArea='';
	var url = "jobInfo.initQuery.xhtml?selected=job";
	url += encodeURI("&jobInfoView.udf3="+jobType+"&jobInfoView.jobArea="+jobArea);
	location.href = url;
}
//转到求职信息查询页面。。。
function initResumeQuery(){
	var specialty = dojo.byId("specialty").value;//专业
	var needArea = dojo.byId("needArea").value;//区域	
	if(specialty == '输入专业')
		specialty='';
	if(needArea == '输入地区')
		needArea='';
	var url = "resumeInfo.initQuery.xhtml?selected=job";
	url += encodeURI("&resumeInfoView.specialty="+specialty+"&resumeInfoView.needArea="+needArea);
	location.href = url;
}

//转到新闻列表页面
function initQueryNews(typeId){
	var url = "newsInfo.initQuery.xhtml?newsInfoView.typeId="+typeId;
	window.open(url);
}

//转到图片新闻页面。。。
function initPhotoNews(){
	var url = "newsInfo.initPhotoNews.xhtml?newsInfoView.typeId=003001";
	window.open(url);
}

//dojo.addOnLoad(loadGoodsInfo);//加载货源信息
//dojo.addOnLoad(loadLineInfo);//加载专线信息
//dojo.addOnLoad(loadJobInfo);//加载招聘信息
//dojo.addOnLoad(loadLinkInfo);//加载链接信息
dojo.addOnLoad(function(){loadCommonInfo("common.goGoodsHelpList.xhtml?newsInfoView.endNum=6","goodsHelp")});//加载公共的货源帮助信息
dojo.addOnLoad(function(){loadCommonInfo("common.goLineHelpList.xhtml?newsInfoView.endNum=6","lineHelp")});//加载公共的物流专线帮助
dojo.addOnLoad(function(){loadCommonInfo("common.goPersonHelpList.xhtml?newsInfoView.endNum=6","personHelp");});//加载公共的人才帮助信息
//dojo.addOnLoad(function(){loadCommonInfo("common.goJobSkillList.xhtml?newsInfoView.endNum=6","jobSkillList");});//加载求职技巧
//dojo.addOnLoad(function(){loadCommonInfo("common.goHrPartList.xhtml?newsInfoView.endNum=6","hrPartList");});//加载HR专区

dojo.connect(dojo.byId("searchGoodsBtn"),"onclick","initGoodsQuery");
dojo.connect(dojo.byId("searchLineBtn"),"onclick","initLineQuery");
dojo.connect(dojo.byId("searchJobBtn"),"onclick","initJobQuery");
dojo.connect(dojo.byId("searchResumeBtn"),"onclick","initResumeQuery");
