<!--

var current_action = 'add_area';

function openUrl (url) {
  var width  = screen.width;
  var height =  screen.height;
  var offset_x = 120;
  var offset_y = 60;
  var top_correct = -30;

  var str = '';

  if (window.screen) { 
  	var w = width - offset_x*2; 
  	var h = height - offset_y*2; 
  	str += "width="+w+",height="+h+",left=" + offset_x; 
  	str += ",top=" + (offset_y+top_correct); 
  } 
  window.open(url,"",str+",alwaysRaised=yes,toolbar=0,directories=0,menubar=0,status=1,location=0,scrollbars=1,copyhistory=0")
}


function switch_subaction(action) {
	if (action == current_action) {
		return false;
	}
	var action_id = action+'_form';
	var current_action_id = current_action+'_form'
	var action_form = document.getElementById(action_id);
	var current_action_form = document.getElementById(current_action_id);
			
	current_action_form.style.display = 'none';
	action_form.style.display = 'block';
	current_action = action;
		
	return false;
}

function newWindowSize(scriptName,width,height)
 {
    window.open(scriptName,"","width="+width+",height="+height+",top=50,left=120,alwaysRaised=yes,toolbar=0,directories=0,menubar=0,status=1,resizable=no,location=0,scrollbars=1,copyhistory=0");
 }

function showCodeDiv(element){
	var div_element = document.getElementById('code_div_id');
	
	if (element.checked){
		div_element.style.display='block';
	} else {
		div_element.style.display='none';
	}
	
}

function addNewBaseEducation() {
	var new_div_id = base_education_id.length;
	
	var div_element=document.getElementById('base_education_div');
	
	newDiv = document.createElement("div");
	newDiv.setAttribute('id', 'base_education_item_'+new_div_id);
	newDiv.innerHTML = '<table style="margin: 15px 0; border-top: 1px solid #c2c2c2; padding-top: 15px;" border="0" cellpadding="0" cellspacing="2" width="100%"><tr align="left"><td>'+RiaLang.school_name+':</td></tr><tr align="left"><td width="500" ><textarea rows="3" style="width:500px;" type="text" name="base_education[]" id="base_education_'+new_div_id+'" maxlength="255"></textarea></td></tr><tr><td style="text-align: right;"><span style="float: left; width: 50%; text-align: left;"><label for="base_education_note_'+new_div_id+'">'+RiaLang.education_years+'</label>: <input style="width:100px;" type="text" name="base_education_note[]" id="base_education_note_'+new_div_id+'" maxlength="255"></span><a href="javascript: void(0);" style="color: #ff0000;" onclick="deleteBaseEducation('+new_div_id+');return false;">'+RiaLang['delete_word']+'</a></td></tr></table>';
	div_element.appendChild(newDiv);
	
	base_education_id[new_div_id] = 1;
}

function deleteBaseEducation(educ_id)
{
	if (educ_id==0){
		alert('Этот элемент нельзя удалять!');
		return false;
	}
	var div_element=document.getElementById('base_education_item_'+educ_id);
	div_element.innerHTML = '';
	base_education_id[educ_id] = 0;
}

function addNewAddEducation() {
	var new_div_id = ad_education_id.length;
	var div_element=document.getElementById('ad_education_div');
	newDiv = document.createElement("div");
	newDiv.setAttribute('id', 'ad_education_item_'+new_div_id);
	newDiv.innerHTML = '<table border="0" cellpadding="0" cellspacing="2" width="100%"><tr align="left"><td width="210"><input style="width:200px;" type="text" name="ad_education[]" id="ad_education_'+new_div_id+'" maxlength="255"></td><td width="210"><input style="width:200px;" type="text" name="ad_education_note[]" id="ad_education_note_'+new_div_id+'" maxlength="255"></td><td><a href="" onclick="deleteAdEducation('+new_div_id+');return false;">'+RiaLang['delete_word']+'</a></td></tr></table>';
	div_element.appendChild(newDiv);
	ad_education_id[new_div_id] = 1;
}

function deleteAdEducation(educ_id)
{
	if (educ_id==0){
		alert('Этот элемент нельзя удалять!');
		return false;
	}
	var div_element=document.getElementById('ad_education_item_'+educ_id);
	div_element.innerHTML = '';
	ad_education_id[educ_id] = 0;
}

function addNewCompEducation() {
	var new_div_id = comp_education_id.length;
	var div_element=document.getElementById('comp_education_div');
	newDiv = document.createElement("div");
	newDiv.setAttribute('id', 'comp_education_item_'+new_div_id);
	newDiv.innerHTML = '<table border="0" cellpadding="0" cellspacing="2" width="100%"><tr align="left"><td width="210" class="required_left"><input style="width:200px;" type="text" name="comp_education[]" id="comp_education_'+new_div_id+'" maxlength="255"></td><td width="220" class="required_left">(<input style="width:20px;" type="text" name="comp_education_note[]" id="comp_education_note_'+new_div_id+'" maxlength="1">)</td><td><a href="" onclick="deleteCompEducation('+new_div_id+');return false;">'+RiaLang['delete_word']+'</a></td></tr></table>';
	div_element.appendChild(newDiv);
	comp_education_id[new_div_id] = 1;
}

