
<!--
function setInputWarning(obj){
	if(obj.type=="text"){
		obj.style.cssText="background-color:red;";
	}

}
function setOptionFocus(obj1,obj2,bz)
{
	if(typeof(obj1)=="object" && typeof(obj2)=="object")
	{
		switch(bz)
		{
			case "more":				
				if(parseInt(obj1.value)<parseInt(obj2.value))
				{
					obj2.selectedIndex=obj1.selectedIndex;
					return false;	
				}		
				break;
			case "less":				
				if(parseInt(obj1.value)>parseInt(obj2.value))
				{
					obj1.selectedIndex=obj2.selectedIndex;
					
					return false;
				}
				break;	
		}	
	}
}



function openwin_hide(sPath)
{
    window.open(sPath,'welcome','width=10px,height=10px,top=2000px,left=2000px');
}

function mOvr(src,clrOver) 
{
	if (!src.contains(event.fromElement)) 
	{
		src.style.cursor = 'hand'; src.bgColor = clrOver;
	}
}

function mOut(src,clrIn) 
{
	if (!src.contains(event.toElement)) 
	{
		src.style.cursor = 'default'; src.bgColor = clrIn;
	}
}

function openwin(file,width,height)
{
	window.open(file,"_setPartCom","width="+width+",height="+height+", resizable=yes scrollbars=yes");
}



function sel_onchange(main,sub,type,bz)
{
	setSubSelectItem(type,main,sub,bz);
}

function formatSubSelect(type,main,sub)
{
	var itemCount;
	var items = new Array();
	var mainvalue=main.options[main.selectedIndex].value;
	var subvalue=sub.options[sub.selectedIndex].value;
	if(type=='city0')
	{
		sub.length = 0;
		var selected = 0;
		itemCount = cityCount;
		items = citys;
		for (i=0;i < itemCount; i++)
		{
			if (items[i][1] == mainvalue)
			{
				var opt=document.createElement("OPTION");
				opt.text=items[i][2];
				opt.value=items[i][2];
				if(items[i][3] != 1)
				{
					sub.add(opt);
				}
			}
		}
		for (i=0;i < sub.length; i++)
		{
			if(sub.options[i].value == subvalue)
			{
				sub.options[i].selected=true;
			}
		}
	}
	if(type=='city1')
	{
		sub.length = 0;
		var selected = 0;
		itemCount = cityCount;
		items = citys;
		for (i=0;i < itemCount; i++)
		{
			if (items[i][1] == mainvalue)
			{
				var opt=document.createElement("OPTION");
				opt.text=items[i][0];
				opt.value=items[i][2];
				if(items[i][3] != 1 && items[i][0].indexOf("不限")=="-1")
				{
					sub.add(opt);
				}
			}
		}
		for (i=0;i < sub.length; i++)
		{
			if(sub.options[i].value == subvalue)
			{
				sub.options[i].selected=true;
				break;
			}
		}
	}
}

