// for ACP JOB portal
function changeIdValue(Id,Value){
	var obj=document.getElementById(Id);
	obj.value=Value;
}
function changeIdClass(Id,Class){
	var obj=document.getElementById(Id);
	obj.className=Class;
}
//
function showObjId(Id){
	var obj=document.getElementById(Id);
	obj.style.display='block';
}
function hideObjId(Id){
	var obj=document.getElementById(Id);
	obj.style.display='none';
}



// image size control for UBB
function ubb_img_resize(imgobj,size){
    if ( imgobj.width > size ){
		imgobj.style.width=size+'px';
	}	
}


//hp_sort_btn
function ChangeSortTab(Name){
	
	changeIdClass( "hp_sort_btn_category","normal" );
	changeIdClass( "hp_sort_btn_speciality","normal" );
	changeIdClass( "hp_sort_btn_price","normal" );
	
	changeIdClass( "hp_sort_btn_"+Name,"select" );
	
	hideObjId('hp_sort_list_category');
	hideObjId('hp_sort_list_speciality');
	hideObjId('hp_sort_list_price');

	showObjId('hp_sort_list_'+Name);
	
}

//change img src
function ChangeImgSrc(Obj,PicURL){
	Obj.src=PicURL;
}




//getElementById简写
function geid(id){
	return document.getElementById(id);
}

//根据id获取其值
function gvid(id){
	return document.getElementById(id).value;
}

//根据id设置其值
function svid(id,value){
	document.getElementById(id).value=value;
}

//跳转到URL getURL
function gurl(URL,newWindow){
	URL=URL?URL:'';
	newWindow=newWindow?newWindow:false;
	if ( URL!='' ){
		if ( newWindow ){
			window.open(URL);
		}else{
			window.location.href=URL;
		}
	}
}

//关闭窗口
function close_win()   
{
	window.opener=null;  
	window.open("","_self");
	window.close();
	setTimeout(function(){alert("尝试关闭窗口超时，您的浏览器可能不支持脚本关闭窗口，请直接关闭网页窗口。\n如果您使用的是Firefox浏览器，请设置允许脚本关闭窗口。")},1000);
}

//以post方式提交obj
function post_obj( obj,action ){
	if ( !action ){
		action='';
	}
	var form_obj=document.createElement( 'FORM' );
	document.body.appendChild(form_obj);
	form_obj.action=action;
	form_obj.method='post';
	var input_obj;
	for( var i in obj ){
		//alert(i + ':' + obj[i]);
		input_obj=document.createElement( 'INPUT' );
		input_obj.type='hidden';
		form_obj.appendChild(input_obj);
		input_obj.name=i;
		input_obj.value=obj[i];
	}
	form_obj.submit();
}

//重置表单
function form_reset( id ){
	var form_obj=geid(id);
	form_obj.reset();
}

//提交表单
function form_submit( id ){
	var form_obj=geid(id);	
	form_obj.submit();
}