function deleteCompEducation(educ_id)
{
	if (educ_id==0){
		alert('Этот элемент нельзя удалять!');
		return false;
	}
	var div_element=document.getElementById('comp_education_item_'+educ_id);
	div_element.innerHTML = '';
	comp_education_id[educ_id] = 0;
}


function addNewVacancePlace() {
	var count = 0;
	var new_div_id = place_id.length;
	
	for (ii=0; ii<new_div_id; ii++){
		if (place_id[ii] == 1) count++;
	}
	if (count >= 4){
		alert('Допустимое количество мест для одной вакансии равен 4');
		return false;
	}
	var div_places=document.getElementById('vacance_places_div');
	
	newDiv = document.createElement("div");
	newDiv.setAttribute('id', 'vacance_place_'+new_div_id);
	newDiv.innerHTML = '<table border="0" cellpadding="0" cellspacing="2" width="100%"><tr align="left"><td width="210px" class="required_left"><select style="width:200px;" name="obl_id[]" id="obl_vacance_'+new_div_id+'"></select></td><td width="210px" class="required_left"><div id="city_select_'+new_div_id+'" style="width:200px;" ><select class="default" name="city_id[]" id="city_vacance_'+new_div_id+'"><option value="0">  --  '+RiaLang['select_state']+' --  </option></select></div></td><td><a href="" onclick="deleteVacancePlace('+new_div_id+');return false;">'+RiaLang['delete_word']+'</a></td></tr></table>';
	div_places.appendChild(newDiv);
	
	place_id[new_div_id] = 1;
	
	var obl_element_1 = document.getElementById('obl_vacance_0');
	var obl_element_2 = document.getElementById('obl_vacance_'+new_div_id);
	
	for (ii=0; ii<obl_element_1.options.length; ii++){
		obl_element_2[ii]=new Option(obl_element_1.options[ii].text, obl_element_1.options[ii].value);
	}
	var e = new load_multi_cities_evt('obl_vacance_'+new_div_id,'city_select_'+new_div_id);
}

function deleteVacancePlace(place)
{
	var div_element=document.getElementById('vacance_place_'+place);
	div_element.innerHTML = '';
	place_id[place] = 0;
}

function addNewMestoRabot()	
{ 
	var new_div_id = place_id.length;
	
	var element_mesto=document.getElementById('mesto_rabot');
	newDiv = document.createElement("div");
	newDiv.setAttribute('id', 'mesto_'+new_div_id);
	newDiv.innerHTML = '<hr size="1"><b>'+RiaLang['work_place']+':</b><table border="0" cellpadding="0" cellspacing="2" width="100%"><tbody><tr><td width="160">'+RiaLang['org_name']+':</td><td><input class="user_input_field" name="org_name[]" type="text"></td></tr><tr><td width="160">'+RiaLang['dolzhnost']+':</td><td><input class="user_input_field" name="dolzhnost[]" type="text"></td></tr><tr><td width="160">'+RiaLang['dolzhnost']+':</td><td><input class="user_input_field" name="period[]" type="text"></td></tr><tr><td width="160">'+RiaLang['obyazanosti']+':</td><td><input class="user_input_field" name="obyazanosti[]" type="text"></td></tr><tr><td width="160">'+RiaLang['dostizeniya']+':</td><td><input class="user_input_field" name="dostizeniya[]" type="text"></td></tr><tr><td colspan="2" align="right"><a href="" onclick="deleteMestoRabot('+new_div_id+');return false;">'+RiaLang['delete_word']+'</a></td></tr></tbody></table>';
	element_mesto.appendChild(newDiv);
	place_id[new_div_id] = 1;
}

function deleteMestoRabot(id)
{
	var element_mesto=document.getElementById('mesto_'+id);
	element_mesto.innerHTML = '';
}

function view_resume_photos(r,p){ 
	window.open("./?target=view&event=resume_photos&resume_id="+r+"&photo_id="+p,"s","width=680,height=670,scrollbars=yes");
	return false;
}

function view_test_result(test_id,points){ 
	window.open("./?target=test&event=result_window&test_id="+test_id+"&points="+points,"s","width=400,height=400,scrollbars=yes");
	return false;
}

function view_faq_window(linck){ 
	widthW = 680;
	if (window.screen.height > 600)
	{
		heightW = 580;
		yW = (screen.height/2)-(heightW/2);
	} else {
		heightW = 400;
		yW =30;
	}
	xW = (screen.width/2)-(widthW/2);
	window.open("./?target=faq&linck="+linck,"s","width="+widthW+",height="+heightW+",scrollbars=yes,status=yes,toolbar=yes,resizable=yes,top="+yW+",left="+xW);
	return false;
}

function reset_search_page(new_value,page,count_all){
		
	var old_value=Cookie.get("result_on_page");
	var items=(old_value*(page+1));
	
	if ((Math.ceil(count_all/old_value)) == (page+1)){
		items=items-(items-count_all);
	}
	
	var new_page=(Math.ceil(items/new_value)-1);
	
	if (new_page<0){ 
		new_page=0;
	}
	
	Cookie.set('result_on_page', new_value, {duration: 365, path: '/'});
	
	if (window.location.href.indexOf('page=')!==-1){
		window.location.href=window.location.href.replace(/\&page\=\d*/,"&page=" + new_page);
	} else {
		window.location.href=window.location.href;
	}

	
		
}

//-->