function setSubSelectItem(type,main,sub,bz)
{
	var itemCount;
	var items = new Array();
	var speLoca='0100020005000600';
	var subvalue=main.options[main.selectedIndex].value;    
	var szHref = document.location.href.toUpperCase();
	if(type=='jobcatelog')
	{
		sub.length = 0;
		itemCount = jobCategoryCount;
		items = catelogs;
		var opt=document.createElement("OPTION");
		if((subvalue == '') || (subvalue=='0'))
		{            
			opt.text="不限";
			opt.value="";            
			sub.add(opt);
		}

		for (i=0;i<itemCount; i++)
		{
			if ((items[i][2]).substring(0,2) == subvalue.substring(0,2))
			{
				var opt=document.createElement("OPTION");
				if (bz==1)  opt.text=items[i][1];
				else  opt.text=items[i][0];
				opt.value=items[i][2];					
				sub.add(opt);
			}
		}



	}
	else if(type=='citys_en') 
	{   
		sub.length = 0;
		itemCount = cityCount;
		items = citys;
		var opt=document.createElement("OPTION");
		for (i=0;i < itemCount; i++)
		{
			if (items[i][1] == subvalue)
			{
				var opt=document.createElement("OPTION");
				if (bz==1) opt.text=items[i][4];
				else opt.text=items[i][3];
				opt.value=items[i][2];         
				sub.add(opt);
			}
		}
	}
	else if(type=='citys0')
	{
		sub.length = 0;
		itemCount = cityCount;
		items = citys;
		var opt=document.createElement("OPTION");
		for (i=0;i < itemCount; i++)
		{
			if (items[i][1] == subvalue)
			{
				var opt=document.createElement("OPTION");
				if (bz==1) opt.text=items[i][4];
				else opt.text=items[i][3];
				opt.value=items[i][2];         
				sub.add(opt);
			}
		}
	}
	else if(type=='citys1')

	{
		var bSearch = ((szHref.indexOf('PER_')>-1||szHref.indexOf('GR_')>-1) && (szHref.indexOf('RESUME_SEARCH')>-1) );
		sub.length = 0;
		itemCount = cityCount;
		items = citys;
		var opt=document.createElement("OPTION");
		if((subvalue == ''))
		{            
			opt.text="不限";
			opt.value="";            
			sub.add(opt);
		}
		for (i=0;i < itemCount; i++)
		{
			if (items[i][1] == subvalue)
			{
				var opt=document.createElement("OPTION");
				opt.text=items[i][0];                                       
				opt.value=items[i][2];                   
				if (bSearch) opt.value=items[i][2];
				sub.add(opt);
			}
		}
	}
}

function checkSelectChange(obj1, obj2)
{
	var m=document.thisForm;
	if(typeof(obj1.options[obj1.selectedIndex])=="unknown" ||typeof(obj2.options[obj2.selectedIndex])=="unknown")
	{
		retrun ;
	}
	var idx1 = obj1.selectedIndex;
	var idx2 = obj2.selectedIndex;

	if (idx1 > idx2)
	{
		obj2.selectedIndex = idx1;
	}
}
function checkSelectChangeInt(obj1, obj2)
{
	var m=document.thisForm;
	if(typeof(obj1.options[obj1.selectedIndex])=="unknown" || typeof(obj2.options[obj2.selectedIndex])=="unknown")
	{
		retrun ;
	}
	var idx1 = obj1.selectedIndex;
	var idx2 = obj2.selectedIndex;
	if (parseInt(obj1.value) > parseInt(obj2.value))
	{
		obj2.selectedIndex = idx1;
	}
}

