﻿// JScript 文件


//CheckBox是否重新上传图片
function ReUploadCheckBox(_CheckBox_Name,_ContorName)
{
    var chk_name=document.getElementById(_CheckBox_Name);
    var con_name=document.getElementById(_ContorName);
    if(chk_name.checked==true)
    {
        con_name.disabled=false;
    }
    else
    {
        con_name.disabled=true;
    }
}

function checkLogin()
{
    var va=document.form1
    if(va.txtUserName.value.length<6 || va.txtUserName.value.charAt("0")==" ")
    {
        alert("[提示]请正确输入登录用户名");
        va.txtUserName.focus();
        return false;
    }
    if(va.txtPwd.value.length<6 || va.txtPwd.value.charAt("0")==" ")
    {
        alert("[提示]请正确输入登录密码");
        va.txtPwd.focus();
        return false;
    }
}

//网站TOP快速搜索
function Top_Quick_Search()
{
    _va=document.form1
    var t_Area=form1.t_Area.value.replace("请选择期望工作地区","").split(",");
    if(t_Area.length>1)
    {
        Area=t_Area[1];
    }
    else
    {
        Area=t_Area[0];
    }
    var t_KeyWord=form1.t_KeyWord.value.replace("请输入要搜索的职位/公司名称关键字","");
    window.open("/Person/Search_Company_JobsNew.aspx?KeyWord="+t_KeyWord+"&Area="+Area+"&LongTime=0&Pages=1");
}

//网站TOP快速搜索
function Top_Quick_Search1()
{   
    _va=document.form1
    var t_Area=form1.t_Area.value.replace("工作地区[不限]","").split(",");
    if(t_Area.length>1)
    {
        Area=t_Area[1];
    }
    else
    {
        Area=t_Area[0];
    }
    var t_KeyWord=form1.t_KeyWord.value.replace("职位关键字…","");
    
    var toggle = document.getElementById("button_more_option");	
	
	var height = parseInt(moreOptionCollapse.divObj.style.height);	

    if(height>0)
    {
        var zhiwei=replace(document.getElementById("Position_ID").value);
        var hangye=document.getElementById("Profession_ID").value;
        var shijian=document.getElementById("LongTime").value;
        window.open("/Person/Search_Company_JobsNew.aspx?KeyWord="+t_KeyWord+"&Area="+Area+"&LongTime="+shijian+"&Position_ID="+zhiwei+"&Profession_ID="+hangye+"&Pages=1&count=1");
    }
    else
    {
        window.open("/Person/Search_Company_JobsNew.aspx?KeyWord="+t_KeyWord+"&Area="+Area+"&LongTime=0&Pages=1");
    }
}

//index.aspx网站TOP快速搜索
function Top_Quick_Search2()
{   
    _va=document.form1
    var t_Area=form1.t_Area.value.replace("工作地区[不限]","").split(",");
    if(t_Area.length>1)
    {
        Area=t_Area[1];
    }
    else
    {
        Area=t_Area[0];
    }
    var t_KeyWord=form1.t_KeyWord.value.replace("职位关键字…","");
    
    var toggle = document.getElementById("button_more_option");	
	
	var height = parseInt(moreOptionCollapse.divObj.style.height);	

    if(height>0)
    {
        var zhiwei=replace(document.getElementById("Position_ID").value);
        var hangye=document.getElementById("Profession_ID").value;
        var shijian=document.getElementById("LongTime").value;
        window.open("/Person/Search_Company_JobsNew.aspx?KeyWord="+t_KeyWord+"&Area="+Area+"&LongTime="+shijian+"&Position_ID="+zhiwei+"&Profession_ID="+hangye+"&Pages=1&count=1");
    }
    else
    {
        window.open("/Person/Search_Company_JobsNew.aspx?KeyWord="+t_KeyWord+"&Area="+Area+"&LongTime=0&Pages=1");
    }
}



function replace(str)
{
            if (str != null)
        {
            str = str.split("-")[1];
        }
        return str;
}

//后台会员密码修改---弹出窗口
function winopen_upPass(ID,ParamUrl)
{
    var url=ParamUrl+"?ID="+ID;
    window.open(url,"upPass","width=410,height=160,top=200,left=200");
}


//后台企业会员升级VIP操作－－弹出窗口
function winopen_upCompanyVip(ID,ParamUrl)
{
    var url=ParamUrl+"?ID="+ID;
    window.open(url,"upVip","width=460,height=380,top=200,left=200");
}

