function roll(img,ref) {document.images[img].src=ref;}
var img=new Array();
function PreloadImages() {for(i=0; i<arguments.length; i++) {img[i]=new Image();img[i].src=arguments[i];}};
PreloadImages(
'/client/scin/orange/img/detail_a.gif',
'/client/scin/orange/img/dot_yellow.gif',
'/client/scin/orange/img/loading.gif'
);
function ml(obj){
	var nested=document.getElementById(obj.id+"_sub");
	if(nested.style.display=='none'){nested.style.display='block';}
	else{nested.style.display='none';}	
}
function mld(){
	document.getElementById('ml_sj').href='javascript:void(0)';
	document.getElementById('ml_sp').href='javascript:void(0)';
	if (document.getElementById('ml_mo')) {document.getElementById('ml_mo').href='javascript:void(0)';}
}
function mldn(oid){
	if (document.getElementById(oid)) {document.getElementById(oid).href='javascript:void(0)';}
}
function dn(field) {
	if (document.getElementById(field)) document.getElementById(field).style.display="none";
}
function clean(obj){
	if ((obj.id=='enter_email' || obj.id=='enter_email2') && document.getElementById(obj.id).value=='Email') document.getElementById(obj.id).value='';
	else if (obj.id=='phrase' && document.getElementById(obj.id).value==' Поиск по статьям') document.getElementById(obj.id).value='';
	else if (obj.id=='cname' && document.getElementById(obj.id).value=='Название компании') {
		document.getElementById(obj.id).value='';
		document.getElementById(obj.id).style.color="#222222";
	}
	else if (obj.id=='qtext' && document.getElementById(obj.id).value=='Найдите вакансии по ключевому слову или ID') {
		document.getElementById(obj.id).value='';
		document.getElementById(obj.id).style.color="#222222";
	}
	else if (obj.id=='qtext2' && document.getElementById(obj.id).value=='Найдите резюме по ключевому слову или ID') {
		document.getElementById(obj.id).value='';
		document.getElementById(obj.id).style.color="#222222";
	}
}
function cleann(obj){
	if ((obj.id=='enter_email' || obj.id=='enter_email2') && document.getElementById(obj.id).value=='') document.getElementById(obj.id).value='Email';
	else if (obj.id=='phrase' && document.getElementById(obj.id).value=='') document.getElementById(obj.id).value=' Поиск по статьям';
	else if (obj.id=='cname' && document.getElementById(obj.id).value=='') {
		document.getElementById(obj.id).value='Название компании';
		document.getElementById(obj.id).style.color="#a3a3a3";
	}
	else if (obj.id=='qtext' && document.getElementById(obj.id).value=='') {
		document.getElementById(obj.id).value='Найдите вакансии по ключевому слову или ID';
		document.getElementById(obj.id).style.color="#a3a3a3";
	}
	else if (obj.id=='qtext2' && document.getElementById(obj.id).value=='') {
		document.getElementById(obj.id).value='Найдите резюме по ключевому слову или ID';
		document.getElementById(obj.id).style.color="#a3a3a3";
	}
}
function cleanloaded(oid){
	if (oid=='cname' && document.getElementById(oid).value=='Название компании') {
		document.getElementById(oid).style.color="#a3a3a3";
	}
}
function csel(obj,inid, v) {
	var req=new JsHttpRequest();
	url="/console/fcity.php?c="+obj.options[obj.selectedIndex].value+"&v="+v;
	req.open(null, url, true);
	req.onreadystatechange=function() {
		if (req.readyState==4) {
			if (req.responseJS.result==1) {
				document.getElementById(inid).innerHTML=req.responseJS.value;
			} 
		}
	}
	req.send(null);
}
function bsel(obj,inid,ret) {
	var req=new JsHttpRequest();
	url="/console/fbranch.php?b="+obj.options[obj.selectedIndex].value+"&ret="+ret;
	req.open(null, url, true);
	req.onreadystatechange=function() {
		if (req.readyState==4) {
			if (req.responseJS.result==1) {
				document.getElementById(inid).innerHTML=req.responseJS.value;
			} 
		}
	}
	req.send(null);
}
function vsel(field) {
	//if (document.getElementById(field)) document.getElementById(field).style.display="block";
}
function checkAll(ckid){
	var chckbx=document.getElementById(ckid).getElementsByTagName('input');
	for(var i=0; i<chckbx.length; i++){chckbx[i].checked=true;}
}
function UncheckAll(ckid){
	var chckbx=document.getElementById(ckid).getElementsByTagName('input');
	for(var i=0; i<chckbx.length; i++){chckbx[i].checked=false;}
}
function closewinpp(winid,frm){
	document.getElementById(winid).innerHTML='';
	if (typeof document.forms[frm].rubric!="undefined") {document.forms[frm].rubric.disabled=false;}
}
function setCookie(name, value, expires, path, domain, secure){
      document.cookie=name+"="+escape(value)+((expires) ? "; expires="+expires : "")+((path) ? "; path="+path : "")+((domain) ? "; domain="+domain : "")+((secure) ? "; secure" : "");
}
function showbranch(url,r,frm,srid,brid,rubricid) {
	var req=new JsHttpRequest();
	url=url+"?r="+r+"&b="+document.forms[frm].branch.value;
	req.open(null, url, true);
	req.onreadystatechange=function() {
		if (req.readyState==4) {
			if (req.responseJS.result==1) {
				var str1='<div class="winab"><table class="winpp"><tr><td class="winpp_tl"><img src="/client/scin/orange/img/z.gif" alt="" width="15px" height="12px"></td><td class="winpp_tc"><img src="/client/scin/orange/img/z.gif" alt="" width="1px" height="1px"></td><td class="winpp_tr"><img src="/client/scin/orange/img/z.gif" alt="" width="15px" height="12px"></td></tr><tr><td class="winpp_cl"><img src="/client/scin/orange/img/z.gif" alt="" width="1px" height="1px"></td><td class="winpp_c"><div class="winpp_cnt"><span class="winclose"><a href="javascript:void(0)" onclick="closewinpp(\''+brid+'\',\''+frm+'\')"; title="Закрыть"><img src="/client/scin/orange/img/close.gif" alt="Закрыть" title="Закрыть" width="16px" height="16px"></a></span><div class="brlist_rm"><div id="branch_block">Специализация<span class="brlist_comm">Если не выбрана ни одна специализация, то поиск ведется по всем.</span></div><div class="brlist"><ul>';
				var str2='</ul><div class="clr"></div><div class="winppcheck"><input type="button" name="submit" value="Выбрать" onclick="setbranch(\''+frm+'\',\''+srid+'\',\''+brid+'\',\''+rubricid+'\');" /> &nbsp; &nbsp; &nbsp; &nbsp; <a href="javascript:void(0)" onclick="checkAll(\''+brid+'\')">Выбрать все</a> &nbsp; &nbsp; <a href="javascript:void(0)" onclick="UncheckAll(\''+brid+'\')">Очистить все</a></div></div></div></div></td><td class="winpp_cr"><img src="/client/scin/orange/img/z.gif" alt="" width="15px" height="24px"></td></tr><tr><td class="winpp_bl"><img src="/client/scin/orange/img/z.gif" alt="" width="15px" height="14px"></td><td class="winpp_bc"><img src="/client/scin/orange/img/z.gif" alt="" width="1px" height="6px"></td><td class="winpp_br"><img src="/client/scin/orange/img/z.gif" alt="" width="15px" height="14px"></td></tr></table><!--[if lte IE 6.5]><iframe></iframe><![endif]--></div>'
				document.getElementById(brid).innerHTML=str1+req.responseJS.value+str2;
				document.forms[frm].rubric.disabled=true;
			}
		}
	}
	req.send(null);
}
function setbranch(frm,srid,brid,rubricid) {
	var req=new JsHttpRequest();
	var str="";
	var chckbx=document.getElementById(brid).getElementsByTagName('input');
	for(var i=0; i<chckbx.length; i++){if (chckbx[i].type=='checkbox' && chckbx[i].checked==true){str=str+chckbx[i].value+",";}}
	url="/console/setbranch.php?r="+str;
	req.open(null, url, true);
	req.onreadystatechange=function() {
		if (req.readyState==4) {
			if (req.responseJS.result==1) {
				document.getElementById(srid).innerHTML='<div class="sfst1"><a href="javascript:void(0)" onclick="showbranch(\'/console/showbranch.php\',document.getElementById(\''+rubricid+'\').options[document.getElementById(\''+rubricid+'\').selectedIndex].value,\''+frm+'\',\''+srid+'\',\''+brid+'\',\''+rubricid+'\');" title="Изменить специализации">Специализации</a>: '+req.responseJS.value+'</div>';
				document.forms[frm].branch.value=req.responseJS.branch;
			}
			document.forms[frm].rubric.disabled=false;
			document.getElementById(brid).innerHTML='';
		}
	}
	req.send(null);
}
function showcmpbranch(url,frm,brid,srid) {
	var req=new JsHttpRequest();
	url=url+"?b="+document.forms[frm].branch.value;
	req.open(null, url, true);
	req.onreadystatechange=function() {
		if (req.readyState==4) {
			if (req.responseJS.result==1) {
				var str1='<div class="winab"><table class="winpp"><tr><td class="winpp_tl"><img src="/client/scin/orange/img/z.gif" alt="" width="15px" height="12px"></td><td class="winpp_tc"><img src="/client/scin/orange/img/z.gif" alt="" width="1px" height="1px"></td><td class="winpp_tr"><img src="/client/scin/orange/img/z.gif" alt="" width="15px" height="12px"></td></tr><tr><td class="winpp_cl"><img src="/client/scin/orange/img/z.gif" alt="" width="1px" height="1px"></td><td class="winpp_c"><div class="winpp_cnt"><span class="winclose"><a href="javascript:void(0)" onclick="closewinpp(\''+brid+'\',\''+frm+'\')"; title="Закрыть"><img src="/client/scin/orange/img/close.gif" alt="Закрыть" title="Закрыть" width="16px" height="16px"></a></span><div class="brlist_rm"><div id="branch_block">Специализация компании<span class="brlist_comm">Если не выбрана ни одна специализация, то поиск ведется по всем.</span></div><div class="brlist"><ul>';
				var str2='</ul><div class="clr"></div><div class="winppcheck"><input type="button" name="submit" value="Выбрать" onclick="setcmpbranch(\''+frm+'\',\''+brid+'\',\''+srid+'\');" /> &nbsp; &nbsp; &nbsp; &nbsp; <a href="javascript:void(0)" onclick="checkAll(\''+brid+'\')">Выбрать все</a> &nbsp; &nbsp; <a href="javascript:void(0)" onclick="UncheckAll(\''+brid+'\')">Очистить все</a></div></div></div></div></td><td class="winpp_cr"><img src="/client/scin/orange/img/z.gif" alt="" width="15px" height="24px"></td></tr><tr><td class="winpp_bl"><img src="/client/scin/orange/img/z.gif" alt="" width="15px" height="14px"></td><td class="winpp_bc"><img src="/client/scin/orange/img/z.gif" alt="" width="1px" height="6px"></td><td class="winpp_br"><img src="/client/scin/orange/img/z.gif" alt="" width="15px" height="14px"></td></tr></table><!--[if lte IE 6.5]><iframe></iframe><![endif]--></div>'
				document.getElementById(brid).innerHTML=str1+req.responseJS.value+str2;
			}
		}
	}
	req.send(null);
}
function setcmpbranch(frm,brid,srid) {
	var req=new JsHttpRequest();
	var str="";
	var chckbx=document.getElementById(brid).getElementsByTagName('input');
	for(var i=0; i<chckbx.length; i++){if (chckbx[i].type=='checkbox' && chckbx[i].checked==true){str=str+chckbx[i].value+",";}}
	url="/console/setcmpbranch.php?r="+str;
	req.open(null, url, true);
	req.onreadystatechange=function() {
		if (req.readyState==4) {
			if (req.responseJS.result==1) {
				document.getElementById(srid).innerHTML='<div class="sfst1"><a href="javascript:void(0)" onclick="showcmpbranch(\'/console/showcmpbranch.php\',\''+frm+'\',\''+brid+'\',\''+srid+'\');" title="Изменить специализацию">Специализация компании</a>: '+req.responseJS.value+'</div>';
				document.forms[frm].branch.value=req.responseJS.branch;
			}
			document.getElementById(brid).innerHTML='';
		}
	}
	req.send(null);
}