function multiselect_addopt(mainobj,subobj,toobj,type)
{
	var itemtext,itemvalue;   
	if(type=='citys')
	{
		if(subobj.options [subobj.selectedIndex].text.indexOf("不限")>-1)
		{
			itemtext=subobj.options [subobj.selectedIndex].text;
		}
		else
		{
			var text1=mainobj.options [mainobj.selectedIndex].text;
			var text2=subobj.options [subobj.selectedIndex].text.replace("├-","").replace("∟","");
			if(text1!=text2)
			{
				itemtext=text1 + text2;
			}
			else
			{
				itemtext=text1;
			}
		}

		if(itemvalue=mainobj.options[mainobj.selectedIndex].value!=subobj.options[subobj.selectedIndex].value.replace("",""))
		{
		itemvalue=itemvalue=mainobj.options[mainobj.selectedIndex].value+subobj.options[subobj.selectedIndex].value;
		}
		else
		{
			itemvalue=itemvalue=mainobj.options[mainobj.selectedIndex].value;
		}


		var option=document.createElement("OPTION");
		option.text=itemtext;
		option.value=itemvalue;
		if(option.text.indexOf("├-")!="-1")
		{
			option.text=option.text.replace("├-","");
		}
		
		if(option.text.indexOf("-不限")!="-1")
		{
			option.text=option.text.replace("-不限","");
		}
		if(toobj.length==3||toobj.length>3){alert('选择的工作地区不能超过三项.');return;}

		for(i=0;i<toobj.length;i++)
		{
			v=toobj.options[i].value;
			t=toobj.options[i].text;
			if( v==itemvalue){alert('您已经选择该分类.'); return;}
			if ( v=='-1' ||t=="不限") {alert('所选分类与您已经选择的类别有冲突.'); return;}
			if(itemtext=="不限" || option.value=='') { alert('所选分类与您已经选择的类别有冲突.');  return;}

			
			//alert(v);
			if (v.length>3&&v.substring(2,4)=="00")

			{
				//alert(v);
				//alert(itemvalue.substring(0,2));
				if(itemvalue.substring(0,2)==v.substring(0,2) && v.length == 4){alert('所选分类与您已经选择的类别有冲突.'); return;}
			}
			if (itemtext.indexOf("-不限")>-1)
			{
				if(itemvalue.substring(0,2)==v.substring(0,2)){alert('所选分类与您已经选择的类别有冲突.');return;}
			}
			
		}
		
		formatLocationParam(mainobj,subobj,toobj); 
		toobj.add(option);
		setLocation(toobj);
	
	}
	else if(type=='jobcatelog')
	{
		//alert(subobj.options [subobj.selectedIndex].text);
		
		if(subobj.options [subobj.selectedIndex].text.indexOf("不限")>-1)
		{
			itemtext = subobj.options [subobj.selectedIndex].text;
			/*
			if(mainobj.options [mainobj.selectedIndex].text.indexOf("不限")>-1){
				itemtext=mainobj.options [mainobj.selectedIndex].text;
				
			} else {*/
			//itemtext=mainobj.options [mainobj.selectedIndex].text +"-"+ subobj.options [subobj.selectedIndex].text;
				//itemvalue=mainobj.options[mainobj.selectedIndex].value;
			//}
		}
		else
		{
			itemtext=mainobj.options [mainobj.selectedIndex].text +"-"+ subobj.options [subobj.selectedIndex].text;
			//itemvalue=subobj.options[subobj.selectedIndex].value;
		}
		itemvalue=subobj.options[subobj.selectedIndex].value;
		var option=document.createElement("OPTION");
		option.text=itemtext;
		option.value=itemvalue;

		if (toobj.length<3)/**最多只能选择三项*/
		{
			for(i=0;i<toobj.length;i++)
			{
				v=toobj.options[i].value;
				t=toobj.options[i].text;   
				if( (v=="-1")) return; 
				
				if (option.value=='') return;
				if(t=='不限')
				{
					alert('所选分类与您已经选择的类别有冲突!');
					return ;
				}
				if(t=='工作岗位不限'){
					alert('所选分类与您已经选择的类别有冲突!');
					return;
				}
				if(v==itemvalue)
				{
					alert('您已经选择该分类!');  	
					return;
				}
				else
				{
					if (t.indexOf("-不限")>-1)		/**目标的文本带有“不限”*/
					{
						if(itemtext.substring(0,4)==t.substring(0,4))
						{
							alert('所选分类与您已经选择的类别有冲突!');
							return;
						}
					}
					if (itemtext.indexOf("-不限")>-1)	/**源文本带有不限**/
					{
						if(itemtext.substring(0,4)==t.substring(0,4))
						{
							alert('所选分类与您已经选择的类别有冲突.');
							return;
						}
					}
				}
			}
			toobj.add(option);            
			

			var m=document.thisForm;
			var jobFunction=m.jobFunction;
			var jobSel=m.jobcatelog;
			if(typeof(m)=="object" && typeof(jobSel)=="object")
			{
				for(var j=0;j<jobSel.length;j++)
				{
					var intK=parseInt(j+1);
					var jobFunction=eval("m.jobFunction"+intK);
					if(typeof(jobFunction)=="object" && typeof(jobSel.options[j])=="object")
					{
						jobFunction.value=jobSel.options[j].value;
					}
				}
				if(jobSel.length<3)
				{
					m.jobFunction3.value="";
				}
			}
		}
		else
		{
			alert("最多只能选择三个类别!");
			return;	
		}
	}

}