//复选框验证
function ValidatorCheckFormAll(string)
{
    var a=0;
    _va = document.form1;
    for(i=0;i<_va.elements.length;i++)
    {
        if(_va.elements[i].type=="checkbox")
        {
            if(_va.elements[i].checked==true)
            {
                a+=1;
            }
        }
    }
    if(a==0)
    {
        alert("请选择要"+string);
        return false;
    }
    else
    {
        document.getElementById("allscreen").style.visibility='inherit';
        document.getElementById("frontloading").style.visibility='inherit';
    }
}

//单选框验证
function ValidatorCheckFormAllRadio(string)
{
    var a=0;
    _va = document.form1;
    for(i=0;i<_va.elements.length;i++)
    {
        if(_va.elements[i].type=="radio")
        {
            if(_va.elements[i].checked==true)
            {
                a+=1;
            }
        }
    }
    if(a==0)
    {
        alert("请选择要"+string);
        return false;
    }
    return true;
}

//查看所选职位
function viewSelectedJobs(stringMsg)
{
    var a=0;
    _va = document.form1;
    for(i=0;i<_va.elements.length;i++)
    {
        if(_va.elements[i].type=="checkbox")
        {
            if(_va.elements[i].checked==true)
            {
                a+=1;
            }
        }
    }
    if(a==0)
    {
        alert("请选择要"+stringMsg);
        return false;
    }
}

//邀请面试
function InviteFace(PerID,ComID)
{
    var url="../Company/Invite.aspx?PerID="+PerID+"&ComID="+ComID;
    window.showModalDialog(url,window,"dialogWidth:50px;dialogHeight:50px;help:no;scroll:no;status:no");
}

//申请、收藏等操作按扭的事件
function JobFun(Param)
{
	var num = 0;
	var Text = "";
	var elem = form1.elements;
	var Url;
	
	for(i=0;i<elem.length;i++)
	{   
	    //判断页面的控件为checkbox控件
		if(elem[i].type=='checkbox' && elem[i].id != 'ChkAll')
		{
			if(elem[i].checked == true)
			{			
				Text += "," + elem[i].value;
				num += 1;
			}
		}		
	}
	
	if( num == 0 )
	{
		if( Param==1 ){ alert("请选择要申请的职位！"); }
		if( Param==2 ){ alert("请选择要收藏的职位！"); }
		
		return false;
	}
	else
	{   
		//申请职位
		if( Param==1 ){ Url = "../Person/AddJobToApply.aspx?BY_JobsID="+ Text.substring(1);}
		
		//收藏职位
		if( Param==2 ){ Url = "../Person/AddJobToFavorite.aspx?BY_JobsID="+ Text.substring(1);}
		
		window.open(Url,'view','width=500,height=220,top=120,left=330,scrollbars=yes');
	}	
}

//邀请面试，加入人才库等操作按扭的事件
function ResumeFun(Param)
{
	var num = 0;
	var Text = "";
	var elem = form1.elements;
	var Url;
	
	for(i=0;i<elem.length;i++)
	{   
	    //判断页面的控件为checkbox控件
		if(elem[i].type=='checkbox' && elem[i].id != 'ChkAll' && elem[i].id != 'Checkbox1')
		{
			if(elem[i].checked == true)
			{			
				Text += "," + elem[i].value;
				num += 1;
			}
		}		
	}
	
	if( num == 0 )
	{
		if( Param==1 ){ alert("请选择要发送邀请面试的简历！"); }
		if( Param==2 ){ alert("请选择要加入人才库的简历！"); }
		
		return false;
	}
	else
	{   
		//邀请面试
		if( Param==1 ){ Url = "../Company/AddResumeToInvite.aspx?BY_Person_ID="+ Text.substring(1);}
		
		//加入人才库
		if( Param==2 ){ Url = "../Company/AddResumeToStore.aspx?BY_Person_ID="+ Text.substring(1);}
		
		window.open(Url);
	}	
}

//投票
function checkVote(ID,top)
{
	var a=0;
    _va = document.form1;
    for(i=0;i<_va.elements.length;i++)
    {
        if(_va.elements[i].type=="radio")
        {
            if(_va.elements[i].checked==true)
            {
                a+=1;
            }
        }
    }
    if(a==2)
    {
        alert("请选择要投票项目");
        return false;
    }
	else
	{
		window.open("about:blank","vote","width=550,height=350,top=100,left=200");
		form1.action="/include/VoteView.aspx?Add=true&top="+top+"&ID="+ID;
		form1.target="vote";
	}
}

function OpenVote(ID,top)
{
	window.open("/include/VoteView.aspx?top="+top+"&ID="+ID,"vote","width=550,height=350,top=100,left=200");
}
