function check(){
	var f=document.forms['reg'];
		var valid_name=/^[a-zà-ÿ_^d]{2,50}$/i;
		if(valid_name.test(f.name.value)){f.namehid.value="ok";f.namehid.style.color="green";}else{f.namehid.value="";f.namehid.style.color="red";}
		var valid_sname=/^[a-zà-ÿ_^d]{2,50}$/i;
		if(valid_sname.test(f.sname.value)){f.snamehid.value="ok";f.snamehid.style.color="green";}else{f.snamehid.value="";f.snamehid.style.color="red";}
		var valid_nick=/^[0-9a-z_]{3,50}$/i;
		if(valid_nick.test(f.nick.value)){f.nickhid.value="ok";f.nickhid.style.color="green";}else{f.nickhid.value="";f.nickhid.style.color="red";}
		var valid_passw=/^[0-9a-z_]{4,30}$/i;
		if(valid_passw.test(f.passw.value)){f.passwhid.value="ok";f.passwhid.style.color="green";}else{f.passwhid.value="";f.passwhid.style.color="red";}
		if(f.passw.value == f.vpassw.value && f.vpassw.value !=""){f.vpasswhid.value="ok";f.vpasswhid.style.color="green";}else{f.vpasswhid.value="";f.vpasswhid.style.color="red";}
		var valid_city=/^[a-zà-ÿ_-]{2,50}$/i;
		if(valid_city.test(f.city.value)){f.cityhid.value="ok";f.cityhid.style.color="green";}else{f.cityhid.value="";f.cityhid.style.color="red";}
		var valid_spec=/^[a-zà-ÿ_\:\;\,\!\?\(\)\+\¹\&\@\%\.\-\—\–\"\d\s]{1,300}$/i;
		if(valid_spec.test(f.speciality.value)){f.specialityhid.value="ok";f.specialityhid.style.color="green";}else{f.specialityhid.value="";f.specialityhid.style.color="red";}

//		if(document.all.interests.style.display=='block'){
		var valid_jobtime=/^[0-9]+[0-9à-ÿa-z\.\-\s]+$/i;
		if(valid_jobtime.test(f.jobtime.value) ){f.jobtimehid.value="ok";f.jobtimehid.style.color="green";}else{f.jobtimehid.value="";f.jobtimehid.style.color="red";}
//		}else if(document.all.interests.style.display=='none'){f.jobtimehid.value="ok";}
		var valid_mail=/[0-9a-z_]+\@[0-9a-z_^.]+\.[a-z]{2,3}$/i;
		if(valid_mail.test(f.mail.value)){f.mailhid.value="ok";f.mailhid.style.color="green";}else{f.mailhid.value="";f.mailhid.style.color="red";}
		var valid_phone=/^[0-9\(\)\+\-]{7,14}$/i;
		if(valid_phone.test(f.phone.value)){f.phonehid.value="ok";f.phonehid.style.color="green";}else{f.phonehid.value="";f.phonehid.style.color="red";}

		if(document.getElementById('show_jobtime').style.display=='block'){
		if(f.agreement.checked && f.namehid.value=="ok" && f.snamehid.value=="ok" && f.nickhid.value=="ok" && f.passwhid.value=="ok" && f.vpasswhid.value=="ok" && f.cityhid.value=="ok" && f.specialityhid.value=="ok" && f.jobtimehid.value=="ok" && f.mailhid.value=="ok" ){
			f.reg_butt.disabled="";
		}else{
			f.reg_butt.disabled="on";
		}
		}
		if(document.getElementById('show_jobtime').style.display=='none'){
		if(f.agreement.checked && f.namehid.value=="ok" && f.snamehid.value=="ok" && f.nickhid.value=="ok" && f.passwhid.value=="ok" && f.vpasswhid.value=="ok" && f.cityhid.value=="ok" && f.specialityhid.value=="ok" && f.mailhid.value=="ok" ){
			f.reg_butt.disabled="";
		}else{
			f.reg_butt.disabled="on";
		}
		}

}

function tcheck(){
	var f=document.forms['vacadd'];
		var valid_name=/^[a-zà-ÿ_\:\;\,\!\?\(\)\+\¹\@\%\.\-\—\"\d\s]+$/i;
		if(valid_name.test(f.title.value)){f.titlehid.value="ok";f.titlehid.style.color="green";}else{f.titlehid.value="";f.titlehid.style.color="red";}
		var valid_name=/^[a-zà-ÿ_\:\;\,\!\?\(\)\+\¹\@\%\.\-\—\"\d\s]+$/i;
		if(valid_name.test(f.company.value)){f.companyhid.value="ok";f.companyhid.style.color="green";}else{f.companyhid.value="";f.companyhid.style.color="red";}
		var valid_name=/^[a-zà-ÿ_\:\;\,\!\?\(\)\+\¹\@\%\.\-\—\"\d\s]+$/i;
		if(valid_name.test(f.region.value)){f.regionhid.value="ok";f.regionhid.style.color="green";}else{f.regionhid.value="";f.regionhid.style.color="red";}
		var valid_name=/^[a-zà-ÿ_\:\;\,\!\?\(\)\+\¹\@\%\.\-\—\"\d\s]+$/i;
		if(valid_name.test(f.expirience.value)){f.expiriencehid.value="ok";f.expiriencehid.style.color="green";}else{f.expiriencehid.value="";f.expiriencehid.style.color="red";}
		var valid_name=/^[a-zà-ÿ_\:\;\,\!\?\(\)\+\¹\@\%\.\-\—\"\d\s]+$/i;
		if(valid_name.test(f.money.value)){f.moneyhid.value="ok";f.moneyhid.style.color="green";}else{f.moneyhid.value="";f.moneyhid.style.color="red";}
		var valid_name=/^[a-zà-ÿ_\:\;\,\!\?\(\)\+\¹\@\%\.\-\—\"\d\s]+$/i;
		if(valid_name.test(f.description.value)){f.descriptionhid.value="ok";f.descriptionhid.style.color="green";}else{f.descriptionhid.value="";f.descriptionhid.style.color="red";}

		if(f.titlehid.value=="ok" && f.companyhid.value=="ok" && f.regionhid.value=="ok" && f.expiriencehid.value=="ok" && f.moneyhid.value=="ok" && f.descriptionhid.value=="ok"){
			f.vac_add.disabled="";
		}else{
			f.vac_add.disabled="on";
		}
}


function rcheck(){
	var f=document.forms['resadd'];
		var valid_name=/^[a-zà-ÿ_\:\;\,\!\?\(\)\+\¹\@\&\%\.\-\—\–\"\d\s\«\»\¸\¨]+$/i;
		if(valid_name.test(f.dolgnost.value)){f.dolgnosthid.value="ok";f.dolgnosthid.style.color="green";}else{f.dolgnosthid.value="";f.dolgnosthid.style.color="red";}
		if(valid_name.test(f.region.value)){f.regionhid.value="ok";f.regionhid.style.color="green";}else{f.regionhid.value="";f.regionhid.style.color="red";}
		if(valid_name.test(f.otrasl.value)){f.otraslhid.value="ok";f.otraslhid.style.color="green";}else{f.otraslhid.value="";f.otraslhid.style.color="red";}
		if(valid_name.test(f.opyt.value)){f.opythid.value="ok";f.opythid.style.color="green";}else{f.opythid.value="";f.opythid.style.color="red";}
		if(valid_name.test(f.grafik.value)){f.grafikhid.value="ok";f.grafikhid.style.color="green";}else{f.grafikhid.value="";f.grafikhid.style.color="red";}
		if(valid_name.test(f.money.value)){f.moneyhid.value="ok";f.moneyhid.style.color="green";}else{f.moneyhid.value="";f.moneyhid.style.color="red";}
		if(valid_name.test(f.text.value)){f.texthid.value="ok";f.texthid.style.color="green";}else{f.texthid.value="";f.texthid.style.color="red";}

		if(f.dolgnosthid.value=="ok" && f.regionhid.value=="ok" && f.otraslhid.value=="ok" && f.opythid.value=="ok" && f.grafikhid.value=="ok" && f.moneyhid.value=="ok" && f.texthid.value=="ok"){
			f.res_add.disabled="";
		}else{
			f.res_add.disabled="on";
		}
}



function zapros(){
	var f=document.forms['vac_zapros'];
		var valid_name=/^[a-zà-ÿ_\s^d]{2,50}$/i;
		if(valid_name.test(f.name.value)){f.namehid.value="ok";f.namehid.style.color="green";}else{f.namehid.value="";f.namehid.style.color="red";}
		var valid_mail=/[0-9a-z_]+\@[0-9a-z_^.]+\.[a-z]{2,3}$/i;
		if(valid_mail.test(f.mail.value)){f.mailhid.value="ok";f.mailhid.style.color="green";}else{f.mailhid.value="";f.mailhid.style.color="red";}
		var valid_phone=/^[0-9]\([0-9]{3}\)[0-9]{7}$/i;
		if(valid_phone.test(f.phone.value)){f.phonehid.value="ok";f.phonehid.style.color="green";}else{f.phonehid.value="";f.phonehid.style.color="red";}
		var test_contr=/[0-9]{4}$/i;
		if(f.namehid.value=="ok" && f.mailhid.value=="ok" && test_contr.test(f.contr.value)){
			f.button_zapros.disabled="";
		}else{
			f.button_zapros.disabled="on";
		}
}

function sendfriend(){
	var f=document.forms['send_friend'];
		var valid_name=/^[a-zà-ÿ_\s^d]{2,50}$/i;
		if(valid_name.test(f.name.value)){f.namehid.value="ok";f.namehid.style.color="green";}else{f.namehid.value="";f.namehid.style.color="red";}
		var valid_mail=/[0-9a-z_]+\@[0-9a-z_^.]+\.[a-z]{2,3}$/i;
		if(valid_mail.test(f.mailfrom.value)){f.mailfromhid.value="ok";f.mailfromhid.style.color="green";}else{f.mailfromhid.value="";f.mailfromhid.style.color="red";}
		if(valid_mail.test(f.mailto.value)){f.mailtohid.value="ok";f.mailtohid.style.color="green";}else{f.mailtohid.value="";f.mailtohid.style.color="red";}
		var test_contr=/[0-9]{4}$/i;
		if(f.namehid.value=="ok" && f.mailfromhid.value=="ok" && f.mailtohid.value=="ok" && test_contr.test(f.contr.value)){
			f.button_sendfriend.disabled="";
		}else{
			f.button_sendfriend.disabled="on";
		}
}




function getBrowserInfo() {
 	var t,v = undefined;
 	if (window.opera) t = 'Opera';
 	else if (document.all) {
 		t = 'IE';
 		var nv = navigator.appVersion;
  		var s = nv.indexOf('MSIE')+5;
  		v = nv.substring(s,s+1);
 	}
 	else if (navigator.appName) t = 'Netscape';
 	return {type:t,version:v};
}
 
function bookmark(a){
 	var url = window.document.location;
 	var title = window.document.title;
 	var b = getBrowserInfo();
 	if (b.type == 'IE' && 7 > b.version && b.version >= 4) window.external.AddFavorite(url,title);
 	else if (b.type == 'Opera') {
 	 a.href = url;
 	 a.rel = "sidebar";
 	 a.title = url+','+title;
 	 return true;
 	}
 	else if (b.type == "Netscape") window.sidebar.addPanel(title,url,"");
 	else alert("Íàæìèòå CTRL-D, ÷òîáû äîáàâèòü ñòðàíèöó â çàêëàäêè.");
 	return false;
}





function show_wide_search(){
	var container=document.getElementById('wide_show');
	
	if(container.style.display=='block')
	  document.getElementById('wide_show').style.display='none';
	else{
	  document.getElementById('wide_show').style.display='block';
		
	}	

}

function fastnotice(){
	var container=document.getElementById('add_fast_notice');
	
	if(container.style.display=='block')
	  container.style.display='none';
	else{
	  container.style.display='block';
		
	}	

}

function showservice(element){
	var container=document.getElementById(element);
	
	if(container.style.display=='block')
	  container.style.display='none';
	else{
	  container.style.display='block';
		
	}	

}

function lettercompose(){
	var container=document.getElementById('lettercompose');
	
	if(container.style.display=='block')
	  container.style.display='none';
	else{
	  container.style.display='block';
		
	}	

}

function show_wide_top(){
	var container=document.getElementById('wide_topshow');
	
	if(container.style.display=='block')
	  document.getElementById('wide_topshow').style.display='none';
	else{
	  document.getElementById('wide_topshow').style.display='block';
		
	}	

}

function show_autorize_top(){
	var container=document.getElementById('autorize_topshow');
	
	if(container.style.display=='block')
	  document.getElementById('autorize_topshow').style.display='none';
	else{
	  document.getElementById('autorize_topshow').style.display='block';
		
	}	

}

function showhide(obj){
	switch(obj.value){
	 case 'employer':
	 	document.getElementById('show_additional').style.display='block';
	 	document.getElementById('show_jobtime').style.display='none';
	 	document.getElementById('show_jobtime1').style.display='none';
	 	document.getElementById('show_jobtime2').style.display='none';
		
	 	break;
	 case 'competitor':
	 	document.getElementById('show_additional').style.display='none';
	 	document.getElementById('show_jobtime').style.display='block';
	 	document.getElementById('show_jobtime1').style.display='block';
	 	document.getElementById('show_jobtime2').style.display='block';
		break;
	};
	
}


function init(){
	 	document.getElementById('show_additional').style.display='none';
	 	document.getElementById('show_jobtime').style.display='block';
	 	document.getElementById('show_jobtime1').style.display='block';
	 	document.getElementById('show_jobtime2').style.display='block';

}



function dataSelect(f) {
  
	 var n = f.selectedIndex;
     if(n >= 0){
     	document.all.region.value=f.options[n].value;
     }
	checkValue(document.all.region);
}

function checkValue(v){
	
	if(v.value == "Âñå ðåãèîíû"){v.value="";}
	
}


function changeSearchStr(str){
	document.getElementById('form_input').value=str.value;
}

function additem(num){


	var obj,container;
//	alert(znext);
	container = document.getElementById('zadditem').parentNode;
	var list=container.childNodes;
	var znext=list.length;
	var num=num+1;
//	alert(znext);

//	if(list.length >3){container.removeChild(container.lastChild);}
	ins = document.createElement("div");
	ins.innerHTML=''+
			 ''+
			  '<div style="float:none;width:480px;">'+
			  '<div style="float:left;">Ñ <input type="text" name="from['+num+']" value="" size="6">&nbsp;</div>'+
			  '<div style="float:left;"> ïî <input type="text" name="to['+num+']" value="" size="6">&nbsp;</div>'+
			  '<div style="float:left;"><textarea name="job['+num+']" value="" cols="30" rows="4"></textarea></div>'+
			  '<div style="float:left;">'+
			  '<span class="colorSoftBlue" style="cursor:pointer;" onclick="additem('+num+')">+</span>&nbsp;'+
			  '<span class="colorSoftBlue" style="cursor:pointer;" onclick="remitem('+num+')">&minus;</span>'+
		 	  '</div>'+
			  '</div>'+
			 ''+
		'';
//	alert(ins.innerHTML);
	container.appendChild(ins);
}

function remitem(num){

	var znext=num+1;
	var obj,container;
//	alert(znext);
	container = document.all.zadditem.parentNode;
	var list=container.childNodes;
	if(list.length > num){container.removeChild(container.lastChild);}
}



function oadditem(num){


	var obj,container;
//	alert(znext);
	container = document.getElementById('ozadditem').parentNode;
	var list=container.childNodes;
	var znext=list.length;
	var num=num+1;
//	alert(znext);

//	if(list.length >3){container.removeChild(container.lastChild);}
	ins = document.createElement("div");
	ins.innerHTML=''+
			 ''+
			  '<div style="float:none;width:480px;">'+
			  '<div style="float:left;">Ñ <input type="text" name="ofrom['+num+']" value="" size="6">&nbsp;</div>'+
			  '<div style="float:left;"> ïî <input type="text" name="oto['+num+']" value="" size="6">&nbsp;</div>'+
			  '<div style="float:left;"><textarea name="ojob['+num+']" value="" cols="30" rows="4"></textarea></div>'+
			  '<div style="float:left;">'+
			  '<span class="colorSoftBlue" style="cursor:pointer;" onclick="oadditem('+num+')">+</span>&nbsp;'+
			  '<span class="colorSoftBlue" style="cursor:pointer;" onclick="oremitem('+num+')">&minus;</span>'+
		 	  '</div>'+
			  '</div>'+
			 ''+
		'';
//	alert(ins.innerHTML);
	container.appendChild(ins);
}

function oremitem(num){

	var znext=num+1;
	var obj,container;
//	alert(znext);
	container = document.all.ozadditem.parentNode;
	var list=container.childNodes;
	if(list.length > num){container.removeChild(container.lastChild);}
}


function padditem(num){


	var obj,container;
//	alert(znext);
	container = document.getElementById('pzadditem').parentNode;
	var list=container.childNodes;
	var znext=list.length;
	var num=num+1;
//	alert(znext);

//	if(list.length >3){container.removeChild(container.lastChild);}
	ins = document.createElement("div");
	ins.innerHTML=''+
			 ''+
			  '<div style="float:none;width:480px;">'+
			  '<div style="float:left;">Ñ <input type="text" name="pfrom['+num+']" value="" size="6">&nbsp;</div>'+
			  '<div style="float:left;"> ïî <input type="text" name="pto['+num+']" value="" size="6">&nbsp;</div>'+
			  '<div style="float:left;"><textarea name="pjob['+num+']" value="" cols="30" rows="4"></textarea></div>'+
			  '<div style="float:left;">'+
			  '<span class="colorSoftBlue" style="cursor:pointer;" onclick="padditem('+num+')">+</span>&nbsp;'+
			  '<span class="colorSoftBlue" style="cursor:pointer;" onclick="premitem('+num+')">&minus;</span>'+
		 	  '</div>'+
			  '</div>'+
			 ''+
		'';
//	alert(ins.innerHTML);
	container.appendChild(ins);
}

function premitem(num){

	var znext=num+1;
	var obj,container;
//	alert(znext);
	container = document.all.pzadditem.parentNode;
	var list=container.childNodes;
	if(list.length > num){container.removeChild(container.lastChild);}
}

/* Alexis Parinoff */
function openBlock(el) {
	var kids = el.parentNode.childNodes;
	for (var k = 0; k < kids.length; k++) {
		var child = kids[k];
		if (child && child.className == "this_block_is_hidden") {
			if (child.style.display != 'block') {
				child.style.display = 'block';
			} else {
				child.style.display = 'none';
			}
		}
	}
}
/* Alexis Parinoff */