function multiselect_delopt(Object){
    
    var m=document.thisForm;
    var jobFunction=m.jobFunction;
    var jobSel=m.jobcatelog;
    if(typeof(Object.options[Object.selectedIndex])=="unknown"){
        alert("系统提示:请选择您想要移除的资料项!");
        Object.focus();
    }

    if(Object.name=="jobcatelog" && document.location.href.indexOf("member")=="-1"){
        //delJobCategory(Object) ; 
    }
    if(Object.name=="workplace"){
        removeLocationParam(Object) ;
    }
    if(typeof(m)=="object" && Object.name=="jobcatelog"){
        for(var j=1;j<=jobSel.length;j++){
            var jobFunction=eval("m.jobFunction"+j);
            if(typeof(jobFunction)=="object"){
                if(typeof(Object.options[Object.selectedIndex])!="unknown" && jobFunction.value==Object.options[Object.selectedIndex].value){
                   jobFunction.value="";
                   break;
                }
            }
        }
    }
    if(Object.selectedIndex>-1){
        Object.remove(Object.selectedIndex);
    }
    if(Object.name=="workplace"){
        setLocation(Object);
    }

    if(Object.length==0 && Object.name=="jobcatelog"){
        for(var x=1;x<=3;x++){
            var jobFunctions=eval("m.jobFunction"+x);
            jobFunctions.value="";
        }
    }
}

function setLocation(toobj){
            var strLocation="";
            for(var x=0;x<toobj.length;x++){
                strLocation=toobj.options[x].value +";" + strLocation;
            }
            var m=document.thisForm;
            if(typeof(m)=="object"){
                var jobLocation=m.JobLocation;
                if(typeof(jobLocation)=="object"){
                    jobLocation.value=strLocation;
                }
            }
}

function MM_showHideLayers() 
{ 
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) 
	{
		if ((obj=w_findObj(args[i]))!=null) 
		{
			v=args[i+2];
		}
		if (obj.style) 
		{
			obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v;
		}
		obj.visibility=v;
	}
}
function w_findObj(n, d) 
{
	var p,i,x;
	if(!d)
	{
		d=document;
	}
	if((p=n.indexOf("?"))>0&&parent.frames.length) 
	{
		d=parent.frames[n.substring(p+1)].document;
		n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all)
	{
		x=d.all[n];
	}
	for (i=0;!x&&i<d.forms.length;i++)
	{
		x=d.forms[i][n];
	}
	for(i=0;!x&&d.layers&&i<d.layers.length;i++)
	{
		x=w_findObj(n,d.layers[i].document);
	}
	return x;
}
function formatLocationParam(mainobj,subobj,toobj)
{
    var len = toobj.length;
    var m=document.thisForm;
    if (len == 0)
    {
        if(typeof(m)=="object"){
            var p1 = m.jobLocation1_p;
            if(typeof(p1)=="object"){
                p1.value = mainobj.options[mainobj.selectedIndex].value;
            }
            var c1 = m.jobLocation1;
            if(typeof(c1)=="object"){
                c1.value = subobj.options[subobj.selectedIndex].value;
            }
        }
    }
    else if (len == 1)
    {
        if(typeof(m)=="object"){
            var p2 = m.jobLocation2_p;
            if(typeof(p2)=="object"){
                p2.value = mainobj.options[mainobj.selectedIndex].value;
            }
            var c2 = m.jobLocation2;
            if(typeof(c2)=="object"){
                c2.value = subobj.options[subobj.selectedIndex].value;
            }
        }
    }
    else if (len == 2)
    {
        if(typeof(m)=="object"){
            var p3 = m.jobLocation3_p;
            if(typeof(p3)=="object"){
                p3.value = mainobj.options[mainobj.selectedIndex].value;
            }
            var c3 = m.jobLocation3;
            if(typeof(c3)=="object"){
                c3.value = subobj.options[subobj.selectedIndex].value;
            }
        }
    }
}