function AbortExecution(){
	this.StopTimer();
	this.httpReq.abort();
}

function initrubric(obj,frm,srid,brid,rubricid) {
	var iid=obj.options[obj.selectedIndex].value;
	if(iid==0) document.getElementById(srid).innerHTML='';
	else document.getElementById(srid).innerHTML='<div class="sfst1"><a href="javascript:void(0)" onclick="showbranch(\'/console/showbranch.php\',document.getElementById(\''+rubricid+'\').options[document.getElementById(\''+rubricid+'\').selectedIndex].value,\''+frm+'\',\''+srid+'\',\''+brid+'\',\''+rubricid+'\');" title="Изменить специализации">Специализации</a>: все</div>';
	document.forms[frm].branch.value='';
}

function mwin(rv, n) {
	name='';
	if (rv=='v') rvt='v';
	else rvt='r';
	if (n==1){
		document.getElementById('sfmid').style.display="none";
		document.getElementById('sfwin').innerHTML='<a href="javascript:void(0)" onclick="mwin(\''+rvt+'\',2);"><img src="/client/scin/orange/img/maximize.gif" width="10px" height="10px" alt="развернуть форму поиска" title="развернуть форму поиска" /></a><a href="javascript:void(0)" onclick="mwin(\''+rvt+'\',2);" class="sfwinad">развернуть форму поиска</a>';
		name='sfmidv';
		value='none';
	} else {
		document.getElementById('sfmid').style.display="block";
		document.getElementById('sfwin').innerHTML='<a href="javascript:void(0)" onclick="mwin(\''+rvt+'\',1);"><img src="/client/scin/orange/img/minimize.gif" width="10px" height="10px" alt="свернуть форму поиска" title="свернуть форму поиска" /></a><a href="javascript:void(0)" onclick="mwin(\''+rvt+'\',1);" class="sfwinad">свернуть форму поиска</a>';
		name='sfmid'+rvt;
		value='block';
	}
	if (name!='') {
		var largeExpDate=new Date();
		largeExpDate.setTime(largeExpDate.getTime()+(365*86400000));
		domain='/';
		setCookie(name,value,largeExpDate,domain);
	}
}
function check_cmp_def(cmp) {
	document.getElementById('rmia_info').href='javascript:void(0)';
	if (document.getElementById('rmia_dopinfo')) {document.getElementById('rmia_dopinfo').href='javascript:void(0)';}
	document.getElementById('rmia_contacts').href='javascript:void(0)';
	if (cmp=='a') {
		if (document.getElementById('rmia_service')) {document.getElementById('rmia_service').href='javascript:void(0)';}
	}
}
function check_sr_def(){
	document.getElementById('sra1').href='javascript:void(0)';
	document.getElementById('sra2').href='javascript:void(0)';
	document.getElementById('sra3').href='javascript:void(0)';
}
function check_sr(ref) {
	if (ref=='sr_my_resume' || ref=='sr_load_resume' || ref=='sr_paste_resume') {
	var my=document.getElementById('sr_my_resume');
	var load=document.getElementById('sr_load_resume');
	var paste=document.getElementById('sr_paste_resume');
	} else if (ref=='sr_my_vacancy' || ref=='sr_load_vacancy' || ref=='sr_paste_vacancy') {
	var my=document.getElementById('sr_my_vacancy');
	var load=document.getElementById('sr_load_vacancy');
	var paste=document.getElementById('sr_paste_vacancy');
	}
	var rs1=document.getElementById('rs1');
	var rs2=document.getElementById('rs2');
	var rs3=document.getElementById('rs3');
	var sra1=document.getElementById('sra1');
	var sra2=document.getElementById('sra2');
	var sra3=document.getElementById('sra3');
	var sri1=document.getElementById('sri1');
	var sri2=document.getElementById('sri2');
	var sri3=document.getElementById('sri3');
	if (ref=='sr_my_resume' || ref=='sr_my_vacancy') {
		my.style.display='block';
		rs1.style.backgroundColor='#fff';
		sra1.style.color='#000';
		sri1.style.borderBottom='0px solid #d1d1d1';
		load.style.display='none';
		rs2.style.backgroundColor='#fafafa';
		sra2.style.color='#9b9b9b';
		sri2.style.borderBottom='1px solid #b9b9b9';
		paste.style.display='none';
		rs3.style.backgroundColor='#fafafa';
		sra3.style.color='#9b9b9b';
		sri3.style.borderBottom='1px solid #b9b9b9';
		document.getElementById('vtype').value='1';
	} else if (ref=='sr_load_resume' || ref=='sr_load_vacancy') {
		my.style.display='none';
		rs1.style.backgroundColor='#fafafa';
		sra1.style.color='#9b9b9b';
		sri1.style.borderBottom='1px solid #b9b9b9';
		load.style.display='block';
		rs2.style.backgroundColor='#fff';
		sra2.style.color='#000';
		sri2.style.borderBottom='0px solid #d1d1d1';		
		paste.style.display='none';
		rs3.style.backgroundColor='#fafafa';
		sra3.style.color='#9b9b9b';
		sri3.style.borderBottom='1px solid #b9b9b9';
		document.getElementById('vtype').value='2';
	} else if (ref=='sr_paste_resume' || ref=='sr_paste_vacancy') {
		my.style.display='none';
		rs1.style.backgroundColor='#fafafa';
		sra1.style.color='#9b9b9b';
		sri1.style.borderBottom='1px solid #b9b9b9';
		load.style.display='none';
		rs2.style.backgroundColor='#fafafa';
		sra2.style.color='#9b9b9b';
		sri2.style.borderBottom='1px solid #b9b9b9';
		paste.style.display='block';
		rs3.style.backgroundColor='#fff';
		sra3.style.color='#000';
		sri3.style.borderBottom='0px solid #d1d1d1';
		document.getElementById('vtype').value='3';
	}
}
function openWin(obj, page) {
	width=240;
	height=280;
	x=(screen.width/2)-(width/2);
	y=(screen.height/2)-(height/2);
	document.getElementById(obj.id).href='javascript:void(0)';
	document.getElementById(obj.id).target='_self';	
	myWin=open(page, "displayWindow", "width="+width+",height="+height+",status=no,toolbar=no,menubar=no,resizable=yes,top="+y+",left="+x);
}
function openWinView(obj, page, height) {
	//document.getElementById(obj.id).href='javascript:void(0)';
	//document.getElementById(obj.id).target='_self';
	var width=720;
	//height=730;
	var x=(screen.width/2)-(width/2);
	var y=(screen.height/2)-(height/2);
	window.open(page, "_blank", "width="+width+",height="+height+",menubar=no,scrollbars=yes,status=yes,toolbar=no,resizable=yes,top="+y+",left="+x);
}
function ShowEmail(){
	document.getElementById("link_email").style.display='none';;
	document.getElementById("show_captcha").style.display='block';;

}
function ShowEmailResume(rid, keystring) {
	var req=new JsHttpRequest();
    req.onreadystatechange=function() {
    	if (req.readyState==1) {document.getElementById('show_captcha').innerHTML='Проверка...';}
    	if (req.readyState==4) {
    		if (req.responseJS.result==1) {
    			document.getElementById("show_captcha").style.display='none';;
    			document.getElementById('link_email').style.display='block';
    			document.getElementById('link_email').innerHTML=req.responseJS.text;
    		}
    		else {document.getElementById('show_captcha').innerHTML=req.responseJS.text;}
    	}
    }
    req.open('get', '/console/captha_resume.php', true);
    req.send({"id":rid, "keystring":keystring});
}
function passblur(ids) {
	if (ids.value == '') {
		ids.style.display = 'none';
		document.getElementById('password2').style.display = '';
	}
}
function passblur2(ids) {
	if (ids.value == '' && document.getElementById('password').value == ''){
		document.getElementById('password').style.display = 'none';
		ids.style.display = '';
		ids.focus();
	}
}
function passfocus2(ids) {
	ids.style.display = 'none';
	document.getElementById('password').style.display = '';
	document.getElementById('password').focus();
}

function chSym(obj,count_max) {
	var txt="";
	var cnt=obj.value.length;
	if (cnt>count_max) {txt="<span class='cerror'>"+cnt+"</span>";}
	else {txt=cnt;}
	document.getElementById(obj.id+'_count').innerHTML=txt;
}