function removeLocationParam(obj)
{
    var m=document.thisForm;
    if(typeof(obj.options[obj.selectedIndex])=="unknown"){
        return;
    }
    var idx = obj.selectedIndex;
    if (idx == 2)
    {
        if(typeof(m)=="object"){
            var p3 = m.jobLocation3_p;
            if(typeof(p3)=="object"){
                p3.value = '';
            }
            var c3 = m.jobLocation3;
            if(typeof(c3)=="object"){
                c3.value = ''
            }
        }
    }
    else if (idx == 1)
    {
        if(typeof(m)=="object"){
            var p3 = m.jobLocation3_p;
            var p2 = m.jobLocation2_p;
            if(typeof(p3)=="object"){
                if (typeof(p2)=="object") {
                   p2.value = p3.value;
                   p3.value = '';
                }
            }
            var c3 = m.jobLocation3;
            var c2 = m.jobLocation2;
            if(typeof(c3)=="object"){
                if (typeof(c2)=="object") {
                   c2.value = c3.value;
                   c3.value = '';
                }
            }
        }
    }
    else if (idx == 0)
    {
        if(typeof(m)=="object"){
            var p3 = m.jobLocation3_p;
            var p2 = m.jobLocation2_p;
            var p1 = m.jobLocation1_p;
            if(typeof(p3)=="object"){
                if (typeof(p1)=="object") {
                   p1.value = p2.value;
                }
                if (typeof(p2)=="object") {
                   p2.value = p3.value;
                   p3.value = '';
                }
            }
            var c3 = m.jobLocation3;
            var c2 = m.jobLocation2;
            var c1 = m.jobLocation1;
            if(typeof(c3)=="object"){
                if (typeof(c1)=="object") {
                   c1.value = c2.value;
                }
                if (typeof(c2)=="object") {
                   c2.value = c3.value;
                   c3.value = '';
                }
            }
        }
    } 

}
function form_onkeydown(obj)
{
	if(window.event.keyCode==13 && typeof(obj)=="object")
	{
		obj.focus();
	}
}
function setCookie(name,value){
    document.cookie = name + "=" + value + ";path=/";
}
function getCookie (name){
    var strArg = name + "=";
    var nArgLen = strArg.length;
    var nCookieLen = document.cookie.length;
    var nEnd;
    var i=0;
    var j;

    while (i < nCookieLen){
        j = i + nArgLen;
        if(document.cookie.substring(i,j) == strArg){
            nEnd = document.cookie.indexOf(";", j);
            if (nEnd == -1) nEnd = document.cookie.length;
            return document.cookie.substring(j,nEnd);
        }
        i = document.cookie.indexOf(" ", i) + 1;
        if (i == 0) break;
    }
    
    return null;
}
function addOpt(obj,v,t){
    var objOpt = document.createElement("OPTION");
    objOpt.value = v;
    objOpt.text = t;
    obj.add(objOpt);
}


function setSelectFocus(obj, v){
    for(var i = 0; i < obj.length; i++){
        if(v == obj.options[i].value){
            obj.selectedIndex = i;
            return;
        }
    }
}

// 精确查询
function search(id,dateFrom,dateTo){
	var obj = document.thisForm;
	var begainDate = document.getElementById(dateFrom).value;
    var endDate = document.getElementById(dateTo).value;
    var date1 = null;
    var date2 = null;
	
    
    if(!hiddenDiv(id,dateFrom,"日期格式不正确","red")) {
        return;
    }
    
    if(!hiddenDiv(id,dateTo,"日期格式不正确","red")) {
        return;
    }
    
    if(begainDate != "" && endDate != "") {
      
        date1=Date.parse(new Date(begainDate.replace(/-/g,"/")));
        date2=Date.parse(new Date(endDate.replace(/-/g,"/")));
        if(date1-date2 > 0) {
           showFocusMsg(id,"前面的日期需小于后面的日期","red");
           return;
        }
    }
    $("#thisForm").submit();
}

//判断是不是正确的日期
function  isDate(str){   
     var  r  =  str.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/);     
     if(r==null)
         return false; 
      var d =  new Date(r[1],r[3]-1,r[4]);     
     return (d.getFullYear()==r[1]&&(d.getMonth()+1)==r[3]&&d.getDate()==r[4]);   
  }   
  
//清除提示信息
function hiddenDiv(id,date,dateFormat,color){ 
   var tempDate = $("#"+date).val();
   if(tempDate != "" && !isDate(tempDate)) {
        showFocusMsg(id,dateFormat);
        $("#"+id).css("color",color);
        return false
   } else  
	$("#"+id).html("");
	return true;
}
//焦点提示信息
function showFocusMsg(id,msg,color)
{
	$("#"+id).html(msg);
	$("#"+id).css("color",color);
}
//-->
